FirstDataConfig::getHashAlgo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Zed\FirstData;
9
10
use Spryker\Zed\Kernel\AbstractBundleConfig;
11
use SprykerEco\Shared\FirstData\FirstDataConstants;
12
13
class FirstDataConfig extends AbstractBundleConfig
14
{
15
    protected const MAX_CAPTURE_RETRY_COUNT = 3;
16
    protected const MAX_CANCEL_RETRY_COUNT = 3;
17
    protected const OMS_STATUS_NEW = 'new';
18
    protected const OMS_STATUS_AUTHORIZED = 'authorized';
19
    protected const OMS_STATUS_CAPTURE_REQUESTED = 'capture requested';
20
    protected const OMS_STATUS_CAPTURED = 'captured';
21
    protected const OMS_STATUS_CAPTURE_RETRY = 'payment capture retry';
22
    protected const STATE_CANCEL_REQUESTED = 'cancel requested';
23
    protected const OMS_STATUS_CANCELED = 'canceled';
24
    protected const OMS_STATUS_CANCELLATION_RETRY = 'payment cancellation retry required';
25
26
    public const FIRST_DATA_RESERVATION_REQUEST_TYPE = 'PaymentTokenPreAuthTransaction';
27
    public const FIRST_DATA_CANCEL_RESERVATION_REQUEST_TYPE = 'VoidPreAuthTransactions';
28
    public const FIRST_DATA_CAPTURE_REQUEST_TYPE = 'PostAuthTransaction';
29
    public const FIRST_DATA_REFUND_REQUEST_TYPE = 'ReturnTransaction';
30
31
    /**
32
     * @uses \SprykerEco\Shared\FirstData\FirstDataConfig::PAYMENT_METHOD_KEY_CREDIT_CARD
33
     */
34
    public const PAYMENT_METHOD_KEY_CREDIT_CARD = 'firstDataCreditCard';
35
36
    /**
37
     * @api
38
     *
39
     * @param string $requestType
40
     *
41
     * @return string
42
     */
43
    public function getApiEndpoint(string $requestType): string
44
    {
45
        if (in_array($requestType, [static::FIRST_DATA_RESERVATION_REQUEST_TYPE])) {
46
            return $this->getFirstDataPaymentApiUrl();
47
        }
48
49
        return $this->getFirstDataOrderApiUrl();
50
    }
51
52
    /**
53
     * @api
54
     *
55
     * @return string
56
     */
57
    public function getPaymentAuthorizationTimeOut(): string
58
    {
59
        return '1 hour';
60
    }
61
62
    /**
63
     * @api
64
     *
65
     * @return string
66
     */
67
    public function getOmsStatusNew(): string
68
    {
69
        return static::OMS_STATUS_NEW;
70
    }
71
72
    /**
73
     * @api
74
     *
75
     * @return string
76
     */
77
    public function getOmsStatusAuthorized(): string
78
    {
79
        return static::OMS_STATUS_AUTHORIZED;
80
    }
81
82
    /**
83
     * @api
84
     *
85
     * @return string
86
     */
87
    public function getOmsMaxCaptureRetryCount(): string
88
    {
89
        return static::MAX_CAPTURE_RETRY_COUNT;
90
    }
91
92
    /**
93
     * @api
94
     *
95
     * @return string
96
     */
97
    public function getOmsStatusCaptureRequested(): string
98
    {
99
        return static::OMS_STATUS_CAPTURE_REQUESTED;
100
    }
101
102
    /**
103
     * @api
104
     *
105
     * @return string
106
     */
107
    public function getOmsStatusCaptured(): string
108
    {
109
        return static::OMS_STATUS_CAPTURED;
110
    }
111
112
    /**
113
     * @api
114
     *
115
     * @return string
116
     */
117
    public function getOmsMaxCancelRetryCount(): string
118
    {
119
        return static::MAX_CANCEL_RETRY_COUNT;
120
    }
121
122
    /**
123
     * @api
124
     *
125
     * @return string
126
     */
127
    public function getOmsStatusCancelRequested(): string
128
    {
129
        return static::STATE_CANCEL_REQUESTED;
130
    }
131
132
    /**
133
     * @api
134
     *
135
     * @return string
136
     */
137
    public function getOmsStatusCancelRetry(): string
138
    {
139
        return static::OMS_STATUS_CANCELLATION_RETRY;
140
    }
141
142
    /**
143
     * @api
144
     *
145
     * @return string
146
     */
147
    public function getOmsStatusCaptureRetry(): string
148
    {
149
        return static::OMS_STATUS_CAPTURE_RETRY;
150
    }
151
152
    /**
153
     * @api
154
     *
155
     * @return string
156
     */
157
    public function getOmsStatusCanceled(): string
158
    {
159
        return static::OMS_STATUS_CANCELED;
160
    }
161
162
    /**
163
     * @api
164
     *
165
     * @return string
166
     */
167
    public function getFirstDataOrderApiUrl(): string
168
    {
169
        return $this->get(FirstDataConstants::ORDER_API_URL);
170
    }
171
172
    /**
173
     * @api
174
     *
175
     * @return string
176
     */
177
    public function getFirstDataPaymentApiUrl(): string
178
    {
179
        return $this->get(FirstDataConstants::PAYMENT_API_URL);
180
    }
181
182
    /**
183
     * @api
184
     *
185
     * @return string
186
     */
187
    public function getFirstDataApiKey(): string
188
    {
189
        return $this->get(FirstDataConstants::API_KEY);
190
    }
191
192
    /**
193
     * @api
194
     *
195
     * @return string
196
     */
197
    public function getFirstDataApiSecret(): string
198
    {
199
        return $this->get(FirstDataConstants::API_SECRET);
200
    }
201
202
    /**
203
     * @api
204
     *
205
     * @return string
206
     */
207
    public function getHashAlgo(): string
208
    {
209
        return $this->get(FirstDataConstants::HASH_ALGO);
210
    }
211
212
    /**
213
     * @api
214
     *
215
     * @return string
216
     */
217
    public function getStoreName(): string
218
    {
219
        return $this->get(FirstDataConstants::STORE_NAME);
220
    }
221
}
222