1 | <?php |
||
2 | |||
3 | /** |
||
4 | * PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify |
||
5 | * it under the terms of the GNU Lesser General Public License as published by |
||
6 | * the Free Software Foundation, either version 3 of the License, or |
||
7 | * (at your option) any later version. |
||
8 | * |
||
9 | * PAYONE Magento 2 Connector is distributed in the hope that it will be useful, |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
12 | * GNU Lesser General Public License for more details. |
||
13 | * |
||
14 | * You should have received a copy of the GNU Lesser General Public License |
||
15 | * along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. |
||
16 | * |
||
17 | * PHP version 5 |
||
18 | * |
||
19 | * @category Payone |
||
20 | * @package Payone_Magento2_Plugin |
||
21 | * @author FATCHIP GmbH <[email protected]> |
||
22 | * @copyright 2003 - 2016 Payone GmbH |
||
23 | * @license <http://www.gnu.org/licenses/> GNU Lesser General Public License |
||
24 | * @link http://www.payone.de |
||
25 | */ |
||
26 | |||
27 | namespace Payone\Core\Model\Config; |
||
28 | |||
29 | use Magento\Store\Api\Data\StoreInterface; |
||
0 ignored issues
–
show
|
|||
30 | |||
31 | /** |
||
32 | * Generator class for the config export |
||
33 | * |
||
34 | * @category Payone |
||
35 | * @package Payone_Magento2_Plugin |
||
36 | * @author FATCHIP GmbH <[email protected]> |
||
37 | * @copyright 2003 - 2016 Payone GmbH |
||
38 | * @license <http://www.gnu.org/licenses/> GNU Lesser General Public License |
||
39 | * @link http://www.payone.de |
||
40 | */ |
||
41 | class Export extends \Payone\Core\Model\Export\Xml |
||
42 | { |
||
43 | /** |
||
44 | * ConfigExport helper object |
||
45 | * |
||
46 | * @var \Payone\Core\Helper\ConfigExport |
||
47 | */ |
||
48 | protected $configExportHelper; |
||
49 | |||
50 | /** |
||
51 | * Store manage object |
||
52 | * |
||
53 | * @var \Magento\Store\Model\StoreManagerInterface |
||
0 ignored issues
–
show
The type
Magento\Store\Model\StoreManagerInterface 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 ![]() |
|||
54 | */ |
||
55 | protected $storeManager; |
||
56 | |||
57 | /** |
||
58 | * PAYONE payment helper |
||
59 | * |
||
60 | * @var \Payone\Core\Helper\Payment |
||
61 | */ |
||
62 | protected $paymentHelper; |
||
63 | |||
64 | /** |
||
65 | * PAYONE addresscheck model |
||
66 | * |
||
67 | * @var \Payone\Core\Model\Risk\Addresscheck |
||
68 | */ |
||
69 | protected $addresscheck; |
||
70 | |||
71 | /** |
||
72 | * Constructor |
||
73 | * |
||
74 | * @param \Payone\Core\Helper\ConfigExport $configExportHelper |
||
75 | * @param \Magento\Store\Model\StoreManagerInterface $storeManager |
||
76 | * @param \Payone\Core\Helper\Payment $paymentHelper |
||
77 | * @param \Payone\Core\Helper\Shop $shopHelper |
||
78 | * @param \Payone\Core\Model\Risk\Addresscheck $addresscheck |
||
79 | */ |
||
80 | public function __construct( |
||
81 | \Payone\Core\Helper\ConfigExport $configExportHelper, |
||
82 | \Magento\Store\Model\StoreManagerInterface $storeManager, |
||
83 | \Payone\Core\Helper\Payment $paymentHelper, |
||
84 | \Payone\Core\Helper\Shop $shopHelper, |
||
85 | \Payone\Core\Model\Risk\Addresscheck $addresscheck |
||
86 | ) { |
||
87 | parent::__construct($shopHelper); |
||
88 | $this->configExportHelper = $configExportHelper; |
||
89 | $this->storeManager = $storeManager; |
||
90 | $this->paymentHelper = $paymentHelper; |
||
91 | $this->addresscheck = $addresscheck; |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * Add shop system config to xml |
||
96 | * |
||
97 | * @return void |
||
98 | */ |
||
99 | protected function addShopSystemConfig() |
||
100 | { |
||
101 | $this->writeToXml('<system>', 2); |
||
102 | $this->writeNode('name', 'Magento2', 3); |
||
103 | $this->writeNode('version', $this->shopHelper->getMagentoVersion(), 3); |
||
104 | $this->writeNode('edition', $this->shopHelper->getMagentoEdition(), 3); |
||
105 | $this->writeToXml('<modules>', 3); |
||
106 | foreach ($this->configExportHelper->getModuleInfo() as $sModule => $sInfo) { |
||
107 | $this->writeNode($sModule, $sInfo, 4); |
||
108 | } |
||
109 | $this->writeToXml('</modules>', 3); |
||
110 | $this->writeToXml('</system>', 2); |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * Add shop global config to xml |
||
115 | * |
||
116 | * @param string $sStoreCode |
||
117 | * @return void |
||
118 | */ |
||
119 | protected function addStatusMappings($sStoreCode) |
||
120 | { |
||
121 | $this->writeToXml('<status_mapping>', 3); |
||
122 | foreach ($this->configExportHelper->getMappings($sStoreCode) as $sAbbr => $aMappings) { |
||
123 | $this->writeToXml("<{$sAbbr}>", 4); |
||
124 | foreach ($aMappings as $aMap) { |
||
125 | $this->writeToXml('<map from="'.$aMap['from'].'" to="'.$aMap['to'].'"/>', 4); |
||
126 | } |
||
127 | $this->writeToXml("</{$sAbbr}>", 4); |
||
128 | } |
||
129 | $this->writeToXml('</status_mapping>', 3); |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * Add shop global config to xml |
||
134 | * |
||
135 | * @param string $sStoreCode |
||
136 | * @return void |
||
137 | */ |
||
138 | protected function addShopGlobalConfig($sStoreCode) |
||
139 | { |
||
140 | $this->writeToXml('<global>', 2); |
||
141 | $this->writeConfigNode('mid', 3, $sStoreCode, 'mid'); |
||
142 | $this->writeConfigNode('aid', 3, $sStoreCode, 'aid'); |
||
143 | $this->writeConfigNode('portalid', 3, $sStoreCode, 'portalid'); |
||
144 | $this->writeConfigNode('refnr_prefix', 3, $sStoreCode, 'ref_prefix'); |
||
145 | $this->writeConfigNode('request_type', 3, $sStoreCode, 'request_type'); |
||
146 | $this->writeConfigNode('pdf_download_enabled', 3, $sStoreCode, 'pdf_download_enabled', 'invoicing'); |
||
147 | $this->writeConfigNode('transmit_enabled', 3, $sStoreCode, 'transmit_enabled', 'invoicing'); |
||
148 | $this->writeToXml('<parameter_invoice>', 3); |
||
149 | $this->writeToXml("<invoice_appendix><![CDATA[{$this->configExportHelper->getConfigParam('invoice_appendix', 'invoicing', 'payone_general', $sStoreCode)}]]></invoice_appendix>", 4); |
||
150 | $this->writeToXml("<invoice_appendix_refund><![CDATA[{$this->configExportHelper->getConfigParam('invoice_appendix_refund', 'invoicing', 'payone_general', $sStoreCode)}]]></invoice_appendix_refund>", 3); |
||
151 | $this->writeToXml('</parameter_invoice>', 3); |
||
152 | $this->addStatusMappings($sStoreCode); |
||
153 | $this->writeToXml('</global>', 2); |
||
154 | } |
||
155 | |||
156 | /** |
||
157 | * Add shop clearingtype config to xml |
||
158 | * |
||
159 | * @param string $sStoreCode |
||
160 | * @return void |
||
161 | */ |
||
162 | protected function addShopClearingtypeConfig($sStoreCode) |
||
163 | { |
||
164 | $this->writeToXml('<clearingtypes>', 2); |
||
165 | foreach ($this->paymentHelper->getAvailablePaymentTypes() as $sPaymentCode) { |
||
166 | $sAbbr = $this->paymentHelper->getPaymentAbbreviation($sPaymentCode); |
||
167 | $this->writeToXml("<{$sAbbr}>", 3); |
||
168 | $this->writeToXml("<title><![CDATA[{$this->configExportHelper->getConfigParam('title', $sPaymentCode, 'payment', $sStoreCode)}]]></title>", 4); |
||
169 | $this->writeNode("id", $sPaymentCode, 4); |
||
170 | $this->writeNode("mid", $this->configExportHelper->getPaymentConfig('mid', $sPaymentCode, $sStoreCode, true), 4); |
||
171 | $this->writeNode("aid", $this->configExportHelper->getPaymentConfig('aid', $sPaymentCode, $sStoreCode, true), 4); |
||
172 | $this->writeNode("portalid", $this->configExportHelper->getPaymentConfig('portalid', $sPaymentCode, $sStoreCode, true), 4); |
||
173 | $this->writeNode("refnr_prefix", $this->configExportHelper->getPaymentConfig('ref_prefix', $sPaymentCode, $sStoreCode, true), 4); |
||
174 | $this->writeConfigNode('min_order_total', 4, $sStoreCode, 'min_order_total', $sPaymentCode, 'payment'); |
||
175 | $this->writeConfigNode('max_order_total', 4, $sStoreCode, 'max_order_total', $sPaymentCode, 'payment'); |
||
176 | $this->writeConfigNode('active', 4, $sStoreCode, 'active', $sPaymentCode, 'payment'); |
||
177 | $this->writeNode("countries", $this->configExportHelper->getCountries($sPaymentCode, $sStoreCode), 4); |
||
178 | $this->writeNode("authorization", $this->configExportHelper->getPaymentConfig('request_type', $sPaymentCode, $sStoreCode, true), 4); |
||
179 | $this->writeNode("mode", $this->configExportHelper->getPaymentConfig('mode', $sPaymentCode, $sStoreCode), 4); |
||
180 | $this->writeToXml("</{$sAbbr}>", 3); |
||
181 | } |
||
182 | $this->writeToXml('</clearingtypes>', 2); |
||
183 | } |
||
184 | |||
185 | /** |
||
186 | * Add addresscheck config to xml |
||
187 | * |
||
188 | * @param string $sStoreCode |
||
189 | * @return void |
||
190 | */ |
||
191 | protected function addAddresscheckConfig($sStoreCode) |
||
192 | { |
||
193 | $this->writeToXml('<addresscheck>', 3); |
||
194 | $this->writeNode("active", $this->configExportHelper->getConfigParam('enabled', 'address_check', 'payone_protect', $sStoreCode), 4); |
||
195 | $this->writeNode("mode", $this->configExportHelper->getConfigParam('mode', 'address_check', 'payone_protect', $sStoreCode), 4); |
||
196 | $this->writeNode("min_order_total", $this->configExportHelper->getConfigParam('min_order_total', 'address_check', 'payone_protect', $sStoreCode), 4); |
||
197 | $this->writeNode("max_order_total", $this->configExportHelper->getConfigParam('max_order_total', 'address_check', 'payone_protect', $sStoreCode), 4); |
||
198 | $this->writeNode("checkbilling", $this->configExportHelper->getConfigParam('check_billing', 'address_check', 'payone_protect', $sStoreCode), 4); |
||
199 | $this->writeNode("checkshipping", $this->configExportHelper->getConfigParam('check_shipping', 'address_check', 'payone_protect', $sStoreCode), 4); |
||
200 | $this->writeToXml('<personstatusmapping>', 4); |
||
201 | $aMapping = $this->addresscheck->getPersonstatusMapping(); |
||
202 | foreach ($aMapping as $sPersonstatus => $sScore) { |
||
203 | $this->writeNode($sPersonstatus, $sScore, 5); |
||
204 | } |
||
205 | $this->writeToXml('</personstatusmapping>', 4); |
||
206 | $this->writeToXml('</addresscheck>', 3); |
||
207 | } |
||
208 | |||
209 | /** |
||
210 | * Add consumerscore config to xml |
||
211 | * |
||
212 | * @param string $sStoreCode |
||
213 | * @return void |
||
214 | */ |
||
215 | protected function addConsumerscore($sStoreCode) |
||
216 | { |
||
217 | $this->writeToXml('<consumerscore>', 3); |
||
218 | $this->writeNode("active", $this->configExportHelper->getConfigParam('enabled', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
219 | $this->writeNode("mode", $this->configExportHelper->getConfigParam('mode', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
220 | $this->writeNode("integration_event", $this->configExportHelper->getConfigParam('integration_event', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
221 | $this->writeNode("enabled_for_payment_methods", $this->configExportHelper->getConfigParam('enabled_for_payment_methods', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
222 | $this->writeNode("payment_hint_enabled", $this->configExportHelper->getConfigParam('payment_hint_enabled', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
223 | $this->writeNode("payment_hint_text", $this->configExportHelper->getConfigParam('payment_hint_text', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
224 | $this->writeNode("agreement_enabled", $this->configExportHelper->getConfigParam('agreement_enabled', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
225 | $this->writeNode("agreement_message", $this->configExportHelper->getConfigParam('agreement_message', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
226 | $this->writeNode("min_order_total", $this->configExportHelper->getConfigParam('min_order_total', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
227 | $this->writeNode("max_order_total", $this->configExportHelper->getConfigParam('max_order_total', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
228 | $this->writeNode("consumerscoretype", $this->configExportHelper->getConfigParam('type', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
229 | $this->writeNode("addresschecktype", $this->configExportHelper->getConfigParam('addresscheck', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
230 | $this->writeNode("score_when_unknown", $this->configExportHelper->getConfigParam('unknown_value', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
231 | $this->writeNode("red", $this->configExportHelper->getConfigParam('allow_payment_methods_red', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
232 | $this->writeNode("yellow", $this->configExportHelper->getConfigParam('allow_payment_methods_yellow', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
233 | $this->writeNode("duetime", $this->configExportHelper->getConfigParam('result_lifetime', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
234 | $this->writeNode("sample_mode_enabled", $this->configExportHelper->getConfigParam('sample_mode_enabled', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
235 | $this->writeNode("sample_mode_frequency", $this->configExportHelper->getConfigParam('sample_mode_frequency', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
236 | $this->writeNode("handle_response_error", $this->configExportHelper->getConfigParam('handle_response_error', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
237 | $this->writeNode("stop_checkout_message", $this->configExportHelper->getConfigParam('stop_checkout_message', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
238 | $this->writeNode("insufficient_score_message", $this->configExportHelper->getConfigParam('insufficient_score_message', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
239 | $this->writeNode("result_lifetime", $this->configExportHelper->getConfigParam('result_lifetime', 'creditrating', 'payone_protect', $sStoreCode), 4); |
||
240 | $this->writeToXml('</consumerscore>', 3); |
||
241 | } |
||
242 | |||
243 | /** |
||
244 | * Add shop protect config to xml |
||
245 | * |
||
246 | * @param string $sStoreCode |
||
247 | * @return void |
||
248 | */ |
||
249 | protected function addProtectConfig($sStoreCode) |
||
250 | { |
||
251 | $this->writeToXml('<protect>', 2); |
||
252 | $this->addAddresscheckConfig($sStoreCode); |
||
253 | $this->addConsumerscore($sStoreCode); |
||
254 | $this->writeToXml('</protect>', 2); |
||
255 | } |
||
256 | |||
257 | /** |
||
258 | * Add shop misc config to xml |
||
259 | * |
||
260 | * @param string $sStoreCode |
||
261 | * @return void |
||
262 | */ |
||
263 | protected function addShopMiscConfig($sStoreCode) |
||
264 | { |
||
265 | $this->writeToXml('<misc>', 2); |
||
266 | $this->writeToXml('<transactionstatus_forwarding>', 3); |
||
267 | foreach ($this->configExportHelper->getForwardings($sStoreCode) as $aForward) { |
||
268 | $this->writeToXml('<config status="'.$aForward['status'].'" url="'.htmlentities($aForward['url']).'" timeout="'.$aForward['timeout'].'"/>', 4); |
||
269 | } |
||
270 | $this->writeToXml('</transactionstatus_forwarding>', 3); |
||
271 | $this->writeToXml('<shipping_costs>', 3); |
||
272 | $this->writeNode("sku", $this->configExportHelper->getConfigParam('sku', 'costs', 'payone_misc', $sStoreCode), 4); |
||
273 | $this->writeToXml('</shipping_costs>', 3); |
||
274 | $this->writeToXml('</misc>', 2); |
||
275 | } |
||
276 | |||
277 | /** |
||
278 | * Write single shop config to xml |
||
279 | * |
||
280 | * @param string $sStoreCode |
||
281 | * @param StoreInterface $oStore |
||
282 | * @return void |
||
283 | */ |
||
284 | protected function addSingleShopConfig($sStoreCode, StoreInterface $oStore) |
||
285 | { |
||
286 | $this->writeToXml('<shop>', 1); |
||
287 | $this->writeNode("code", $sStoreCode, 2); |
||
288 | $this->writeToXml("<name><![CDATA[{$oStore->getName()}]]></name>", 2); |
||
289 | $this->addShopSystemConfig(); |
||
290 | $this->addShopGlobalConfig($sStoreCode); |
||
291 | $this->addShopClearingtypeConfig($sStoreCode); |
||
292 | $this->addProtectConfig($sStoreCode); |
||
293 | $this->addShopMiscConfig($sStoreCode); |
||
294 | $this->writeToXml('</shop>', 1); |
||
295 | } |
||
296 | |||
297 | /** |
||
298 | * Get all stores and write the config xml entries for each shop to the xml |
||
299 | * |
||
300 | * @return void |
||
301 | */ |
||
302 | protected function addShopConfigs() |
||
303 | { |
||
304 | $aShopIds = $this->storeManager->getStores(false, true); |
||
305 | foreach ($aShopIds as $sStoreCode => $oStore) { |
||
306 | $this->addSingleShopConfig($sStoreCode, $oStore); |
||
307 | } |
||
308 | } |
||
309 | |||
310 | /** |
||
311 | * Generates the content of the configuration export xml |
||
312 | * |
||
313 | * @return string |
||
314 | */ |
||
315 | public function generateConfigExportXml() |
||
316 | { |
||
317 | $this->writeToXml('<?xml version="1.0" encoding="UTF-8"?>'); |
||
318 | $this->writeToXml('<config>'); |
||
319 | $this->addShopConfigs(); |
||
320 | $this->writeToXml('</config>'); |
||
321 | return $this->getXmlContent(); |
||
322 | } |
||
323 | } |
||
324 |
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