Passed
Push — feature/eco-2166-additional-in... ( c61e00...9cf080 )
by Aleksey
07:43
created

ComputopConfig   A

Complexity

Total Complexity 36

Size/Duplication

Total Lines 322
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 36
eloc 61
dl 0
loc 322
rs 9.52
c 0
b 0
f 0

36 Methods

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