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