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\Framework\Stdlib\DateTime\DateTime; |
||
0 ignored issues
–
show
The type
Magento\Framework\Stdlib\DateTime\DateTime 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 | 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 ![]() |
|||
14 | |||
15 | /** |
||
16 | * Class ConfigBoleto - Returns form of payment configuration properties. |
||
17 | */ |
||
18 | class ConfigBoleto 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 ![]() |
|||
19 | { |
||
20 | /** |
||
21 | * Method code - Boleto. |
||
22 | * |
||
23 | * @const string |
||
24 | */ |
||
25 | const METHOD = 'moip_magento2_boleto'; |
||
26 | |||
27 | /** |
||
28 | * Active - Boleto. |
||
29 | * |
||
30 | * @const boolean |
||
31 | */ |
||
32 | const ACTIVE = 'active'; |
||
33 | |||
34 | /** |
||
35 | * Title - Boleto. |
||
36 | * |
||
37 | * @const string |
||
38 | */ |
||
39 | const TITLE = 'title'; |
||
40 | |||
41 | /** |
||
42 | * Instruction in Checkout - Boleto. |
||
43 | * |
||
44 | * @const string |
||
45 | */ |
||
46 | const INSTRUCTION_CHECKOUT = 'instruction_checkout'; |
||
47 | |||
48 | /** |
||
49 | * Expiration - Boleto. |
||
50 | * |
||
51 | * @const int |
||
52 | */ |
||
53 | const EXPIRATION = 'expiration'; |
||
54 | |||
55 | /** |
||
56 | * Printing instruction - Line 1 - Boleto. |
||
57 | * |
||
58 | * @const string |
||
59 | */ |
||
60 | const INSTRUCTION_LINE_FIRST = 'instruction_lines_first'; |
||
61 | |||
62 | /** |
||
63 | * Printing instruction - Line 2 - Boleto. |
||
64 | * |
||
65 | * @const string |
||
66 | */ |
||
67 | const INSTRUCTION_LINE_SECOND = 'instruction_lines_second'; |
||
68 | |||
69 | /** |
||
70 | * Printing instruction - Line 3 - Boleto. |
||
71 | * |
||
72 | * @const string |
||
73 | */ |
||
74 | const INSTRUCTION_LINE_THIRD = 'instruction_lines_third'; |
||
75 | |||
76 | /** |
||
77 | * Use tax document capture - Boleto. |
||
78 | * |
||
79 | * @const boolean |
||
80 | */ |
||
81 | const USE_GET_TAX_DOCUMENT = 'get_tax_document'; |
||
82 | |||
83 | /** |
||
84 | * Use name capture - Boleto. |
||
85 | * |
||
86 | * @const boolean |
||
87 | */ |
||
88 | const USE_GET_NAME = 'get_name'; |
||
89 | |||
90 | /** |
||
91 | * @var ScopeConfigInterface |
||
92 | */ |
||
93 | private $scopeConfig; |
||
94 | |||
95 | /** |
||
96 | * @var Date |
||
0 ignored issues
–
show
The type
Moip\Magento2\Gateway\Config\Date 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 ![]() |
|||
97 | */ |
||
98 | private $date; |
||
99 | |||
100 | /** |
||
101 | * @param ScopeConfigInterface $scopeConfig |
||
102 | */ |
||
103 | public function __construct( |
||
104 | ScopeConfigInterface $scopeConfig, |
||
105 | DateTime $date |
||
106 | ) { |
||
107 | $this->scopeConfig = $scopeConfig; |
||
108 | $this->date = $date; |
||
109 | } |
||
110 | |||
111 | /** |
||
112 | * Get Payment configuration status. |
||
113 | * |
||
114 | * @return bool |
||
115 | */ |
||
116 | public function isActive($storeId = null): bool |
||
117 | { |
||
118 | $pathPattern = 'payment/%s/%s'; |
||
119 | |||
120 | return (bool) $this->scopeConfig->getValue( |
||
121 | sprintf($pathPattern, self::METHOD, self::ACTIVE), |
||
122 | ScopeInterface::SCOPE_STORE, |
||
123 | $storeId |
||
124 | ); |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * Get title of payment. |
||
129 | * |
||
130 | * @return string|null |
||
131 | */ |
||
132 | public function getTitle($storeId = null) |
||
133 | { |
||
134 | $pathPattern = 'payment/%s/%s'; |
||
135 | |||
136 | return $this->scopeConfig->getValue( |
||
137 | sprintf($pathPattern, self::METHOD, self::TITLE), |
||
138 | ScopeInterface::SCOPE_STORE, |
||
139 | $storeId |
||
140 | ); |
||
141 | } |
||
142 | |||
143 | /** |
||
144 | * Get Instruction - Checkoout. |
||
145 | * |
||
146 | * @return string|null |
||
147 | */ |
||
148 | public function getInstructionCheckout($storeId = null) |
||
149 | { |
||
150 | $pathPattern = 'payment/%s/%s'; |
||
151 | |||
152 | return $this->scopeConfig->getValue( |
||
153 | sprintf($pathPattern, self::METHOD, self::INSTRUCTION_CHECKOUT), |
||
154 | ScopeInterface::SCOPE_STORE, |
||
155 | $storeId |
||
156 | ); |
||
157 | } |
||
158 | |||
159 | /** |
||
160 | * Get Expiration. |
||
161 | * |
||
162 | * @return date |
||
0 ignored issues
–
show
The type
Moip\Magento2\Gateway\Config\date 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 ![]() |
|||
163 | */ |
||
164 | public function getExpiration($storeId = null) |
||
165 | { |
||
166 | $pathPattern = 'payment/%s/%s'; |
||
167 | $due = $this->scopeConfig->getValue( |
||
168 | sprintf($pathPattern, self::METHOD, self::EXPIRATION), |
||
169 | ScopeInterface::SCOPE_STORE, |
||
170 | $storeId |
||
171 | ); |
||
172 | |||
173 | return $this->date->gmtDate('Y-m-d', strtotime("+{$due} days")); |
||
174 | } |
||
175 | |||
176 | /** |
||
177 | * Get Expiration Formart. |
||
178 | * |
||
179 | * @return date |
||
180 | */ |
||
181 | public function getExpirationFormat($storeId = null) |
||
182 | { |
||
183 | $pathPattern = 'payment/%s/%s'; |
||
184 | $due = $this->scopeConfig->getValue( |
||
185 | sprintf($pathPattern, self::METHOD, self::EXPIRATION), |
||
186 | ScopeInterface::SCOPE_STORE, |
||
187 | $storeId |
||
188 | ); |
||
189 | |||
190 | return $this->date->gmtDate('d/m/Y', strtotime("+{$due} days")); |
||
191 | } |
||
192 | |||
193 | /** |
||
194 | * Get Instruction Line First - For Boleto. |
||
195 | * |
||
196 | * @return string|null |
||
197 | */ |
||
198 | public function getInstructionLineFirst($storeId = null) |
||
199 | { |
||
200 | $pathPattern = 'payment/%s/%s'; |
||
201 | |||
202 | return $this->scopeConfig->getValue( |
||
203 | sprintf($pathPattern, self::METHOD, self::INSTRUCTION_LINE_FIRST), |
||
204 | ScopeInterface::SCOPE_STORE, |
||
205 | $storeId |
||
206 | ); |
||
207 | } |
||
208 | |||
209 | /** |
||
210 | * Get Instruction Line Second - For Boleto. |
||
211 | * |
||
212 | * @return string|null |
||
213 | */ |
||
214 | public function getInstructionLineSecond($storeId = null) |
||
215 | { |
||
216 | $pathPattern = 'payment/%s/%s'; |
||
217 | |||
218 | return $this->scopeConfig->getValue( |
||
219 | sprintf($pathPattern, self::METHOD, self::INSTRUCTION_LINE_SECOND), |
||
220 | ScopeInterface::SCOPE_STORE, |
||
221 | $storeId |
||
222 | ); |
||
223 | } |
||
224 | |||
225 | /** |
||
226 | * Get Instruction Line Third - For Boleto. |
||
227 | * |
||
228 | * @return string|null |
||
229 | */ |
||
230 | public function getInstructionLineThird($storeId = null) |
||
231 | { |
||
232 | $pathPattern = 'payment/%s/%s'; |
||
233 | |||
234 | return $this->scopeConfig->getValue( |
||
235 | sprintf($pathPattern, self::METHOD, self::INSTRUCTION_LINE_THIRD), |
||
236 | ScopeInterface::SCOPE_STORE, |
||
237 | $storeId |
||
238 | ); |
||
239 | } |
||
240 | |||
241 | /** |
||
242 | * Get if you use document capture on the form. |
||
243 | * |
||
244 | * @return string|null |
||
245 | */ |
||
246 | public function getUseTaxDocumentCapture($storeId = null) |
||
247 | { |
||
248 | $pathPattern = 'payment/%s/%s'; |
||
249 | |||
250 | return (bool) $this->scopeConfig->getValue( |
||
0 ignored issues
–
show
|
|||
251 | sprintf($pathPattern, self::METHOD, self::USE_GET_TAX_DOCUMENT), |
||
252 | ScopeInterface::SCOPE_STORE, |
||
253 | $storeId |
||
254 | ); |
||
255 | } |
||
256 | |||
257 | /** |
||
258 | * Get if you use name capture on the form. |
||
259 | * |
||
260 | * @return string|null |
||
261 | */ |
||
262 | public function getUseNameCapture($storeId = null) |
||
263 | { |
||
264 | $pathPattern = 'payment/%s/%s'; |
||
265 | |||
266 | return (bool) $this->scopeConfig->getValue( |
||
0 ignored issues
–
show
|
|||
267 | sprintf($pathPattern, self::METHOD, self::USE_GET_NAME), |
||
268 | ScopeInterface::SCOPE_STORE, |
||
269 | $storeId |
||
270 | ); |
||
271 | } |
||
272 | } |
||
273 |
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