Passed
Pull Request — master (#28)
by Volodymyr
05:26
created

PayoneFacade   B

Complexity

Total Complexity 43

Size/Duplication

Total Lines 661
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 73
dl 0
loc 661
rs 8.96
c 0
b 0
f 0
wmc 43

42 Methods

Rating   Name   Duplication   Size   Complexity  
A isPaymentPaid() 0 5 1
A sendConsumerScoreRequest() 0 5 1
A isPaymentAppointed() 0 5 1
A filterPaymentMethods() 0 5 1
A isAuthorizationError() 0 3 1
A creditCardCheck() 0 3 1
A postSaveHook() 0 5 1
A debitPayment() 0 3 1
A isPaymentUnderpaid() 0 5 1
A isPaymentOther() 0 5 1
A isPaymentNotificationAvailable() 0 5 1
A isPaymentOverpaid() 0 5 1
A getPaymentDetail() 0 3 1
A isRefundError() 0 3 1
A isAuthorizationApproved() 0 3 1
A isRefundPossible() 0 3 1
A getPaymentLogs() 0 4 1
A getFile() 0 3 1
A isCaptureApproved() 0 3 1
A isPaymentRefund() 0 5 1
A authorizePayment() 0 3 1
A isCaptureError() 0 3 1
A getInvoice() 0 3 1
A preAuthorizePayment() 0 3 1
A manageMandate() 0 3 1
A bankAccountCheck() 0 3 1
A getPaypalExpressCheckoutDetails() 0 3 1
A sendAddressCheckRequest() 0 5 1
A isAuthorizationRedirect() 0 3 1
A getSecurityInvoice() 0 3 1
A saveOrder() 0 3 1
A isPreAuthorizationError() 0 3 1
A isPreauthorizationRedirect() 0 3 1
A isPaymentDataRequired() 0 3 1
A processTransactionStatusUpdate() 0 9 2
A isPaymentCapture() 0 5 1
A isRefundApproved() 0 3 1
A isPreauthorizationApproved() 0 3 1
A updatePaymentDetail() 0 3 1
A capturePayment() 0 3 1
A initPaypalExpressCheckout() 0 3 1
A refundPayment() 0 3 1

How to fix   Complexity   

Complex Class

Complex classes like PayoneFacade often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use PayoneFacade, and based on these observations, apply Extract Interface, too.

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\Business;
9
10
use Generated\Shared\Transfer\AddressCheckResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ssCheckResponseTransfer 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 Generated\Shared\Transfer\CaptureResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CaptureResponseTransfer 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...
12
use Generated\Shared\Transfer\CheckoutResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\CheckoutResponseTransfer 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...
13
use Generated\Shared\Transfer\ConsumerScoreResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...erScoreResponseTransfer 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...
14
use Generated\Shared\Transfer\OrderCollectionTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\OrderCollectionTransfer 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...
15
use Generated\Shared\Transfer\OrderTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\OrderTransfer 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...
16
use Generated\Shared\Transfer\PaymentDetailTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentDetailTransfer 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...
17
use Generated\Shared\Transfer\PaymentMethodsTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentMethodsTransfer 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...
18
use Generated\Shared\Transfer\PayoneBankAccountCheckTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ankAccountCheckTransfer 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...
19
use Generated\Shared\Transfer\PayoneCaptureTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PayoneCaptureTransfer 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...
20
use Generated\Shared\Transfer\PayoneCreditCardTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PayoneCreditCardTransfer 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...
21
use Generated\Shared\Transfer\PayoneGetFileTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PayoneGetFileTransfer 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...
22
use Generated\Shared\Transfer\PayoneGetInvoiceTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PayoneGetInvoiceTransfer 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...
23
use Generated\Shared\Transfer\PayoneGetSecurityInvoiceTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...SecurityInvoiceTransfer 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...
24
use Generated\Shared\Transfer\PayoneInitPaypalExpressCheckoutRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...CheckoutRequestTransfer 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...
25
use Generated\Shared\Transfer\PayoneManageMandateTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...neManageMandateTransfer 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...
26
use Generated\Shared\Transfer\PayoneRefundTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PayoneRefundTransfer 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...
27
use Generated\Shared\Transfer\PayoneTransactionStatusUpdateTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ionStatusUpdateTransfer 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...
28
use Generated\Shared\Transfer\QuoteTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer 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...
29
use Spryker\Zed\Kernel\Business\AbstractFacade;
30
31
/**
32
 * @method \SprykerEco\Zed\Payone\Business\PayoneBusinessFactory getFactory()
33
 */
34
class PayoneFacade extends AbstractFacade implements PayoneFacadeInterface
35
{
36
    /**
37
     * Specification:
38
     * - Saves order payment method data according to quote and checkout response transfer data.
39
     *
40
     * @api
41
     *
42
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
43
     * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse
44
     *
45
     * @return void
46
     */
47
    public function saveOrder(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
48
    {
49
        $this->getFactory()->createOrderManager()->saveOrder($quoteTransfer, $checkoutResponse);
50
    }
51
52
    /**
53
     * Specification:
54
     * - Performs payment authorization request to Payone API and updates payment data.
55
     *
56
     * @api
57
     *
58
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
59
     *
60
     * @return \Generated\Shared\Transfer\AuthorizationResponseTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...izationResponseTransfer 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...
61
     */
62
    public function authorizePayment(OrderTransfer $orderTransfer)
63
    {
64
        return $this->getFactory()->createPaymentManager()->authorizePayment($orderTransfer);
65
    }
66
67
    /**
68
     * Specification:
69
     * - Performs payment pre-authorization request to Payone API and updates payment data.
70
     *
71
     * @api
72
     *
73
     * @param int $idSalesOrder
74
     *
75
     * @return \Generated\Shared\Transfer\AuthorizationResponseTransfer
76
     */
77
    public function preAuthorizePayment($idSalesOrder)
78
    {
79
        return $this->getFactory()->createPaymentManager()->preAuthorizePayment($idSalesOrder);
80
    }
81
82
    /**
83
     * Specification:
84
     * - Performs payment capture request to Payone API.
85
     *
86
     * @api
87
     *
88
     * @param \Generated\Shared\Transfer\PayoneCaptureTransfer $captureTransfer
89
     *
90
     * @return \Generated\Shared\Transfer\CaptureResponseTransfer
91
     */
92
    public function capturePayment(PayoneCaptureTransfer $captureTransfer): CaptureResponseTransfer
93
    {
94
        return $this->getFactory()->createPaymentManager()->capturePayment($captureTransfer);
95
    }
96
97
    /**
98
     * Specification:
99
     * - Performs payment debit request to Payone API.
100
     *
101
     * @api
102
     *
103
     * @param int $idPayment
104
     *
105
     * @return \Generated\Shared\Transfer\DebitResponseTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\DebitResponseTransfer 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...
106
     */
107
    public function debitPayment($idPayment)
108
    {
109
        return $this->getFactory()->createPaymentManager()->debitPayment($idPayment);
110
    }
111
112
    /**
113
     * Specification:
114
     * - Performs payment refund request to Payone API.
115
     *
116
     * @api
117
     *
118
     * @param \Generated\Shared\Transfer\PayoneRefundTransfer $refundTransfer
119
     *
120
     * @return \Generated\Shared\Transfer\RefundResponseTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\RefundResponseTransfer 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...
121
     */
122
    public function refundPayment(PayoneRefundTransfer $refundTransfer)
123
    {
124
        return $this->getFactory()->createPaymentManager()->refundPayment($refundTransfer);
125
    }
126
127
    /**
128
     * Specification:
129
     * - Performs credit card check request to Payone API.
130
     *
131
     * @api
132
     *
133
     * @param \Generated\Shared\Transfer\PayoneCreditCardTransfer $creditCardData
134
     *
135
     * @return \Generated\Shared\Transfer\CreditCardCheckResponseTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...rdCheckResponseTransfer 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...
136
     */
137
    public function creditCardCheck(PayoneCreditCardTransfer $creditCardData)
138
    {
139
        return $this->getFactory()->createPaymentManager()->creditCardCheck($creditCardData);
140
    }
141
142
    /**
143
     * @api
144
     *
145
     * @param \Generated\Shared\Transfer\PayoneBankAccountCheckTransfer $bankAccountCheckTransfer
146
     *
147
     * @return \Generated\Shared\Transfer\PayoneBankAccountCheckTransfer
148
     */
149
    public function bankAccountCheck(PayoneBankAccountCheckTransfer $bankAccountCheckTransfer)
150
    {
151
        return $this->getFactory()->createPaymentManager()->bankAccountCheck($bankAccountCheckTransfer);
152
    }
153
154
    /**
155
     * Specification:
156
     * - Performs manage mandate request to Payone API.
157
     *
158
     * @api
159
     *
160
     * @param \Generated\Shared\Transfer\PayoneManageMandateTransfer $manageMandateTransfer
161
     *
162
     * @return \Generated\Shared\Transfer\PayoneManageMandateTransfer
163
     */
164
    public function manageMandate(PayoneManageMandateTransfer $manageMandateTransfer)
165
    {
166
        return $this->getFactory()->createPaymentManager()->manageMandate($manageMandateTransfer);
167
    }
168
169
    /**
170
     * Specification:
171
     * - Performs GetFile request to Payone API for PDF file download.
172
     *
173
     * @api
174
     *
175
     * @param \Generated\Shared\Transfer\PayoneGetFileTransfer $getFileTransfer
176
     *
177
     * @return \Generated\Shared\Transfer\PayoneGetFileTransfer
178
     */
179
    public function getFile(PayoneGetFileTransfer $getFileTransfer)
180
    {
181
        return $this->getFactory()->createPaymentManager()->getFile($getFileTransfer);
182
    }
183
184
    /**
185
     * Specification:
186
     * - Performs GetInvoice request to Payone API for PDF file download.
187
     *
188
     * @api
189
     *
190
     * @param \Generated\Shared\Transfer\PayoneGetInvoiceTransfer $getInvoiceTransfer
191
     *
192
     * @return \Generated\Shared\Transfer\PayoneGetInvoiceTransfer
193
     */
194
    public function getInvoice(PayoneGetInvoiceTransfer $getInvoiceTransfer)
195
    {
196
        return $this->getFactory()->createPaymentManager()->getInvoice($getInvoiceTransfer);
197
    }
198
199
    /**
200
     * Specification:
201
     * - Performs GetInvoice request to Payone API for PDF file download.
202
     *
203
     * @api
204
     *
205
     * @param \Generated\Shared\Transfer\PayoneGetSecurityInvoiceTransfer $getSecurityInvoiceTransfer
206
     *
207
     * @return \Generated\Shared\Transfer\PayoneGetSecurityInvoiceTransfer
208
     */
209
    public function getSecurityInvoice(PayoneGetSecurityInvoiceTransfer $getSecurityInvoiceTransfer): PayoneGetSecurityInvoiceTransfer
210
    {
211
        return $this->getFactory()->createPaymentManager()->getSecurityInvoice($getSecurityInvoiceTransfer);
212
    }
213
214
    /**
215
     * Specification:
216
     * - Processes and saves transaction status update request received from Payone.
217
     *
218
     * @api
219
     *
220
     * @param \Generated\Shared\Transfer\PayoneTransactionStatusUpdateTransfer $transactionStatusUpdateTransfer
221
     *
222
     * @return \Generated\Shared\Transfer\PayoneTransactionStatusUpdateTransfer
223
     */
224
    public function processTransactionStatusUpdate(PayoneTransactionStatusUpdateTransfer $transactionStatusUpdateTransfer)
225
    {
226
        $transactionManager = $this->getFactory()->createTransactionStatusManager();
227
        $transactionTransfer = $this->getFactory()->createTransactionStatusUpdateRequest($transactionStatusUpdateTransfer);
228
        $response = $transactionManager->processTransactionStatusUpdate($transactionTransfer);
229
        $transactionStatusUpdateTransfer->setIsSuccess($response->isSuccess());
230
        $transactionStatusUpdateTransfer->setResponse($response->getStatus() . ($response->getErrorMessage() ? ': ' . $response->getErrorMessage() : ''));
231
232
        return $transactionStatusUpdateTransfer;
233
    }
234
235
    /**
236
     * Specification:
237
     * - Checks if API logs contain 'APPROVED' response for authorization request for given order.
238
     *
239
     * @api
240
     *
241
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
242
     *
243
     * @return bool
244
     */
245
    public function isAuthorizationApproved(OrderTransfer $orderTransfer)
246
    {
247
        return $this->getFactory()->createApiLogFinder()->isAuthorizationApproved($orderTransfer);
248
    }
249
250
    /**
251
     * Specification:
252
     * - Checks if API logs contain 'REDIRECT' response for authorization request for given order.
253
     *
254
     * @api
255
     *
256
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
257
     *
258
     * @return bool
259
     */
260
    public function isAuthorizationRedirect(OrderTransfer $orderTransfer)
261
    {
262
        return $this->getFactory()->createApiLogFinder()->isAuthorizationRedirect($orderTransfer);
263
    }
264
265
    /**
266
     * Specification:
267
     * - Checks if API logs contain 'APPROVED' response for pre-authorization request for given order.
268
     *
269
     * @api
270
     *
271
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
272
     *
273
     * @return bool
274
     */
275
    public function isPreauthorizationApproved(OrderTransfer $orderTransfer)
276
    {
277
        return $this->getFactory()->createApiLogFinder()->isPreAuthorizationApproved($orderTransfer);
278
    }
279
280
    /**
281
     * Specification:
282
     * - Checks if API logs contain 'REDIRECT' response for pre-authorization request for given order.
283
     *
284
     * @api
285
     *
286
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
287
     *
288
     * @return bool
289
     */
290
    public function isPreauthorizationRedirect(OrderTransfer $orderTransfer)
291
    {
292
        return $this->getFactory()->createApiLogFinder()->isPreAuthorizationRedirect($orderTransfer);
293
    }
294
295
    /**
296
     * Specification:
297
     * - Checks if API logs contain 'ERROR' response for pre-authorization request for given order.
298
     *
299
     * @api
300
     *
301
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
302
     *
303
     * @return bool
304
     */
305
    public function isPreAuthorizationError(OrderTransfer $orderTransfer)
306
    {
307
        return $this->getFactory()->createApiLogFinder()->isPreAuthorizationError($orderTransfer);
308
    }
309
310
    /**
311
     * Specification:
312
     * - Checks if API logs contain 'ERROR' response for authorization request for given order.
313
     *
314
     * @api
315
     *
316
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
317
     *
318
     * @return bool
319
     */
320
    public function isAuthorizationError(OrderTransfer $orderTransfer)
321
    {
322
        return $this->getFactory()->createApiLogFinder()->isAuthorizationError($orderTransfer);
323
    }
324
325
    /**
326
     * Specification:
327
     * - Checks if API logs contain 'APPROVED' response to capture request for given order.
328
     *
329
     * @api
330
     *
331
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
332
     *
333
     * @return bool
334
     */
335
    public function isCaptureApproved(OrderTransfer $orderTransfer)
336
    {
337
        return $this->getFactory()->createApiLogFinder()->isCaptureApproved($orderTransfer);
338
    }
339
340
    /**
341
     * Specification:
342
     * - Checks if API logs contain 'ERROR' response to capture request for given order.
343
     *
344
     * @api
345
     *
346
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
347
     *
348
     * @return bool
349
     */
350
    public function isCaptureError(OrderTransfer $orderTransfer)
351
    {
352
        return $this->getFactory()->createApiLogFinder()->isCaptureError($orderTransfer);
353
    }
354
355
    /**
356
     * Specification:
357
     * - Checks if API logs contain 'APPROVED' response to refund request for given order.
358
     *
359
     * @api
360
     *
361
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
362
     *
363
     * @return bool
364
     */
365
    public function isRefundApproved(OrderTransfer $orderTransfer)
366
    {
367
        return $this->getFactory()->createApiLogFinder()->isRefundApproved($orderTransfer);
368
    }
369
370
    /**
371
     * Specification:
372
     * - Checks if API logs contain 'ERROR' response to refund request for given order.
373
     *
374
     * @api
375
     *
376
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
377
     *
378
     * @return bool
379
     */
380
    public function isRefundError(OrderTransfer $orderTransfer)
381
    {
382
        return $this->getFactory()->createApiLogFinder()->isRefundError($orderTransfer);
383
    }
384
385
    /**
386
     * Specification:
387
     * - Checks if refund is possible for given order.
388
     *
389
     * @api
390
     *
391
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
392
     *
393
     * @return bool
394
     */
395
    public function isRefundPossible(OrderTransfer $orderTransfer)
396
    {
397
        return $this->getFactory()->createPaymentManager()->isRefundPossible($orderTransfer);
398
    }
399
400
    /**
401
     * Specification:
402
     * - Checks if used payment method references stored iban/bic data for given order.
403
     *
404
     * @api
405
     *
406
     * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer
407
     *
408
     * @return bool
409
     */
410
    public function isPaymentDataRequired(OrderTransfer $orderTransfer)
411
    {
412
        return $this->getFactory()->createPaymentManager()->isPaymentDataRequired($orderTransfer);
413
    }
414
415
    /**
416
     * Specification:
417
     * - Checks if there are unprocessed transaction status logs for given order/item.
418
     *
419
     * @api
420
     *
421
     * @param int $idSalesOrder
422
     * @param int $idSalesOrderItem
423
     *
424
     * @return bool
425
     */
426
    public function isPaymentNotificationAvailable($idSalesOrder, $idSalesOrderItem)
427
    {
428
        return $this->getFactory()
429
            ->createTransactionStatusManager()
430
            ->isPaymentNotificationAvailable($idSalesOrder, $idSalesOrderItem);
431
    }
432
433
    /**
434
     * Specification:
435
     * - Checks if first unprocessed transaction status log record for given order/item has 'PAID' status with zero or negative balance.
436
     *
437
     * @api
438
     *
439
     * @param int $idSalesOrder
440
     * @param int $idSalesOrderItem
441
     *
442
     * @return bool
443
     */
444
    public function isPaymentPaid($idSalesOrder, $idSalesOrderItem)
445
    {
446
        return $this->getFactory()
447
            ->createTransactionStatusManager()
448
            ->isPaymentPaid($idSalesOrder, $idSalesOrderItem);
449
    }
450
451
    /**
452
     * Specification:
453
     * - Checks if first unprocessed transaction status log record for given order/item has 'PAID' status with negative balance.
454
     *
455
     * @api
456
     *
457
     * @param int $idSalesOrder
458
     * @param int $idSalesOrderItem
459
     *
460
     * @return bool
461
     */
462
    public function isPaymentOverpaid($idSalesOrder, $idSalesOrderItem)
463
    {
464
        return $this->getFactory()
465
            ->createTransactionStatusManager()
466
            ->isPaymentOverpaid($idSalesOrder, $idSalesOrderItem);
467
    }
468
469
    /**
470
     * Specification:
471
     * - Checks if first unprocessed transaction status log record for given order/item has 'UNDERPAID' status.
472
     *
473
     * @api
474
     *
475
     * @param int $idSalesOrder
476
     * @param int $idSalesOrderItem
477
     *
478
     * @return bool
479
     */
480
    public function isPaymentUnderpaid($idSalesOrder, $idSalesOrderItem)
481
    {
482
        return $this->getFactory()
483
            ->createTransactionStatusManager()
484
            ->isPaymentUnderpaid($idSalesOrder, $idSalesOrderItem);
485
    }
486
487
    /**
488
     * Specification:
489
     * - Checks if first unprocessed transaction status log record for given order/item has 'REFUND' status.
490
     *
491
     * @api
492
     *
493
     * @param int $idSalesOrder
494
     * @param int $idSalesOrderItem
495
     *
496
     * @return bool
497
     */
498
    public function isPaymentRefund($idSalesOrder, $idSalesOrderItem)
499
    {
500
        return $this->getFactory()
501
            ->createTransactionStatusManager()
502
            ->isPaymentRefund($idSalesOrder, $idSalesOrderItem);
503
    }
504
505
    /**
506
     * Specification:
507
     * - Checks if first unprocessed transaction status log record for given order/item has 'APPOINTED' status.
508
     *
509
     * @api
510
     *
511
     * @param int $idSalesOrder
512
     * @param int $idSalesOrderItem
513
     *
514
     * @return bool
515
     */
516
    public function isPaymentAppointed($idSalesOrder, $idSalesOrderItem)
517
    {
518
        return $this->getFactory()
519
            ->createTransactionStatusManager()
520
            ->isPaymentAppointed($idSalesOrder, $idSalesOrderItem);
521
    }
522
523
    /**
524
     * Specification:
525
     * - Checks if first unprocessed transaction status log record for given order/item is not in 'PAID', 'APPOINTED' or 'UNDERPAID' status.
526
     *
527
     * @api
528
     *
529
     * @param int $idSalesOrder
530
     * @param int $idSalesOrderItem
531
     *
532
     * @return bool
533
     */
534
    public function isPaymentOther($idSalesOrder, $idSalesOrderItem)
535
    {
536
        return $this->getFactory()
537
            ->createTransactionStatusManager()
538
            ->isPaymentOther($idSalesOrder, $idSalesOrderItem);
539
    }
540
541
    /**
542
     * Specification:
543
     * - Checks if first unprocessed transaction status log record for given order/item has 'CAPTURE' status.
544
     *
545
     * @api
546
     *
547
     * @param int $idSalesOrder
548
     * @param int $idSalesOrderItem
549
     *
550
     * @return bool
551
     */
552
    public function isPaymentCapture($idSalesOrder, $idSalesOrderItem)
553
    {
554
        return $this->getFactory()
555
            ->createTransactionStatusManager()
556
            ->isPaymentCapture($idSalesOrder, $idSalesOrderItem);
557
    }
558
559
    /**
560
     * Specification:
561
     * - Handles redirects and errors after order placement.
562
     *
563
     * @api
564
     *
565
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
566
     * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse
567
     *
568
     * @return \Generated\Shared\Transfer\CheckoutResponseTransfer
569
     */
570
    public function postSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
571
    {
572
        return $this->getFactory()
573
            ->createPaymentManager()
574
            ->postSaveHook($quoteTransfer, $checkoutResponse);
575
    }
576
577
    /**
578
     * Specification:
579
     * - Gets payment logs (both api and transaction status) for specific orders in chronological order.
580
     *
581
     * @api
582
     *
583
     * @param \Generated\Shared\Transfer\OrderCollectionTransfer $orderCollectionTransfer
584
     *
585
     * @return \Generated\Shared\Transfer\PayonePaymentLogCollectionTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ntLogCollectionTransfer 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...
586
     */
587
    public function getPaymentLogs(OrderCollectionTransfer $orderCollectionTransfer)
588
    {
589
        $orders = $orderCollectionTransfer->getOrders();
590
        return $this->getFactory()->createPaymentManager()->getPaymentLogs($orders);
591
    }
592
593
    /**
594
     * Specification:
595
     * - Gets payment details for given order.
596
     *
597
     * @api
598
     *
599
     * @param int $idOrder
600
     *
601
     * @return \Generated\Shared\Transfer\PaymentDetailTransfer
602
     */
603
    public function getPaymentDetail($idOrder)
604
    {
605
        return $this->getFactory()->createPaymentManager()->getPaymentDetail($idOrder);
606
    }
607
608
    /**
609
     * Specification:
610
     * - Updates payment details for given order.
611
     *
612
     * @api
613
     *
614
     * @param \Generated\Shared\Transfer\PaymentDetailTransfer $paymentData
615
     * @param int $idOrder
616
     *
617
     * @return void
618
     */
619
    public function updatePaymentDetail(PaymentDetailTransfer $paymentData, $idOrder)
620
    {
621
        $this->getFactory()->createPaymentManager()->updatePaymentDetail($paymentData, $idOrder);
622
    }
623
624
    /**
625
     * @api
626
     *
627
     * @param \Generated\Shared\Transfer\PayoneInitPaypalExpressCheckoutRequestTransfer $requestTransfer
628
     *
629
     * @return \Generated\Shared\Transfer\PayonePaypalExpressCheckoutGenericPaymentResponseTransfer
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...PaymentResponseTransfer 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...
630
     */
631
    public function initPaypalExpressCheckout(PayoneInitPaypalExpressCheckoutRequestTransfer $requestTransfer)
632
    {
633
        return $this->getFactory()->createPaymentManager()->initPaypalExpressCheckout($requestTransfer);
634
    }
635
636
    /**
637
     * @api
638
     *
639
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
640
     *
641
     * @return \Generated\Shared\Transfer\PayonePaypalExpressCheckoutGenericPaymentResponseTransfer
642
     */
643
    public function getPaypalExpressCheckoutDetails(QuoteTransfer $quoteTransfer)
644
    {
645
        return $this->getFactory()->createPaymentManager()->getPaypalExpressCheckoutDetails($quoteTransfer);
646
    }
647
648
    /**
649
     * {@inheritdoc}
650
     *
651
     * @api
652
     *
653
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
654
     *
655
     * @return \Generated\Shared\Transfer\AddressCheckResponseTransfer
656
     */
657
    public function sendAddressCheckRequest(QuoteTransfer $quoteTransfer): AddressCheckResponseTransfer
658
    {
659
        return $this->getFactory()
660
            ->createRiskCheckManager()
661
            ->sendAddressCheckRequest($quoteTransfer);
662
    }
663
664
    /**
665
     * {@inheritdoc}
666
     *
667
     * @api
668
     *
669
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
670
     *
671
     * @return \Generated\Shared\Transfer\ConsumerScoreResponseTransfer
672
     */
673
    public function sendConsumerScoreRequest(QuoteTransfer $quoteTransfer): ConsumerScoreResponseTransfer
674
    {
675
        return $this->getFactory()
676
            ->createRiskCheckManager()
677
            ->sendConsumerScoreRequest($quoteTransfer);
678
    }
679
680
    /**
681
     * {@inheritdoc}
682
     *
683
     * @api
684
     *
685
     * @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer
686
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
687
     *
688
     * @return \Generated\Shared\Transfer\PaymentMethodsTransfer
689
     */
690
    public function filterPaymentMethods(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer): PaymentMethodsTransfer
691
    {
692
        return $this->getFactory()
693
            ->createPaymentMethodFilter()
694
            ->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer);
695
    }
696
}
697