createPaymentByTransactionIdQuery()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Payone\Persistence;
9
10
use Orm\Zed\Payone\Persistence\SpyPaymentPayoneApiLogQuery;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Payone\Persisten...aymentPayoneApiLogQuery was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Propel\Runtime\ActiveQuery\Criteria;
12
use Spryker\Zed\Kernel\Persistence\AbstractQueryContainer;
13
use SprykerEco\Shared\Payone\PayoneApiConstants;
14
15
/**
16
 * @method \SprykerEco\Zed\Payone\Persistence\PayonePersistenceFactory getFactory()
17
 */
18
class PayoneQueryContainer extends AbstractQueryContainer implements PayoneQueryContainerInterface
19
{
20
    /**
21
     * {@inheritDoc}
22
     *
23
     * @api
24
     *
25
     * @param int $transactionId
26
     *
27
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneApiLogQuery
28
     */
29
    public function createCurrentSequenceNumberQuery(int $transactionId): SpyPaymentPayoneApiLogQuery
30
    {
31
        $query = $this->getFactory()->createPaymentPayoneApiLogQuery();
32
        $query->filterByTransactionId($transactionId)
33
            ->orderBySequenceNumber(Criteria::DESC);
34
35
        return $query;
36
    }
37
38
    /**
39
     * {@inheritDoc}
40
     *
41
     * @api
42
     *
43
     * @param int $transactionId
44
     *
45
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneQuery
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Payone\Persistence\SpyPaymentPayoneQuery was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
46
     */
47
    public function createPaymentByTransactionIdQuery($transactionId)
48
    {
49
        $query = $this->getFactory()->createPaymentPayoneQuery();
50
        $query->filterByTransactionId($transactionId);
51
52
        return $query;
53
    }
54
55
    /**
56
     * {@inheritDoc}
57
     *
58
     * @api
59
     *
60
     * @param string $invoiceTitle
61
     * @param int $customerId
62
     *
63
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneQuery
64
     */
65
    public function createPaymentByInvoiceTitleAndCustomerIdQuery($invoiceTitle, $customerId)
66
    {
67
        $query = $this->getFactory()->createPaymentPayoneQuery();
68
        $query->useSpySalesOrderQuery()
69
                ->filterByFkCustomer($customerId)
70
            ->endUse()
71
            ->useSpyPaymentPayoneDetailQuery()
72
                ->filterByInvoiceTitle($invoiceTitle)
73
            ->endUse()
74
            ->useSpyPaymentPayoneApiLogQuery()
75
                ->filterByStatus(PayoneApiConstants::RESPONSE_TYPE_APPROVED)
76
            ->endUse();
77
78
        return $query;
79
    }
80
81
    /**
82
     * {@inheritDoc}
83
     *
84
     * @api
85
     *
86
     * @param string $fileReference
87
     * @param int $customerId
88
     *
89
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneQuery
90
     */
91
    public function createPaymentByFileReferenceAndCustomerIdQuery($fileReference, $customerId)
92
    {
93
        $query = $this->getFactory()->createPaymentPayoneQuery();
94
        $query->useSpySalesOrderQuery()
95
                ->filterByFkCustomer($customerId)
96
            ->endUse()
97
            ->useSpyPaymentPayoneDetailQuery()
98
                ->filterByMandateIdentification($fileReference)
99
            ->endUse()
100
            ->useSpyPaymentPayoneApiLogQuery()
101
                ->filterByStatus(PayoneApiConstants::RESPONSE_TYPE_APPROVED)
102
            ->endUse();
103
104
        return $query;
105
    }
106
107
    /**
108
     * {@inheritDoc}
109
     *
110
     * @api
111
     *
112
     * @param int $fkPayment
113
     * @param string $requestName
114
     *
115
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneApiLogQuery
116
     */
117
    public function createApiLogByPaymentAndRequestTypeQuery($fkPayment, $requestName)
118
    {
119
        $query = $this->getFactory()->createPaymentPayoneApiLogQuery();
120
        $query->filterByFkPaymentPayone($fkPayment)
121
              ->filterByRequest($requestName);
122
123
        return $query;
124
    }
125
126
    /**
127
     * {@inheritDoc}
128
     *
129
     * @api
130
     *
131
     * @param int $idOrder
132
     *
133
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneQuery
134
     */
135
    public function createPaymentByOrderId($idOrder)
136
    {
137
        $query = $this->getFactory()->createPaymentPayoneQuery();
138
        $query->findByFkSalesOrder($idOrder);
139
140
        return $query;
141
    }
142
143
    /**
144
     * {@inheritDoc}
145
     *
146
     * @api
147
     *
148
     * @param int $idOrder
149
     * @param string $request
150
     *
151
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneApiLogQuery
152
     */
153
    public function createApiLogsByOrderIdAndRequest($idOrder, $request)
154
    {
155
        $query = $this->getFactory()->createPaymentPayoneApiLogQuery()
156
            ->useSpyPaymentPayoneQuery()
157
                ->filterByFkSalesOrder($idOrder)
158
            ->endUse()
159
            ->filterByRequest($request)
160
            ->orderByCreatedAt(Criteria::DESC) //TODO: Index?
161
            ->orderByIdPaymentPayoneApiLog(Criteria::DESC);
162
163
        return $query;
164
    }
165
166
    /**
167
     * {@inheritDoc}
168
     *
169
     * @api
170
     *
171
     * @param int $orderId
172
     *
173
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneQuery
174
     */
175
    public function createPaymentById($orderId)
176
    {
177
        $query = $this->getFactory()->createPaymentPayoneQuery();
178
        $query->findByFkSalesOrder($orderId);
179
180
        return $query;
181
    }
182
183
    /**
184
     * {@inheritDoc}
185
     *
186
     * @api
187
     *
188
     * @param int $idIdSalesOrder
189
     *
190
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLogQuery
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Payone\Persisten...ansactionStatusLogQuery was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
191
     */
192
    public function createTransactionStatusLogsBySalesOrder($idIdSalesOrder)
193
    {
194
        $query = $this->getFactory()->createPaymentPayoneTransactionStatusLogQuery()
195
            ->useSpyPaymentPayoneQuery()
196
                ->filterByFkSalesOrder($idIdSalesOrder)
197
            ->endUse()
198
            ->orderByCreatedAt();
199
200
        return $query;
201
    }
202
203
    /**
204
     * {@inheritDoc}
205
     *
206
     * @api
207
     *
208
     * @param int $idSalesOrderItem
209
     * @param array $ids
210
     *
211
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLogOrderItemQuery
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Payone\Persisten...StatusLogOrderItemQuery was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
212
     */
213
    public function createTransactionStatusLogOrderItemsByLogIds($idSalesOrderItem, $ids)
214
    {
215
        $relations = $this->getFactory()->createPaymentPayoneTransactionStatusLogOrderItemQuery()
216
            ->filterByIdPaymentPayoneTransactionStatusLog($ids, Criteria::IN)
217
            ->filterByIdSalesOrderItem($idSalesOrderItem);
218
219
        return $relations;
220
    }
221
222
    /**
223
     * {@inheritDoc}
224
     *
225
     * @api
226
     *
227
     * @param int $idSalesOrder
228
     *
229
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneApiLogQuery
230
     */
231
    public function createLastApiLogsByOrderId($idSalesOrder)
232
    {
233
        $query = $this->getFactory()->createPaymentPayoneApiLogQuery()
234
            ->useSpyPaymentPayoneQuery()
235
                ->filterByFkSalesOrder($idSalesOrder)
236
            ->endUse()
237
            ->orderByCreatedAt(Criteria::DESC)
238
            ->orderByIdPaymentPayoneApiLog(Criteria::DESC);
239
240
        return $query;
241
    }
242
243
    /**
244
     * {@inheritDoc}
245
     *
246
     * @api
247
     *
248
     * @param \Propel\Runtime\Collection\ObjectCollection $orders
249
     *
250
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneApiLogQuery
251
     */
252
    public function createApiLogsByOrderIds($orders)
253
    {
254
        $ids = [];
255
        /** @var \Orm\Zed\Sales\Persistence\SpySalesOrder $order */
256
        foreach ($orders as $order) {
257
            $ids[] = $order->getIdSalesOrder();
258
        }
259
260
        $query = $this->getFactory()->createPaymentPayoneApiLogQuery()
261
            ->useSpyPaymentPayoneQuery()
262
                ->filterByFkSalesOrder($ids, Criteria::IN)
263
            ->endUse()
264
            ->orderByCreatedAt();
265
266
        return $query;
267
    }
268
269
    /**
270
     * {@inheritDoc}
271
     *
272
     * @api
273
     *
274
     * @param \Orm\Zed\Sales\Persistence\SpySalesOrder[] $orders
275
     *
276
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLogQuery
277
     */
278
    public function createTransactionStatusLogsByOrderIds($orders)
279
    {
280
        $ids = [];
281
        foreach ($orders as $order) {
282
            $ids[] = $order->getIdSalesOrder();
283
        }
284
285
        return $this->getFactory()->createPaymentPayoneTransactionStatusLogQuery()
286
            ->useSpyPaymentPayoneQuery()
287
                ->filterByFkSalesOrder($ids, Criteria::IN)
288
            ->endUse()
289
            ->orderByCreatedAt();
290
    }
291
292
    /**
293
     * {@inheritDoc}
294
     *
295
     * @api
296
     *
297
     * @return \Orm\Zed\Payone\Persistence\SpyPaymentPayoneApiCallLogQuery
0 ignored issues
show
Bug introduced by
The type Orm\Zed\Payone\Persisten...ntPayoneApiCallLogQuery was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
298
     */
299
    public function createApiCallLog()
300
    {
301
        return $this->getFactory()->createPaymentPayoneApiCallLogQuery();
302
    }
303
}
304