Passed
Push — feature/eco-3623-payone-pay-u-... ( 874a59...7427d2 )
by Roman
16:19 queued 08:34
created

getComputopPaymentMethodCurrencyFilterMap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
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 getBeforeCaptureStatuses()
199
    {
200
        return [
201
            $this->getOmsStatusNew(),
202
            $this->getOmsStatusAuthorized(),
203
            $this->getOmsStatusAuthorizationFailed(),
204
            $this->getOmsStatusCancelled(),
205
        ];
206
    }
207
208
    /**
209
     * @api
210
     *
211
     * @return array
212
     */
213
    public function getBeforeRefundStatuses()
214
    {
215
        return [
216
            $this->getOmsStatusNew(),
217
            $this->getOmsStatusAuthorized(),
218
            $this->getOmsStatusCaptured(),
219
        ];
220
    }
221
222
    /**
223
     * @api
224
     *
225
     * @return string
226
     */
227
    public function getOmsStatusNew()
228
    {
229
        return static::OMS_STATUS_NEW;
230
    }
231
232
    /**
233
     * @api
234
     *
235
     * @return string
236
     */
237
    public function getOmsStatusInitialized()
238
    {
239
        return static::OMS_STATUS_INITIALIZED;
240
    }
241
242
    /**
243
     * @api
244
     *
245
     * @return string
246
     */
247
    public function getOmsStatusAuthorized()
248
    {
249
        return static::OMS_STATUS_AUTHORIZED;
250
    }
251
252
    /**
253
     * @api
254
     *
255
     * @return string
256
     */
257
    public function getAuthorizeRequestOmsStatus(): string
258
    {
259
        return static::OMS_STATUS_AUTHORIZE_REQUEST;
260
    }
261
262
    /**
263
     * @api
264
     *
265
     * @return string
266
     */
267
    public function getOmsStatusAuthorizationFailed()
268
    {
269
        return static::OMS_STATUS_AUTHORIZATION_FAILED;
270
    }
271
272
    /**
273
     * @api
274
     *
275
     * @return string
276
     */
277
    public function getOmsStatusCaptured()
278
    {
279
        return static::OMS_STATUS_CAPTURED;
280
    }
281
282
    /**
283
     * @api
284
     *
285
     * @return string
286
     */
287
    public function getOmsStatusCapturingFailed()
288
    {
289
        return static::OMS_STATUS_CAPTURING_FAILED;
290
    }
291
292
    /**
293
     * @api
294
     *
295
     * @return string
296
     */
297
    public function getOmsStatusCancelled()
298
    {
299
        return static::OMS_STATUS_CANCELLED;
300
    }
301
302
    /**
303
     * @api
304
     *
305
     * @return string
306
     */
307
    public function getOmsStatusRefunded()
308
    {
309
        return static::OMS_STATUS_REFUNDED;
310
    }
311
312
    /**
313
     * @api
314
     *
315
     * @return string
316
     */
317
    public function getAuthorizeMethodName()
318
    {
319
        return static::AUTHORIZE_METHOD;
320
    }
321
322
    /**
323
     * @api
324
     *
325
     * @return string
326
     */
327
    public function getCaptureMethodName()
328
    {
329
        return static::CAPTURE_METHOD;
330
    }
331
332
    /**
333
     * @api
334
     *
335
     * @return string
336
     */
337
    public function getRefundMethodName()
338
    {
339
        return static::REFUND_METHOD;
340
    }
341
342
    /**
343
     * @api
344
     *
345
     * @return string
346
     */
347
    public function getReverseMethodName()
348
    {
349
        return static::REVERSE_METHOD;
350
    }
351
352
    /**
353
     * @api
354
     *
355
     * @return string
356
     */
357
    public function getInquireMethodName()
358
    {
359
        return static::INQUIRE_METHOD;
360
    }
361
362
    /**
363
     * @api
364
     *
365
     * @return string
366
     */
367
    public function getOmsAuthorizeEventName()
368
    {
369
        return static::COMPUTOP_OMS_EVENT_AUTHORIZE;
370
    }
371
372
    /**
373
     * @api
374
     *
375
     * @return string
376
     */
377
    public function getOmsCaptureEventName()
378
    {
379
        return static::COMPUTOP_OMS_EVENT_CAPTURE;
380
    }
381
382
    /**
383
     * @api
384
     *
385
     * @return string[]
386
     */
387
    public function getCrifGreenPaymentMethods(): array
388
    {
389
        return $this->get(ComputopConstants::CRIF_GREEN_AVAILABLE_PAYMENT_METHODS);
390
    }
391
392
    /**
393
     * @api
394
     *
395
     * @return string[]
396
     */
397
    public function getCrifYellowPaymentMethods(): array
398
    {
399
        return $this->get(ComputopConstants::CRIF_YELLOW_AVAILABLE_PAYMENT_METHODS);
400
    }
401
402
    /**
403
     * @api
404
     *
405
     * @return string[]
406
     */
407
    public function getCrifRedPaymentMethods(): array
408
    {
409
        return $this->get(ComputopConstants::CRIF_RED_AVAILABLE_PAYMENT_METHODS);
410
    }
411
412
    /**
413
     * @api
414
     *
415
     * @return bool
416
     */
417
    public function isCrifEnabled(): bool
418
    {
419
        return (bool)$this->get(ComputopConstants::CRIF_ENABLED);
420
    }
421
422
    /**
423
     * @api
424
     *
425
     * @return string
426
     */
427
    public function getEtiId(): string
428
    {
429
        return SharedComputopConfig::COMPUTOP_MODULE_VERSION;
430
    }
431
432
    /**
433
     * @api
434
     *
435
     * @return string
436
     */
437
    public function getIdealIssuerId(): string
438
    {
439
        return $this->get(ComputopConstants::IDEAL_ISSUER_ID);
440
    }
441
442
    /**
443
     * Specification:
444
     * - Get Available currency for specific payment methods.
445
     *
446
     * @api
447
     *
448
     * @return array
449
     */
450
    public function getComputopPaymentMethodCurrencyFilterMap(): array
451
    {
452
        return [
453
            SharedComputopConfig::PAYMENT_METHOD_PAYU_CEE_SINGLE => [
454
                'PLN',
455
                'CZK',
456
            ],
457
        ];
458
    }
459
}
460