Passed
Push — feature/eco-3656/eco-3658-enab... ( 522204...dfb610 )
by
unknown
04:02
created

ComputopConfig::getDefaultShipmentMethodId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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