1 | <?php |
||
2 | /** |
||
3 | * Copyright © Wirecard Brasil. All rights reserved. |
||
4 | * |
||
5 | * @author Bruno Elisei <[email protected]> |
||
6 | * See COPYING.txt for license details. |
||
7 | */ |
||
8 | |||
9 | namespace Moip\Magento2\Gateway\Config; |
||
10 | |||
11 | use Magento\Framework\App\Config\ScopeConfigInterface; |
||
0 ignored issues
–
show
|
|||
12 | use Magento\Store\Model\ScopeInterface; |
||
0 ignored issues
–
show
The type
Magento\Store\Model\ScopeInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
13 | |||
14 | /** |
||
15 | * Class ConfigCc - Returns form of payment configuration properties. |
||
16 | */ |
||
17 | class ConfigCc extends \Magento\Payment\Gateway\Config\Config |
||
0 ignored issues
–
show
The type
Magento\Payment\Gateway\Config\Config was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
18 | { |
||
19 | /** |
||
20 | * Method Code - Cc. |
||
21 | * |
||
22 | * @const string |
||
23 | */ |
||
24 | const METHOD = 'moip_magento2_cc'; |
||
25 | |||
26 | /** |
||
27 | * Cc Tyoes - Cc. |
||
28 | * |
||
29 | * @const array |
||
30 | */ |
||
31 | const CC_TYPES = 'payment/moip_magento2_cc/cctypes'; |
||
32 | |||
33 | /** |
||
34 | * CVV Enabled - Cc. |
||
35 | * |
||
36 | * @const boolean |
||
37 | */ |
||
38 | const CVV_ENABLED = 'cvv_enabled'; |
||
39 | |||
40 | /** |
||
41 | * Active - Cc. |
||
42 | * |
||
43 | * @const boolean |
||
44 | */ |
||
45 | const ACTIVE = 'active'; |
||
46 | |||
47 | /** |
||
48 | * Title - Cc. |
||
49 | * |
||
50 | * @const string |
||
51 | */ |
||
52 | const TITLE = 'title'; |
||
53 | |||
54 | /** |
||
55 | * Mapper CC. |
||
56 | * |
||
57 | * @const string |
||
58 | */ |
||
59 | const CC_MAPPER = 'cctypes_moip_magento2_cc_mapper'; |
||
60 | |||
61 | /** |
||
62 | * Use tax document capture - Cc. |
||
63 | * |
||
64 | * @const boolean |
||
65 | */ |
||
66 | const USE_GET_TAX_DOCUMENT = 'get_tax_document'; |
||
67 | |||
68 | /** |
||
69 | * Use birth date capture - Cc. |
||
70 | * |
||
71 | * @const boolean |
||
72 | */ |
||
73 | const USE_GET_BIRTH_DATE = 'get_birth_date'; |
||
74 | |||
75 | /** |
||
76 | * Use phone capture - Cc. |
||
77 | * |
||
78 | * @const boolean |
||
79 | */ |
||
80 | const USE_GET_PHONE = 'get_phone'; |
||
81 | |||
82 | /** |
||
83 | * @var ScopeConfigInterface |
||
84 | */ |
||
85 | private $scopeConfig; |
||
86 | |||
87 | /** |
||
88 | * @param ScopeConfigInterface $scopeConfig |
||
89 | */ |
||
90 | public function __construct( |
||
91 | ScopeConfigInterface $scopeConfig |
||
92 | ) { |
||
93 | $this->scopeConfig = $scopeConfig; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Should the cvv field be shown. |
||
98 | * |
||
99 | * @param int|null $storeId |
||
100 | * |
||
101 | * @return bool |
||
102 | */ |
||
103 | public function isCvvEnabled($storeId = null) |
||
104 | { |
||
105 | $pathPattern = 'payment/%s/%s'; |
||
106 | |||
107 | return (bool) $this->scopeConfig->getValue( |
||
108 | sprintf($pathPattern, self::METHOD, self::CVV_ENABLED), |
||
109 | ScopeInterface::SCOPE_STORE, |
||
110 | $storeId |
||
111 | ); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * Get Payment configuration status. |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | public function isActive($storeId = null): bool |
||
120 | { |
||
121 | $pathPattern = 'payment/%s/%s'; |
||
122 | |||
123 | return (bool) $this->scopeConfig->getValue( |
||
124 | sprintf($pathPattern, self::METHOD, self::ACTIVE), |
||
125 | ScopeInterface::SCOPE_STORE, |
||
126 | $storeId |
||
127 | ); |
||
128 | } |
||
129 | |||
130 | /** |
||
131 | * Get title of payment. |
||
132 | * |
||
133 | * @return string|null |
||
134 | */ |
||
135 | public function getTitle($storeId = null) |
||
136 | { |
||
137 | $pathPattern = 'payment/%s/%s'; |
||
138 | |||
139 | return $this->scopeConfig->getValue( |
||
140 | sprintf($pathPattern, self::METHOD, self::TITLE), |
||
141 | ScopeInterface::SCOPE_STORE, |
||
142 | $storeId |
||
143 | ); |
||
144 | } |
||
145 | |||
146 | /** |
||
147 | * Get if you use document capture on the form. |
||
148 | * |
||
149 | * @return string|null |
||
150 | */ |
||
151 | public function getUseTaxDocumentCapture($storeId = null) |
||
152 | { |
||
153 | $pathPattern = 'payment/%s/%s'; |
||
154 | |||
155 | return (bool) $this->scopeConfig->getValue( |
||
0 ignored issues
–
show
|
|||
156 | sprintf($pathPattern, self::METHOD, self::USE_GET_TAX_DOCUMENT), |
||
157 | ScopeInterface::SCOPE_STORE, |
||
158 | $storeId |
||
159 | ); |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | * Get if you use birth date capture on the form. |
||
164 | * |
||
165 | * @return string|null |
||
166 | */ |
||
167 | public function getUseBirthDateCapture($storeId = null) |
||
168 | { |
||
169 | $pathPattern = 'payment/%s/%s'; |
||
170 | |||
171 | return (bool) $this->scopeConfig->getValue( |
||
0 ignored issues
–
show
|
|||
172 | sprintf($pathPattern, self::METHOD, self::USE_GET_BIRTH_DATE), |
||
173 | ScopeInterface::SCOPE_STORE, |
||
174 | $storeId |
||
175 | ); |
||
176 | } |
||
177 | |||
178 | /** |
||
179 | * Get if you use phone capture on the form. |
||
180 | * |
||
181 | * @return string|null |
||
182 | */ |
||
183 | public function getUsePhoneCapture($storeId = null) |
||
184 | { |
||
185 | $pathPattern = 'payment/%s/%s'; |
||
186 | |||
187 | return (bool) $this->scopeConfig->getValue( |
||
0 ignored issues
–
show
|
|||
188 | sprintf($pathPattern, self::METHOD, self::USE_GET_PHONE), |
||
189 | ScopeInterface::SCOPE_STORE, |
||
190 | $storeId |
||
191 | ); |
||
192 | } |
||
193 | |||
194 | /** |
||
195 | * Should the cc types. |
||
196 | * |
||
197 | * @param int|null $storeId |
||
198 | * |
||
199 | * @return bool |
||
200 | */ |
||
201 | public function getCcAvailableTypes($storeId = null) |
||
202 | { |
||
203 | return $this->scopeConfig->getValue( |
||
204 | self::CC_TYPES, |
||
205 | ScopeInterface::SCOPE_STORE, |
||
206 | $storeId |
||
207 | ); |
||
208 | } |
||
209 | |||
210 | /** |
||
211 | * Cc Mapper. |
||
212 | * |
||
213 | * @param int|null $storeId |
||
214 | * |
||
215 | * @return array |
||
216 | */ |
||
217 | public function getCcTypesMapper($storeId = null): array |
||
218 | { |
||
219 | $pathPattern = 'payment/%s/%s'; |
||
220 | |||
221 | $ccTypesMapper = $this->scopeConfig->getValue( |
||
222 | sprintf($pathPattern, self::METHOD, self::CC_MAPPER), |
||
223 | ScopeInterface::SCOPE_STORE, |
||
224 | $storeId |
||
225 | ); |
||
226 | |||
227 | $result = json_decode($ccTypesMapper, true); |
||
228 | |||
229 | return is_array($result) ? $result : []; |
||
230 | } |
||
231 | |||
232 | /** |
||
233 | * Get info interest. |
||
234 | * |
||
235 | * @return array |
||
236 | */ |
||
237 | public function getInfoInterest($storeId = null) |
||
238 | { |
||
239 | $juros = []; |
||
240 | $juros['0'] = 0; |
||
241 | $juros['1'] = -$this->scopeConfig->getValue( |
||
242 | 'payment/moip_magento2_cc/installment_installment_1', |
||
243 | ScopeInterface::SCOPE_STORE, |
||
244 | $storeId |
||
245 | ); |
||
246 | $juros['2'] = $this->scopeConfig->getValue( |
||
247 | 'payment/moip_magento2_cc/installment_installment_2', |
||
248 | ScopeInterface::SCOPE_STORE, |
||
249 | $storeId |
||
250 | ); |
||
251 | $juros['3'] = $this->scopeConfig->getValue( |
||
252 | 'payment/moip_magento2_cc/installment_installment_3', |
||
253 | ScopeInterface::SCOPE_STORE, |
||
254 | $storeId |
||
255 | ); |
||
256 | $juros['4'] = $this->scopeConfig->getValue( |
||
257 | 'payment/moip_magento2_cc/installment_installment_4', |
||
258 | ScopeInterface::SCOPE_STORE, |
||
259 | $storeId |
||
260 | ); |
||
261 | $juros['5'] = $this->scopeConfig->getValue( |
||
262 | 'payment/moip_magento2_cc/installment_installment_5', |
||
263 | ScopeInterface::SCOPE_STORE, |
||
264 | $storeId |
||
265 | ); |
||
266 | $juros['6'] = $this->scopeConfig->getValue( |
||
267 | 'payment/moip_magento2_cc/installment_installment_6', |
||
268 | ScopeInterface::SCOPE_STORE, |
||
269 | $storeId |
||
270 | ); |
||
271 | $juros['7'] = $this->scopeConfig->getValue( |
||
272 | 'payment/moip_magento2_cc/installment_installment_7', |
||
273 | ScopeInterface::SCOPE_STORE, |
||
274 | $storeId |
||
275 | ); |
||
276 | $juros['8'] = $this->scopeConfig->getValue( |
||
277 | 'payment/moip_magento2_cc/installment_installment_8', |
||
278 | ScopeInterface::SCOPE_STORE, |
||
279 | $storeId |
||
280 | ); |
||
281 | $juros['9'] = $this->scopeConfig->getValue( |
||
282 | 'payment/moip_magento2_cc/installment_installment_9', |
||
283 | ScopeInterface::SCOPE_STORE, |
||
284 | $storeId |
||
285 | ); |
||
286 | $juros['10'] = $this->scopeConfig->getValue( |
||
287 | 'payment/moip_magento2_cc/installment_installment_10', |
||
288 | ScopeInterface::SCOPE_STORE, |
||
289 | $storeId |
||
290 | ); |
||
291 | $juros['11'] = $this->scopeConfig->getValue( |
||
292 | 'payment/moip_magento2_cc/installment_installment_11', |
||
293 | ScopeInterface::SCOPE_STORE, |
||
294 | $storeId |
||
295 | ); |
||
296 | $juros['12'] = $this->scopeConfig->getValue( |
||
297 | 'payment/moip_magento2_cc/installment_installment_12', |
||
298 | ScopeInterface::SCOPE_STORE, |
||
299 | $storeId |
||
300 | ); |
||
301 | |||
302 | return $juros; |
||
303 | } |
||
304 | |||
305 | /** |
||
306 | * Get type Interest. |
||
307 | * |
||
308 | * @return string |
||
309 | */ |
||
310 | public function getTypeInstallment($storeId = null) |
||
311 | { |
||
312 | return $this->scopeConfig->getValue( |
||
313 | 'payment/moip_magento2_cc/installment_type_interest', |
||
314 | ScopeInterface::SCOPE_STORE, |
||
315 | $storeId |
||
316 | ); |
||
317 | } |
||
318 | |||
319 | /** |
||
320 | * Get min installment. |
||
321 | * |
||
322 | * @return int |
||
323 | */ |
||
324 | public function getMinInstallment($storeId = null) |
||
325 | { |
||
326 | return $this->scopeConfig->getValue( |
||
327 | 'payment/moip_magento2_cc/installment_min_installment', |
||
328 | ScopeInterface::SCOPE_STORE, |
||
329 | $storeId |
||
330 | ); |
||
331 | } |
||
332 | |||
333 | /** |
||
334 | * Get max installment. |
||
335 | * |
||
336 | * @return int |
||
337 | */ |
||
338 | public function getMaxInstallment($storeId = null) |
||
339 | { |
||
340 | return $this->scopeConfig->getValue( |
||
341 | 'payment/moip_magento2_cc/installment_max_installment', |
||
342 | ScopeInterface::SCOPE_STORE, |
||
343 | $storeId |
||
344 | ); |
||
345 | } |
||
346 | |||
347 | /** |
||
348 | * Get is enable instant purchase. |
||
349 | * |
||
350 | * @return int |
||
351 | */ |
||
352 | public function getEnableInstantPurchase($storeId = null) |
||
353 | { |
||
354 | return $this->scopeConfig->getValue( |
||
355 | 'payment/moip_magento2_cc/instant_purchase_enable', |
||
356 | ScopeInterface::SCOPE_STORE, |
||
357 | $storeId |
||
358 | ); |
||
359 | } |
||
360 | } |
||
361 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths