|
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; |
|
9
|
|
|
|
|
10
|
|
|
use Spryker\Zed\Kernel\AbstractBundleConfig; |
|
11
|
|
|
use SprykerEco\Shared\CrefoPay\CrefoPayConstants; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @method \SprykerEco\Shared\CrefoPay\CrefoPayConfig getSharedConfig() |
|
15
|
|
|
*/ |
|
16
|
|
|
class CrefoPayConfig extends AbstractBundleConfig |
|
17
|
|
|
{ |
|
18
|
|
|
protected const NOTIFICATION_TRANSACTION_STATUS_ACKNOWLEDGE_PENDING = 'ACKNOWLEDGEPENDING'; |
|
19
|
|
|
protected const NOTIFICATION_TRANSACTION_STATUS_FRAUD_PENDING = 'FRAUDPENDING'; |
|
20
|
|
|
protected const NOTIFICATION_TRANSACTION_STATUS_FRAUD_CANCELLED = 'FRAUDCANCELLED'; |
|
21
|
|
|
protected const NOTIFICATION_TRANSACTION_STATUS_CIA_PENDING = 'CIAPENDING'; |
|
22
|
|
|
protected const NOTIFICATION_TRANSACTION_STATUS_MERCHANT_PENDING = 'MERCHANTPENDING'; |
|
23
|
|
|
protected const NOTIFICATION_TRANSACTION_STATUS_CANCELLED = 'CANCELLED'; |
|
24
|
|
|
protected const NOTIFICATION_TRANSACTION_STATUS_EXPIRED = 'EXPIRED'; |
|
25
|
|
|
protected const NOTIFICATION_TRANSACTION_STATUS_IN_PROGRESS = 'INPROGRESS'; |
|
26
|
|
|
protected const NOTIFICATION_TRANSACTION_STATUS_DONE = 'DONE'; |
|
27
|
|
|
|
|
28
|
|
|
protected const NOTIFICATION_ORDER_STATUS_PAY_PENDING = 'PAYPENDING'; |
|
29
|
|
|
protected const NOTIFICATION_ORDER_STATUS_PAID = 'PAID'; |
|
30
|
|
|
protected const NOTIFICATION_ORDER_STATUS_CLEARED = 'CLEARED'; |
|
31
|
|
|
protected const NOTIFICATION_ORDER_STATUS_PAYMENT_FAILED = 'PAYMENTFAILED'; |
|
32
|
|
|
protected const NOTIFICATION_ORDER_STATUS_CHARGE_BACK = 'CHARGEBACK'; |
|
33
|
|
|
protected const NOTIFICATION_ORDER_STATUS_IN_DUNNING = 'INDUNNING'; |
|
34
|
|
|
protected const NOTIFICATION_ORDER_STATUS_IN_COLLECTION = 'IN_COLLECTION'; |
|
35
|
|
|
|
|
36
|
|
|
protected const OMS_STATUS_NEW = 'new'; |
|
37
|
|
|
protected const OMS_STATUS_RESERVED = 'reserved'; |
|
38
|
|
|
protected const OMS_STATUS_AUTHORIZED = 'authorized'; |
|
39
|
|
|
protected const OMS_STATUS_WAITING_FOR_CAPTURE = 'waiting for capture'; |
|
40
|
|
|
protected const OMS_STATUS_WAITING_FOR_CASH = 'waiting for cash'; |
|
41
|
|
|
protected const OMS_STATUS_CAPTURE_PENDING = 'capture pending'; |
|
42
|
|
|
protected const OMS_STATUS_CAPTURED = 'captured'; |
|
43
|
|
|
protected const OMS_STATUS_CANCELLATION_PENDING = 'cancellation pending'; |
|
44
|
|
|
protected const OMS_STATUS_CANCELED = 'canceled'; |
|
45
|
|
|
protected const OMS_STATUS_REFUNDED = 'refunded'; |
|
46
|
|
|
protected const OMS_STATUS_MONEY_REDUCED = 'money reduced'; |
|
47
|
|
|
protected const OMS_STATUS_EXPIRED = 'expired'; |
|
48
|
|
|
protected const OMS_STATUS_DONE = 'done'; |
|
49
|
|
|
|
|
50
|
|
|
protected const OMS_EVENT_CANCEL = 'cancel'; |
|
51
|
|
|
protected const OMS_EVENT_NO_CANCELLATION = 'no cancellation'; |
|
52
|
|
|
protected const OMS_EVENT_FINISH = 'finish'; |
|
53
|
|
|
|
|
54
|
|
|
protected const CREFO_PAY_API_CAPTURE_ID_LENGTH = 30; |
|
55
|
|
|
|
|
56
|
|
|
protected const CREFO_PAY_AUTOMATIC_OMS_TRIGGER = 'CREFO_PAY_AUTOMATIC_OMS_TRIGGER'; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @return int |
|
60
|
|
|
*/ |
|
61
|
|
|
public function getMerchantId(): int |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->get(CrefoPayConstants::MERCHANT_ID); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return string |
|
68
|
|
|
*/ |
|
69
|
|
|
public function getStoreId(): string |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->get(CrefoPayConstants::STORE_ID); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return string |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getRefundDescription(): string |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->get(CrefoPayConstants::REFUND_DESCRIPTION); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @return string |
|
84
|
|
|
*/ |
|
85
|
|
|
public function getProviderName(): string |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->getSharedConfig()->getProviderName(); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return int |
|
92
|
|
|
*/ |
|
93
|
|
|
public function getUserRiskClass(): int |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->getSharedConfig()->getUserRiskClass(); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return string |
|
100
|
|
|
*/ |
|
101
|
|
|
public function getProductTypeDefault(): string |
|
102
|
|
|
{ |
|
103
|
|
|
return $this->getSharedConfig()->getProductTypeDefault(); |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @return string |
|
108
|
|
|
*/ |
|
109
|
|
|
public function getProductTypeShippingCosts(): string |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->getSharedConfig()->getProductTypeShippingCosts(); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @return int |
|
116
|
|
|
*/ |
|
117
|
|
|
public function getProductRiskClass(): int |
|
118
|
|
|
{ |
|
119
|
|
|
return $this->getSharedConfig()->getProductRiskClass(); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @return string[] |
|
124
|
|
|
*/ |
|
125
|
|
|
public function getInternalToExternalPaymentMethodNamesMapping(): array |
|
126
|
|
|
{ |
|
127
|
|
|
return [ |
|
128
|
|
|
$this->getSharedConfig()->getCrefoPayPaymentMethodBill() => $this->getSharedConfig()->getExternalPaymentMethodBill(), |
|
129
|
|
|
$this->getSharedConfig()->getCrefoPayPaymentMethodCashOnDelivery() => $this->getSharedConfig()->getExternalPaymentMethodCashOnDelivery(), |
|
130
|
|
|
$this->getSharedConfig()->getCrefoPayPaymentMethodDirectDebit() => $this->getSharedConfig()->getExternalPaymentMethodDirectDebit(), |
|
131
|
|
|
$this->getSharedConfig()->getCrefoPayPaymentMethodPayPal() => $this->getSharedConfig()->getExternalPaymentMethodPayPal(), |
|
132
|
|
|
$this->getSharedConfig()->getCrefoPayPaymentMethodPrepaid() => $this->getSharedConfig()->getExternalPaymentMethodPrepaid(), |
|
133
|
|
|
$this->getSharedConfig()->getCrefoPayPaymentMethodSofort() => $this->getSharedConfig()->getExternalPaymentMethodSofort(), |
|
134
|
|
|
$this->getSharedConfig()->getCrefoPayPaymentMethodCreditCard() => $this->getSharedConfig()->getExternalPaymentMethodCreditCard(), |
|
135
|
|
|
$this->getSharedConfig()->getCrefoPayPaymentMethodCreditCard3D() => $this->getSharedConfig()->getExternalPaymentMethodCreditCard3D(), |
|
136
|
|
|
]; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @return string |
|
141
|
|
|
*/ |
|
142
|
|
|
public function getNotificationTransactionStatusAcknowledgePending(): string |
|
143
|
|
|
{ |
|
144
|
|
|
return static::NOTIFICATION_TRANSACTION_STATUS_ACKNOWLEDGE_PENDING; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @return string |
|
149
|
|
|
*/ |
|
150
|
|
|
public function getNotificationTransactionStatusMerchantPending(): string |
|
151
|
|
|
{ |
|
152
|
|
|
return static::NOTIFICATION_TRANSACTION_STATUS_MERCHANT_PENDING; |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* @return string |
|
157
|
|
|
*/ |
|
158
|
|
|
public function getNotificationTransactionStatusCiaPending(): string |
|
159
|
|
|
{ |
|
160
|
|
|
return static::NOTIFICATION_TRANSACTION_STATUS_CIA_PENDING; |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* @return string |
|
165
|
|
|
*/ |
|
166
|
|
|
public function getNotificationTransactionStatusCancelled(): string |
|
167
|
|
|
{ |
|
168
|
|
|
return static::NOTIFICATION_TRANSACTION_STATUS_CANCELLED; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* @return string |
|
173
|
|
|
*/ |
|
174
|
|
|
public function getNotificationTransactionStatusExpired(): string |
|
175
|
|
|
{ |
|
176
|
|
|
return static::NOTIFICATION_TRANSACTION_STATUS_EXPIRED; |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
/** |
|
180
|
|
|
* @return string |
|
181
|
|
|
*/ |
|
182
|
|
|
public function getNotificationTransactionStatusDone(): string |
|
183
|
|
|
{ |
|
184
|
|
|
return static::NOTIFICATION_TRANSACTION_STATUS_DONE; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* @return string |
|
189
|
|
|
*/ |
|
190
|
|
|
public function getNotificationOrderStatusPayPending(): string |
|
191
|
|
|
{ |
|
192
|
|
|
return static::NOTIFICATION_ORDER_STATUS_PAY_PENDING; |
|
193
|
|
|
} |
|
194
|
|
|
|
|
195
|
|
|
/** |
|
196
|
|
|
* @return string |
|
197
|
|
|
*/ |
|
198
|
|
|
public function getNotificationOrderStatusPaid(): string |
|
199
|
|
|
{ |
|
200
|
|
|
return static::NOTIFICATION_ORDER_STATUS_PAID; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
/** |
|
204
|
|
|
* @return string |
|
205
|
|
|
*/ |
|
206
|
|
|
public function getNotificationOrderStatusChargeBack(): string |
|
207
|
|
|
{ |
|
208
|
|
|
return static::NOTIFICATION_ORDER_STATUS_CHARGE_BACK; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* @return string |
|
213
|
|
|
*/ |
|
214
|
|
|
public function getOmsStatusNew(): string |
|
215
|
|
|
{ |
|
216
|
|
|
return static::OMS_STATUS_NEW; |
|
217
|
|
|
} |
|
218
|
|
|
|
|
219
|
|
|
/** |
|
220
|
|
|
* @return string |
|
221
|
|
|
*/ |
|
222
|
|
|
public function getOmsStatusReserved(): string |
|
223
|
|
|
{ |
|
224
|
|
|
return static::OMS_STATUS_RESERVED; |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* @return string |
|
229
|
|
|
*/ |
|
230
|
|
|
public function getOmsStatusAuthorized(): string |
|
231
|
|
|
{ |
|
232
|
|
|
return static::OMS_STATUS_AUTHORIZED; |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
|
|
/** |
|
236
|
|
|
* @return string |
|
237
|
|
|
*/ |
|
238
|
|
|
public function getOmsStatusWaitingForCapture(): string |
|
239
|
|
|
{ |
|
240
|
|
|
return static::OMS_STATUS_WAITING_FOR_CAPTURE; |
|
241
|
|
|
} |
|
242
|
|
|
|
|
243
|
|
|
/** |
|
244
|
|
|
* @return string |
|
245
|
|
|
*/ |
|
246
|
|
|
public function getOmsStatusWaitingForCash(): string |
|
247
|
|
|
{ |
|
248
|
|
|
return static::OMS_STATUS_WAITING_FOR_CASH; |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
/** |
|
252
|
|
|
* @return string |
|
253
|
|
|
*/ |
|
254
|
|
|
public function getOmsStatusCapturePending(): string |
|
255
|
|
|
{ |
|
256
|
|
|
return static::OMS_STATUS_CAPTURE_PENDING; |
|
257
|
|
|
} |
|
258
|
|
|
|
|
259
|
|
|
/** |
|
260
|
|
|
* @return string |
|
261
|
|
|
*/ |
|
262
|
|
|
public function getOmsStatusCaptured(): string |
|
263
|
|
|
{ |
|
264
|
|
|
return static::OMS_STATUS_CAPTURED; |
|
265
|
|
|
} |
|
266
|
|
|
|
|
267
|
|
|
/** |
|
268
|
|
|
* @return string |
|
269
|
|
|
*/ |
|
270
|
|
|
public function getOmsStatusCancellationPending(): string |
|
271
|
|
|
{ |
|
272
|
|
|
return static::OMS_STATUS_CANCELLATION_PENDING; |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
/** |
|
276
|
|
|
* @return string |
|
277
|
|
|
*/ |
|
278
|
|
|
public function getOmsStatusCanceled(): string |
|
279
|
|
|
{ |
|
280
|
|
|
return static::OMS_STATUS_CANCELED; |
|
281
|
|
|
} |
|
282
|
|
|
|
|
283
|
|
|
/** |
|
284
|
|
|
* @return string |
|
285
|
|
|
*/ |
|
286
|
|
|
public function getOmsStatusRefunded(): string |
|
287
|
|
|
{ |
|
288
|
|
|
return static::OMS_STATUS_REFUNDED; |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* @return string |
|
293
|
|
|
*/ |
|
294
|
|
|
public function getOmsStatusMoneyReduced(): string |
|
295
|
|
|
{ |
|
296
|
|
|
return static::OMS_STATUS_MONEY_REDUCED; |
|
297
|
|
|
} |
|
298
|
|
|
|
|
299
|
|
|
/** |
|
300
|
|
|
* @return string |
|
301
|
|
|
*/ |
|
302
|
|
|
public function getOmsStatusExpired(): string |
|
303
|
|
|
{ |
|
304
|
|
|
return static::OMS_STATUS_EXPIRED; |
|
305
|
|
|
} |
|
306
|
|
|
|
|
307
|
|
|
/** |
|
308
|
|
|
* @return string |
|
309
|
|
|
*/ |
|
310
|
|
|
public function getOmsStatusDone(): string |
|
311
|
|
|
{ |
|
312
|
|
|
return static::OMS_STATUS_DONE; |
|
313
|
|
|
} |
|
314
|
|
|
|
|
315
|
|
|
/** |
|
316
|
|
|
* @return string |
|
317
|
|
|
*/ |
|
318
|
|
|
public function getOmsEventCancel(): string |
|
319
|
|
|
{ |
|
320
|
|
|
return static::OMS_EVENT_CANCEL; |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
/** |
|
324
|
|
|
* @return string |
|
325
|
|
|
*/ |
|
326
|
|
|
public function getOmsEventNoCancellation(): string |
|
327
|
|
|
{ |
|
328
|
|
|
return static::OMS_EVENT_NO_CANCELLATION; |
|
329
|
|
|
} |
|
330
|
|
|
|
|
331
|
|
|
/** |
|
332
|
|
|
* @return string |
|
333
|
|
|
*/ |
|
334
|
|
|
public function getOmsEventFinish(): string |
|
335
|
|
|
{ |
|
336
|
|
|
return static::OMS_EVENT_FINISH; |
|
337
|
|
|
} |
|
338
|
|
|
|
|
339
|
|
|
/** |
|
340
|
|
|
* @return string[] |
|
341
|
|
|
*/ |
|
342
|
|
|
public function getNotificationTransactionToOmsStatusMapping(): array |
|
343
|
|
|
{ |
|
344
|
|
|
return [ |
|
345
|
|
|
$this->getNotificationTransactionStatusAcknowledgePending() => $this->getOmsStatusAuthorized(), |
|
346
|
|
|
$this->getNotificationTransactionStatusMerchantPending() => $this->getOmsStatusWaitingForCapture(), |
|
347
|
|
|
$this->getNotificationTransactionStatusCiaPending() => $this->getOmsStatusWaitingForCash(), |
|
348
|
|
|
$this->getNotificationTransactionStatusCancelled() => $this->getOmsStatusCanceled(), |
|
349
|
|
|
$this->getNotificationTransactionStatusExpired() => $this->getOmsStatusExpired(), |
|
350
|
|
|
$this->getNotificationTransactionStatusDone() => $this->getOmsStatusDone(), |
|
351
|
|
|
]; |
|
352
|
|
|
} |
|
353
|
|
|
|
|
354
|
|
|
/** |
|
355
|
|
|
* @return string[] |
|
356
|
|
|
*/ |
|
357
|
|
|
public function getNotificationOrderToOmsStatusMapping(): array |
|
358
|
|
|
{ |
|
359
|
|
|
return [ |
|
360
|
|
|
$this->getNotificationOrderStatusPayPending() => $this->getOmsStatusCapturePending(), |
|
361
|
|
|
$this->getNotificationOrderStatusPaid() => $this->getOmsStatusCaptured(), |
|
362
|
|
|
$this->getNotificationOrderStatusChargeBack() => $this->getOmsStatusRefunded(), |
|
363
|
|
|
]; |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
/** |
|
367
|
|
|
* @return int |
|
368
|
|
|
*/ |
|
369
|
|
|
public function getCrefoPayApiCaptureIdLength(): int |
|
370
|
|
|
{ |
|
371
|
|
|
return static::CREFO_PAY_API_CAPTURE_ID_LENGTH; |
|
372
|
|
|
} |
|
373
|
|
|
|
|
374
|
|
|
/** |
|
375
|
|
|
* @return string |
|
376
|
|
|
*/ |
|
377
|
|
|
public function getCrefoPayAutomaticOmsTrigger(): string |
|
378
|
|
|
{ |
|
379
|
|
|
return static::CREFO_PAY_AUTOMATIC_OMS_TRIGGER; |
|
380
|
|
|
} |
|
381
|
|
|
|
|
382
|
|
|
/** |
|
383
|
|
|
* @return bool |
|
384
|
|
|
*/ |
|
385
|
|
|
public function getIsBusinessToBusiness(): bool |
|
386
|
|
|
{ |
|
387
|
|
|
return $this->get(CrefoPayConstants::IS_BUSINESS_TO_BUSINESS); |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
/** |
|
391
|
|
|
* @return bool |
|
392
|
|
|
*/ |
|
393
|
|
|
public function getCaptureExpensesSeparately(): bool |
|
394
|
|
|
{ |
|
395
|
|
|
return $this->get(CrefoPayConstants::CAPTURE_EXPENSES_SEPARATELY); |
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
|
/** |
|
399
|
|
|
* @return bool |
|
400
|
|
|
*/ |
|
401
|
|
|
public function getRefundExpensesWithLastItem(): bool |
|
402
|
|
|
{ |
|
403
|
|
|
return $this->get(CrefoPayConstants::REFUND_EXPENSES_WITH_LAST_ITEM); |
|
404
|
|
|
} |
|
405
|
|
|
} |
|
406
|
|
|
|