Completed
Push — dev ( d19368 )
by Aleksey
12s
created

ComputopConfig   A

Complexity

Total Complexity 36

Size/Duplication

Total Lines 321
Duplicated Lines 0 %

Importance

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