Passed
Pull Request — feature/eco-3623-payone-pay-u-... (#41)
by Roman
30:51
created

ComputopConfig::getBeforeAuthorizeStatuses()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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