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