|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MIT License |
|
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\CrefoPay\Business; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CheckoutResponseTransfer; |
|
|
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\CrefoPayNotificationTransfer; |
|
|
|
|
|
|
12
|
|
|
use Generated\Shared\Transfer\OrderTransfer; |
|
|
|
|
|
|
13
|
|
|
use Generated\Shared\Transfer\PaymentMethodsTransfer; |
|
|
|
|
|
|
14
|
|
|
use Generated\Shared\Transfer\QuoteTransfer; |
|
|
|
|
|
|
15
|
|
|
use Generated\Shared\Transfer\RefundTransfer; |
|
|
|
|
|
|
16
|
|
|
use Generated\Shared\Transfer\SaveOrderTransfer; |
|
|
|
|
|
|
17
|
|
|
use Spryker\Zed\Kernel\Business\AbstractFacade; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @method \SprykerEco\Zed\CrefoPay\Business\CrefoPayBusinessFactory getFactory() |
|
21
|
|
|
* @method \SprykerEco\Zed\CrefoPay\Persistence\CrefoPayEntityManagerInterface getEntityManager() |
|
22
|
|
|
* @method \SprykerEco\Zed\CrefoPay\Persistence\CrefoPayRepositoryInterface getRepository() |
|
23
|
|
|
*/ |
|
24
|
|
|
class CrefoPayFacade extends AbstractFacade implements CrefoPayFacadeInterface |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* {@inheritDoc} |
|
28
|
|
|
* |
|
29
|
|
|
* @api |
|
30
|
|
|
* |
|
31
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
|
32
|
|
|
* |
|
33
|
|
|
* @return \Generated\Shared\Transfer\QuoteTransfer |
|
34
|
|
|
*/ |
|
35
|
|
|
public function startCrefoPayTransaction(QuoteTransfer $quoteTransfer): QuoteTransfer |
|
36
|
|
|
{ |
|
37
|
|
|
return $this->getFactory() |
|
38
|
|
|
->createQuoteExpander() |
|
39
|
|
|
->expand($quoteTransfer); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* {@inheritDoc} |
|
44
|
|
|
* |
|
45
|
|
|
* @api |
|
46
|
|
|
* |
|
47
|
|
|
* @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer |
|
48
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
|
49
|
|
|
* |
|
50
|
|
|
* @return \Generated\Shared\Transfer\PaymentMethodsTransfer |
|
51
|
|
|
*/ |
|
52
|
|
|
public function filterPaymentMethods( |
|
53
|
|
|
PaymentMethodsTransfer $paymentMethodsTransfer, |
|
54
|
|
|
QuoteTransfer $quoteTransfer |
|
55
|
|
|
): PaymentMethodsTransfer { |
|
56
|
|
|
return $this->getFactory() |
|
57
|
|
|
->createPaymentMethodFilter() |
|
58
|
|
|
->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* {@inheritDoc} |
|
63
|
|
|
* |
|
64
|
|
|
* @api |
|
65
|
|
|
* |
|
66
|
|
|
* @param \Generated\Shared\Transfer\CrefoPayNotificationTransfer $notificationTransfer |
|
67
|
|
|
* |
|
68
|
|
|
* @return \Generated\Shared\Transfer\CrefoPayNotificationTransfer |
|
69
|
|
|
*/ |
|
70
|
|
|
public function processNotification(CrefoPayNotificationTransfer $notificationTransfer): CrefoPayNotificationTransfer |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->getFactory() |
|
73
|
|
|
->createCrefoPayNotificationProcessor() |
|
74
|
|
|
->processNotification($notificationTransfer); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* {@inheritDoc} |
|
79
|
|
|
* |
|
80
|
|
|
* @api |
|
81
|
|
|
* |
|
82
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
|
83
|
|
|
* @param \Generated\Shared\Transfer\SaveOrderTransfer $saveOrderTransfer |
|
84
|
|
|
* |
|
85
|
|
|
* @return void |
|
86
|
|
|
*/ |
|
87
|
|
|
public function saveOrderPayment(QuoteTransfer $quoteTransfer, SaveOrderTransfer $saveOrderTransfer): void |
|
88
|
|
|
{ |
|
89
|
|
|
$this->getFactory() |
|
90
|
|
|
->createOrderPaymentSaver() |
|
91
|
|
|
->saveOrderPayment($quoteTransfer, $saveOrderTransfer); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* {@inheritDoc} |
|
96
|
|
|
* |
|
97
|
|
|
* @api |
|
98
|
|
|
* |
|
99
|
|
|
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer |
|
100
|
|
|
* @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse |
|
101
|
|
|
* |
|
102
|
|
|
* @return void |
|
103
|
|
|
*/ |
|
104
|
|
|
public function executePostSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse): void |
|
105
|
|
|
{ |
|
106
|
|
|
$this->getFactory() |
|
107
|
|
|
->createCheckoutPostSaveHook() |
|
108
|
|
|
->execute($quoteTransfer, $checkoutResponse); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* {@inheritDoc} |
|
113
|
|
|
* |
|
114
|
|
|
* @api |
|
115
|
|
|
* |
|
116
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
117
|
|
|
* @param array<int> $salesOrderItemIds |
|
118
|
|
|
* |
|
119
|
|
|
* @return void |
|
120
|
|
|
*/ |
|
121
|
|
|
public function executeCancelOmsCommand(OrderTransfer $orderTransfer, array $salesOrderItemIds): void |
|
122
|
|
|
{ |
|
123
|
|
|
$this->getFactory() |
|
124
|
|
|
->createCancelOmsCommand() |
|
125
|
|
|
->execute($orderTransfer, $salesOrderItemIds); |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* {@inheritDoc} |
|
130
|
|
|
* |
|
131
|
|
|
* @api |
|
132
|
|
|
* |
|
133
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
134
|
|
|
* @param array<int> $salesOrderItemIds |
|
135
|
|
|
* |
|
136
|
|
|
* @return void |
|
137
|
|
|
*/ |
|
138
|
|
|
public function executeCaptureOmsCommand(OrderTransfer $orderTransfer, array $salesOrderItemIds): void |
|
139
|
|
|
{ |
|
140
|
|
|
$this->getFactory() |
|
141
|
|
|
->createCaptureOmsCommand() |
|
142
|
|
|
->execute($orderTransfer, $salesOrderItemIds); |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* {@inheritDoc} |
|
147
|
|
|
* |
|
148
|
|
|
* @api |
|
149
|
|
|
* |
|
150
|
|
|
* @param \Generated\Shared\Transfer\RefundTransfer $refundTransfer |
|
151
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
152
|
|
|
* @param array<int> $salesOrderItemIds |
|
153
|
|
|
* |
|
154
|
|
|
* @return void |
|
155
|
|
|
*/ |
|
156
|
|
|
public function executeRefundOmsCommand( |
|
157
|
|
|
RefundTransfer $refundTransfer, |
|
158
|
|
|
OrderTransfer $orderTransfer, |
|
159
|
|
|
array $salesOrderItemIds |
|
160
|
|
|
): void { |
|
161
|
|
|
$this->getFactory() |
|
162
|
|
|
->createRefundOmsCommand() |
|
163
|
|
|
->execute($refundTransfer, $orderTransfer, $salesOrderItemIds); |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* {@inheritDoc} |
|
168
|
|
|
* |
|
169
|
|
|
* @api |
|
170
|
|
|
* |
|
171
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
172
|
|
|
* @param array<int> $salesOrderItemIds |
|
173
|
|
|
* |
|
174
|
|
|
* @return void |
|
175
|
|
|
*/ |
|
176
|
|
|
public function executeFinishOmsCommand(OrderTransfer $orderTransfer, array $salesOrderItemIds): void |
|
177
|
|
|
{ |
|
178
|
|
|
$this->getFactory() |
|
179
|
|
|
->createFinishOmsCommand() |
|
180
|
|
|
->execute($orderTransfer, $salesOrderItemIds); |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* {@inheritDoc} |
|
185
|
|
|
* |
|
186
|
|
|
* @api |
|
187
|
|
|
* |
|
188
|
|
|
* @param int $idSalesOrderItem |
|
189
|
|
|
* |
|
190
|
|
|
* @return bool |
|
191
|
|
|
*/ |
|
192
|
|
|
public function checkIsReserveCallSuccessfulOmsCondition(int $idSalesOrderItem): bool |
|
193
|
|
|
{ |
|
194
|
|
|
return $this->getFactory() |
|
195
|
|
|
->createIsReserveCallSuccessfulOmsCondition() |
|
196
|
|
|
->check($idSalesOrderItem); |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* {@inheritDoc} |
|
201
|
|
|
* |
|
202
|
|
|
* @api |
|
203
|
|
|
* |
|
204
|
|
|
* @param int $idSalesOrderItem |
|
205
|
|
|
* |
|
206
|
|
|
* @return bool |
|
207
|
|
|
*/ |
|
208
|
|
|
public function checkIsAcknowledgePendingReceivedOmsCondition(int $idSalesOrderItem): bool |
|
209
|
|
|
{ |
|
210
|
|
|
return $this->getFactory() |
|
211
|
|
|
->createIsAcknowledgePendingReceivedOmsCondition() |
|
212
|
|
|
->check($idSalesOrderItem); |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
/** |
|
216
|
|
|
* {@inheritDoc} |
|
217
|
|
|
* |
|
218
|
|
|
* @api |
|
219
|
|
|
* |
|
220
|
|
|
* @param int $idSalesOrderItem |
|
221
|
|
|
* |
|
222
|
|
|
* @return bool |
|
223
|
|
|
*/ |
|
224
|
|
|
public function checkIsMerchantPendingReceivedOmsCondition(int $idSalesOrderItem): bool |
|
225
|
|
|
{ |
|
226
|
|
|
return $this->getFactory() |
|
227
|
|
|
->createIsMerchantPendingReceivedOmsCondition() |
|
228
|
|
|
->check($idSalesOrderItem); |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
/** |
|
232
|
|
|
* {@inheritDoc} |
|
233
|
|
|
* |
|
234
|
|
|
* @api |
|
235
|
|
|
* |
|
236
|
|
|
* @param int $idSalesOrderItem |
|
237
|
|
|
* |
|
238
|
|
|
* @return bool |
|
239
|
|
|
*/ |
|
240
|
|
|
public function checkIsCiaPendingReceivedOmsCondition(int $idSalesOrderItem): bool |
|
241
|
|
|
{ |
|
242
|
|
|
return $this->getFactory() |
|
243
|
|
|
->createIsCiaPendingReceivedOmsCondition() |
|
244
|
|
|
->check($idSalesOrderItem); |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* {@inheritDoc} |
|
249
|
|
|
* |
|
250
|
|
|
* @api |
|
251
|
|
|
* |
|
252
|
|
|
* @param int $idSalesOrderItem |
|
253
|
|
|
* |
|
254
|
|
|
* @return bool |
|
255
|
|
|
*/ |
|
256
|
|
|
public function checkIsCancelCallSuccessfulOmsCondition(int $idSalesOrderItem): bool |
|
257
|
|
|
{ |
|
258
|
|
|
return $this->getFactory() |
|
259
|
|
|
->createIsCancelCallSuccessfulOmsCondition() |
|
260
|
|
|
->check($idSalesOrderItem); |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
/** |
|
264
|
|
|
* {@inheritDoc} |
|
265
|
|
|
* |
|
266
|
|
|
* @api |
|
267
|
|
|
* |
|
268
|
|
|
* @param int $idSalesOrderItem |
|
269
|
|
|
* |
|
270
|
|
|
* @return bool |
|
271
|
|
|
*/ |
|
272
|
|
|
public function checkIsCanceledReceivedOmsCondition(int $idSalesOrderItem): bool |
|
273
|
|
|
{ |
|
274
|
|
|
return $this->getFactory() |
|
275
|
|
|
->createIsCanceledReceivedOmsCondition() |
|
276
|
|
|
->check($idSalesOrderItem); |
|
277
|
|
|
} |
|
278
|
|
|
|
|
279
|
|
|
/** |
|
280
|
|
|
* {@inheritDoc} |
|
281
|
|
|
* |
|
282
|
|
|
* @api |
|
283
|
|
|
* |
|
284
|
|
|
* @param int $idSalesOrderItem |
|
285
|
|
|
* |
|
286
|
|
|
* @return bool |
|
287
|
|
|
*/ |
|
288
|
|
|
public function checkIsExpiredReceivedOmsCondition(int $idSalesOrderItem): bool |
|
289
|
|
|
{ |
|
290
|
|
|
return $this->getFactory() |
|
291
|
|
|
->createIsExpiredReceivedOmsCondition() |
|
292
|
|
|
->check($idSalesOrderItem); |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
/** |
|
296
|
|
|
* {@inheritDoc} |
|
297
|
|
|
* |
|
298
|
|
|
* @api |
|
299
|
|
|
* |
|
300
|
|
|
* @param int $idSalesOrderItem |
|
301
|
|
|
* |
|
302
|
|
|
* @return bool |
|
303
|
|
|
*/ |
|
304
|
|
|
public function checkIsCaptureCallSuccessfulOmsCondition(int $idSalesOrderItem): bool |
|
305
|
|
|
{ |
|
306
|
|
|
return $this->getFactory() |
|
307
|
|
|
->createIsCaptureCallSuccessfulOmsCondition() |
|
308
|
|
|
->check($idSalesOrderItem); |
|
309
|
|
|
} |
|
310
|
|
|
|
|
311
|
|
|
/** |
|
312
|
|
|
* {@inheritDoc} |
|
313
|
|
|
* |
|
314
|
|
|
* @api |
|
315
|
|
|
* |
|
316
|
|
|
* @param int $idSalesOrderItem |
|
317
|
|
|
* |
|
318
|
|
|
* @return bool |
|
319
|
|
|
*/ |
|
320
|
|
|
public function checkIsPaidReceivedOmsCondition(int $idSalesOrderItem): bool |
|
321
|
|
|
{ |
|
322
|
|
|
return $this->getFactory() |
|
323
|
|
|
->createIsPaidReceivedOmsCondition() |
|
324
|
|
|
->check($idSalesOrderItem); |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
/** |
|
328
|
|
|
* {@inheritDoc} |
|
329
|
|
|
* |
|
330
|
|
|
* @api |
|
331
|
|
|
* |
|
332
|
|
|
* @param int $idSalesOrderItem |
|
333
|
|
|
* |
|
334
|
|
|
* @return bool |
|
335
|
|
|
*/ |
|
336
|
|
|
public function checkIsFinishCallSuccessfulOmsCondition(int $idSalesOrderItem): bool |
|
337
|
|
|
{ |
|
338
|
|
|
return $this->getFactory() |
|
339
|
|
|
->createIsFinishCallSuccessfulOmsCondition() |
|
340
|
|
|
->check($idSalesOrderItem); |
|
341
|
|
|
} |
|
342
|
|
|
|
|
343
|
|
|
/** |
|
344
|
|
|
* {@inheritDoc} |
|
345
|
|
|
* |
|
346
|
|
|
* @api |
|
347
|
|
|
* |
|
348
|
|
|
* @param int $idSalesOrderItem |
|
349
|
|
|
* |
|
350
|
|
|
* @return bool |
|
351
|
|
|
*/ |
|
352
|
|
|
public function checkIsRefundCallSuccessfulOmsCondition(int $idSalesOrderItem): bool |
|
353
|
|
|
{ |
|
354
|
|
|
return $this->getFactory() |
|
355
|
|
|
->createIsRefundCallSuccessfulOmsCondition() |
|
356
|
|
|
->check($idSalesOrderItem); |
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
/** |
|
360
|
|
|
* {@inheritDoc} |
|
361
|
|
|
* |
|
362
|
|
|
* @api |
|
363
|
|
|
* |
|
364
|
|
|
* @param int $idSalesOrderItem |
|
365
|
|
|
* |
|
366
|
|
|
* @return bool |
|
367
|
|
|
*/ |
|
368
|
|
|
public function checkIsChargeBackReceivedOmsCondition(int $idSalesOrderItem): bool |
|
369
|
|
|
{ |
|
370
|
|
|
return $this->getFactory() |
|
371
|
|
|
->createIsChargeBackReceivedOmsCondition() |
|
372
|
|
|
->check($idSalesOrderItem); |
|
373
|
|
|
} |
|
374
|
|
|
|
|
375
|
|
|
/** |
|
376
|
|
|
* {@inheritDoc} |
|
377
|
|
|
* |
|
378
|
|
|
* @api |
|
379
|
|
|
* |
|
380
|
|
|
* @param int $idSalesOrderItem |
|
381
|
|
|
* |
|
382
|
|
|
* @return bool |
|
383
|
|
|
*/ |
|
384
|
|
|
public function checkIsDoneReceivedOmsCondition(int $idSalesOrderItem): bool |
|
385
|
|
|
{ |
|
386
|
|
|
return $this->getFactory() |
|
387
|
|
|
->createIsDoneReceivedOmsCondition() |
|
388
|
|
|
->check($idSalesOrderItem); |
|
389
|
|
|
} |
|
390
|
|
|
} |
|
391
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths