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