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\Computop; |
9
|
|
|
|
10
|
|
|
use Spryker\Zed\Kernel\AbstractBundleConfig; |
11
|
|
|
use SprykerEco\Shared\Computop\ComputopConfig as SharedComputopConfig; |
12
|
|
|
use SprykerEco\Shared\Computop\ComputopConstants; |
13
|
|
|
use SprykerEco\Shared\ComputopApi\ComputopApiConstants; |
14
|
|
|
|
15
|
|
|
class ComputopConfig extends AbstractBundleConfig |
16
|
|
|
{ |
17
|
|
|
public const OMS_STATUS_NEW = 'new'; |
18
|
|
|
public const OMS_STATUS_INITIALIZED = 'init'; |
19
|
|
|
public const OMS_STATUS_AUTHORIZED = 'authorized'; |
20
|
|
|
public const OMS_STATUS_AUTHORIZATION_FAILED = 'authorization failed'; |
21
|
|
|
public const OMS_STATUS_CAPTURED = 'captured'; |
22
|
|
|
public const OMS_STATUS_CAPTURING_FAILED = 'capture failed'; |
23
|
|
|
public const OMS_STATUS_CANCELLED = 'cancelled'; |
24
|
|
|
public const OMS_STATUS_REFUNDED = 'refunded'; |
25
|
|
|
|
26
|
|
|
public const AUTHORIZE_METHOD = 'AUTHORIZE'; |
27
|
|
|
public const CAPTURE_METHOD = 'CAPTURE'; |
28
|
|
|
public const REVERSE_METHOD = 'REVERSE'; |
29
|
|
|
public const INQUIRE_METHOD = 'INQUIRE'; |
30
|
|
|
public const REFUND_METHOD = 'REFUND'; |
31
|
|
|
|
32
|
|
|
//Events |
33
|
|
|
public const COMPUTOP_OMS_EVENT_CAPTURE = 'capture'; |
34
|
|
|
public const COMPUTOP_OMS_EVENT_AUTHORIZE = 'authorize'; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Refund with shipment price |
38
|
|
|
*/ |
39
|
|
|
public const COMPUTOP_REFUND_SHIPMENT_PRICE_ENABLED = true; |
40
|
|
|
|
41
|
|
|
protected const OMS_STATUS_AUTHORIZE_REQUEST = 'authorize request'; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @api |
45
|
|
|
* |
46
|
|
|
* @return string |
47
|
|
|
*/ |
48
|
|
|
public function getMerchantId() |
49
|
|
|
{ |
50
|
|
|
return $this->get(ComputopApiConstants::MERCHANT_ID); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @api |
55
|
|
|
* |
56
|
|
|
* @return string |
57
|
|
|
*/ |
58
|
|
|
public function getBlowfishPass() |
59
|
|
|
{ |
60
|
|
|
return $this->get(ComputopApiConstants::BLOWFISH_PASSWORD); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @api |
65
|
|
|
* |
66
|
|
|
* @return string |
67
|
|
|
*/ |
68
|
|
|
public function getAuthorizeAction() |
69
|
|
|
{ |
70
|
|
|
return $this->get(ComputopConstants::AUTHORIZE_ACTION); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @api |
75
|
|
|
* |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
|
|
public function getCaptureAction() |
79
|
|
|
{ |
80
|
|
|
return $this->get(ComputopConstants::CAPTURE_ACTION); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @api |
85
|
|
|
* |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
|
|
public function getRefundAction() |
89
|
|
|
{ |
90
|
|
|
return $this->get(ComputopConstants::REFUND_ACTION); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @api |
95
|
|
|
* |
96
|
|
|
* @return string |
97
|
|
|
*/ |
98
|
|
|
public function getInquireAction() |
99
|
|
|
{ |
100
|
|
|
return $this->get(ComputopConstants::INQUIRE_ACTION); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @api |
105
|
|
|
* |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
|
|
public function getReverseAction() |
109
|
|
|
{ |
110
|
|
|
return $this->get(ComputopConstants::REVERSE_ACTION); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @api |
115
|
|
|
* |
116
|
|
|
* @return string |
117
|
|
|
*/ |
118
|
|
|
public function getIdealInitAction() |
119
|
|
|
{ |
120
|
|
|
return $this->get(ComputopConstants::IDEAL_INIT_ACTION); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @api |
125
|
|
|
* |
126
|
|
|
* @return string |
127
|
|
|
*/ |
128
|
|
|
public function getPaydirektInitAction() |
129
|
|
|
{ |
130
|
|
|
return $this->get(ComputopConstants::PAYDIREKT_INIT_ACTION); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @api |
135
|
|
|
* |
136
|
|
|
* @return string |
137
|
|
|
*/ |
138
|
|
|
public function getPayuCeeSingleInitAction(): string |
139
|
|
|
{ |
140
|
|
|
return $this->get(ComputopConstants::PAYU_CEE_SINGLE_INIT_ACTION); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @api |
145
|
|
|
* |
146
|
|
|
* @return string |
147
|
|
|
*/ |
148
|
|
|
public function getSofortInitAction() |
149
|
|
|
{ |
150
|
|
|
return $this->get(ComputopConstants::SOFORT_INIT_ACTION); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @api |
155
|
|
|
* |
156
|
|
|
* @return string |
157
|
|
|
*/ |
158
|
|
|
public function getEasyCreditStatusUrl() |
159
|
|
|
{ |
160
|
|
|
return $this->get(ComputopConstants::EASY_CREDIT_STATUS_ACTION); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @api |
165
|
|
|
* |
166
|
|
|
* @return string |
167
|
|
|
*/ |
168
|
|
|
public function getEasyCreditAuthorizeUrl() |
169
|
|
|
{ |
170
|
|
|
return $this->get(ComputopConstants::EASY_CREDIT_AUTHORIZE_ACTION); |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @api |
175
|
|
|
* |
176
|
|
|
* @return string |
177
|
|
|
*/ |
178
|
|
|
public function getPayNowInitActionUrl() |
179
|
|
|
{ |
180
|
|
|
return $this->get(ComputopConstants::PAY_NOW_INIT_ACTION); |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @api |
185
|
|
|
* |
186
|
|
|
* @return bool |
187
|
|
|
*/ |
188
|
|
|
public function isRefundShipmentPriceEnabled() |
189
|
|
|
{ |
190
|
|
|
return static::COMPUTOP_REFUND_SHIPMENT_PRICE_ENABLED; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @api |
195
|
|
|
* |
196
|
|
|
* @return array |
197
|
|
|
*/ |
198
|
|
|
public function getBeforeInitStatuses(): array |
199
|
|
|
{ |
200
|
|
|
return [ |
201
|
|
|
$this->getOmsStatusNew(), |
202
|
|
|
]; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* @api |
207
|
|
|
* |
208
|
|
|
* @return array |
209
|
|
|
*/ |
210
|
|
|
public function getBeforeAuthorizeStatuses(): array |
211
|
|
|
{ |
212
|
|
|
return [ |
213
|
|
|
$this->getOmsStatusNew(), |
214
|
|
|
$this->getOmsStatusInitialized(), |
215
|
|
|
$this->getAuthorizeRequestOmsStatus(), |
216
|
|
|
$this->getOmsStatusAuthorizationFailed(), |
217
|
|
|
]; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @api |
222
|
|
|
* |
223
|
|
|
* @return array |
224
|
|
|
*/ |
225
|
|
|
public function getBeforeCaptureStatuses(): array |
226
|
|
|
{ |
227
|
|
|
$statusesBeforeAuthorize = $this->getBeforeAuthorizeStatuses(); |
228
|
|
|
$statusesBeforeAuthorize[] = $this->getOmsStatusAuthorized(); |
229
|
|
|
$statusesBeforeAuthorize[] = $this->getOmsStatusCancelled(); |
230
|
|
|
|
231
|
|
|
return $statusesBeforeAuthorize; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* @api |
236
|
|
|
* |
237
|
|
|
* @return array |
238
|
|
|
*/ |
239
|
|
|
public function getBeforeRefundStatuses(): array |
240
|
|
|
{ |
241
|
|
|
$statusesBeforeCaptured = $this->getBeforeCaptureStatuses(); |
242
|
|
|
$statusesBeforeCaptured[] = $this->getOmsStatusCaptured(); |
243
|
|
|
|
244
|
|
|
return $statusesBeforeCaptured; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* @api |
249
|
|
|
* |
250
|
|
|
* @return string |
251
|
|
|
*/ |
252
|
|
|
public function getOmsStatusNew() |
253
|
|
|
{ |
254
|
|
|
return static::OMS_STATUS_NEW; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* @api |
259
|
|
|
* |
260
|
|
|
* @return string |
261
|
|
|
*/ |
262
|
|
|
public function getOmsStatusInitialized() |
263
|
|
|
{ |
264
|
|
|
return static::OMS_STATUS_INITIALIZED; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* @api |
269
|
|
|
* |
270
|
|
|
* @return string |
271
|
|
|
*/ |
272
|
|
|
public function getOmsStatusAuthorized() |
273
|
|
|
{ |
274
|
|
|
return static::OMS_STATUS_AUTHORIZED; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* @api |
279
|
|
|
* |
280
|
|
|
* @return string |
281
|
|
|
*/ |
282
|
|
|
public function getAuthorizeRequestOmsStatus(): string |
283
|
|
|
{ |
284
|
|
|
return static::OMS_STATUS_AUTHORIZE_REQUEST; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* @api |
289
|
|
|
* |
290
|
|
|
* @return string |
291
|
|
|
*/ |
292
|
|
|
public function getOmsStatusAuthorizationFailed() |
293
|
|
|
{ |
294
|
|
|
return static::OMS_STATUS_AUTHORIZATION_FAILED; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* @api |
299
|
|
|
* |
300
|
|
|
* @return string |
301
|
|
|
*/ |
302
|
|
|
public function getOmsStatusCaptured() |
303
|
|
|
{ |
304
|
|
|
return static::OMS_STATUS_CAPTURED; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* @api |
309
|
|
|
* |
310
|
|
|
* @return string |
311
|
|
|
*/ |
312
|
|
|
public function getOmsStatusCapturingFailed() |
313
|
|
|
{ |
314
|
|
|
return static::OMS_STATUS_CAPTURING_FAILED; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @api |
319
|
|
|
* |
320
|
|
|
* @return string |
321
|
|
|
*/ |
322
|
|
|
public function getOmsStatusCancelled() |
323
|
|
|
{ |
324
|
|
|
return static::OMS_STATUS_CANCELLED; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* @api |
329
|
|
|
* |
330
|
|
|
* @return string |
331
|
|
|
*/ |
332
|
|
|
public function getOmsStatusRefunded() |
333
|
|
|
{ |
334
|
|
|
return static::OMS_STATUS_REFUNDED; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* @api |
339
|
|
|
* |
340
|
|
|
* @return string |
341
|
|
|
*/ |
342
|
|
|
public function getAuthorizeMethodName() |
343
|
|
|
{ |
344
|
|
|
return static::AUTHORIZE_METHOD; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* @api |
349
|
|
|
* |
350
|
|
|
* @return string |
351
|
|
|
*/ |
352
|
|
|
public function getCaptureMethodName() |
353
|
|
|
{ |
354
|
|
|
return static::CAPTURE_METHOD; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* @api |
359
|
|
|
* |
360
|
|
|
* @return string |
361
|
|
|
*/ |
362
|
|
|
public function getRefundMethodName() |
363
|
|
|
{ |
364
|
|
|
return static::REFUND_METHOD; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* @api |
369
|
|
|
* |
370
|
|
|
* @return string |
371
|
|
|
*/ |
372
|
|
|
public function getReverseMethodName() |
373
|
|
|
{ |
374
|
|
|
return static::REVERSE_METHOD; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* @api |
379
|
|
|
* |
380
|
|
|
* @return string |
381
|
|
|
*/ |
382
|
|
|
public function getInquireMethodName() |
383
|
|
|
{ |
384
|
|
|
return static::INQUIRE_METHOD; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* @api |
389
|
|
|
* |
390
|
|
|
* @return string |
391
|
|
|
*/ |
392
|
|
|
public function getOmsAuthorizeEventName() |
393
|
|
|
{ |
394
|
|
|
return static::COMPUTOP_OMS_EVENT_AUTHORIZE; |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* @api |
399
|
|
|
* |
400
|
|
|
* @return string |
401
|
|
|
*/ |
402
|
|
|
public function getOmsCaptureEventName() |
403
|
|
|
{ |
404
|
|
|
return static::COMPUTOP_OMS_EVENT_CAPTURE; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* @api |
409
|
|
|
* |
410
|
|
|
* @return string[] |
411
|
|
|
*/ |
412
|
|
|
public function getCrifGreenPaymentMethods(): array |
413
|
|
|
{ |
414
|
|
|
return $this->get(ComputopConstants::CRIF_GREEN_AVAILABLE_PAYMENT_METHODS); |
415
|
|
|
} |
416
|
|
|
|
417
|
|
|
/** |
418
|
|
|
* @api |
419
|
|
|
* |
420
|
|
|
* @return string[] |
421
|
|
|
*/ |
422
|
|
|
public function getCrifYellowPaymentMethods(): array |
423
|
|
|
{ |
424
|
|
|
return $this->get(ComputopConstants::CRIF_YELLOW_AVAILABLE_PAYMENT_METHODS); |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
/** |
428
|
|
|
* @api |
429
|
|
|
* |
430
|
|
|
* @return string[] |
431
|
|
|
*/ |
432
|
|
|
public function getCrifRedPaymentMethods(): array |
433
|
|
|
{ |
434
|
|
|
return $this->get(ComputopConstants::CRIF_RED_AVAILABLE_PAYMENT_METHODS); |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* @api |
439
|
|
|
* |
440
|
|
|
* @return bool |
441
|
|
|
*/ |
442
|
|
|
public function isCrifEnabled(): bool |
443
|
|
|
{ |
444
|
|
|
return (bool)$this->get(ComputopConstants::CRIF_ENABLED); |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
/** |
448
|
|
|
* @api |
449
|
|
|
* |
450
|
|
|
* @return string |
451
|
|
|
*/ |
452
|
|
|
public function getEtiId(): string |
453
|
|
|
{ |
454
|
|
|
return SharedComputopConfig::COMPUTOP_MODULE_VERSION; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* @api |
459
|
|
|
* |
460
|
|
|
* @return string |
461
|
|
|
*/ |
462
|
|
|
public function getIdealIssuerId(): string |
463
|
|
|
{ |
464
|
|
|
return $this->get(ComputopConstants::IDEAL_ISSUER_ID); |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* Specification: |
469
|
|
|
* - Get Available currency for specific payment methods. |
470
|
|
|
* |
471
|
|
|
* @api |
472
|
|
|
* |
473
|
|
|
* @return array |
474
|
|
|
*/ |
475
|
|
|
public function getComputopPaymentMethodCurrencyFilterMap(): array |
476
|
|
|
{ |
477
|
|
|
return [ |
478
|
|
|
SharedComputopConfig::PAYMENT_METHOD_PAYU_CEE_SINGLE => [ |
479
|
|
|
'PLN', |
480
|
|
|
'CZK', |
481
|
|
|
], |
482
|
|
|
]; |
483
|
|
|
} |
484
|
|
|
} |
485
|
|
|
|