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