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\Model\Ui; |
||||
10 | |||||
11 | use Magento\Checkout\Model\ConfigProviderInterface; |
||||
0 ignored issues
–
show
|
|||||
12 | use Magento\Framework\View\Asset\Source; |
||||
0 ignored issues
–
show
The type
Magento\Framework\View\Asset\Source 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\Payment\Model\CcConfig; |
||||
0 ignored issues
–
show
The type
Magento\Payment\Model\CcConfig 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 | use Magento\Quote\Api\Data\CartInterface; |
||||
0 ignored issues
–
show
The type
Magento\Quote\Api\Data\CartInterface 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 ![]() |
|||||
15 | use Moip\Magento2\Gateway\Config\Config as ConfigBase; |
||||
16 | use Moip\Magento2\Gateway\Config\ConfigCc; |
||||
17 | |||||
18 | /** |
||||
19 | * Class ConfigProviderCc - Defines properties of the payment form.. |
||||
20 | */ |
||||
21 | class ConfigProviderCc implements ConfigProviderInterface |
||||
22 | { |
||||
23 | /* |
||||
24 | * @var CODE |
||||
25 | */ |
||||
26 | const CODE = 'moip_magento2_cc'; |
||||
27 | |||||
28 | /* |
||||
29 | * @var VAULT CODE |
||||
30 | */ |
||||
31 | const VAULT_CODE = 'moip_magento2_cc_vault'; |
||||
32 | |||||
33 | /** |
||||
34 | * @var Config Base |
||||
35 | */ |
||||
36 | private $configBase; |
||||
37 | |||||
38 | /** |
||||
39 | * @var Config |
||||
40 | */ |
||||
41 | private $config; |
||||
42 | |||||
43 | /** |
||||
44 | * @var CartInterface |
||||
45 | */ |
||||
46 | private $cart; |
||||
47 | |||||
48 | /** |
||||
49 | * @var array |
||||
50 | */ |
||||
51 | private $icons = []; |
||||
52 | |||||
53 | /** |
||||
54 | * @var CcConfig |
||||
55 | */ |
||||
56 | protected $ccConfig; |
||||
57 | |||||
58 | /** |
||||
59 | * @var \Magento\Framework\View\Asset\Source |
||||
60 | */ |
||||
61 | protected $assetSource; |
||||
62 | |||||
63 | /** |
||||
64 | * @param Config $config |
||||
65 | * @param CartInterface $cart |
||||
66 | */ |
||||
67 | public function __construct( |
||||
68 | ConfigBase $configBase, |
||||
69 | ConfigCc $config, |
||||
70 | CartInterface $cart, |
||||
71 | CcConfig $ccConfig, |
||||
72 | Source $assetSource |
||||
73 | ) { |
||||
74 | $this->configBase = $configBase; |
||||
75 | $this->config = $config; |
||||
76 | $this->cart = $cart; |
||||
77 | $this->ccConfig = $ccConfig; |
||||
78 | $this->assetSource = $assetSource; |
||||
79 | } |
||||
80 | |||||
81 | /** |
||||
82 | * Retrieve assoc array of checkout configuration. |
||||
83 | * |
||||
84 | * @return array |
||||
85 | */ |
||||
86 | public function getConfig() |
||||
87 | { |
||||
88 | $storeId = $this->cart->getStoreId(); |
||||
89 | |||||
90 | return [ |
||||
91 | 'payment' => [ |
||||
92 | ConfigCc::METHOD => [ |
||||
93 | 'public_key' => $this->configBase->getMerchantGatewayKeyPublic($storeId), |
||||
94 | 'isActive' => $this->config->isActive($storeId), |
||||
95 | 'title' => $this->config->getTitle($storeId), |
||||
96 | 'useCvv' => $this->config->isCvvEnabled($storeId), |
||||
97 | 'ccTypesMapper' => $this->config->getCcTypesMapper($storeId), |
||||
98 | 'logo' => $this->getLogo(), |
||||
99 | 'icons' => $this->getIcons(), |
||||
100 | 'tax_document_capture' => $this->config->getUseTaxDocumentCapture($storeId), |
||||
101 | 'birth_date_capture' => $this->config->getUseBirthDateCapture($storeId), |
||||
102 | 'phone_capture' => $this->config->getUsePhoneCapture($storeId), |
||||
103 | 'type_interest' => $this->config->getTypeInstallment($storeId), |
||||
104 | 'info_interest' => $this->config->getInfoInterest($storeId), |
||||
105 | 'min_installment' => $this->config->getMinInstallment($storeId), |
||||
106 | 'max_installment' => $this->config->getMaxInstallment($storeId), |
||||
107 | 'ccVaultCode' => self::VAULT_CODE, |
||||
108 | ], |
||||
109 | ], |
||||
110 | ]; |
||||
111 | } |
||||
112 | |||||
113 | /** |
||||
114 | * Get icons for available payment methods. |
||||
115 | * |
||||
116 | * @return array |
||||
117 | */ |
||||
118 | public function getIcons() |
||||
119 | { |
||||
120 | if (!empty($this->icons)) { |
||||
121 | return $this->icons; |
||||
122 | } |
||||
123 | $storeId = $this->cart->getStoreId(); |
||||
124 | $ccTypes = $this->config->getCcAvailableTypes($storeId); |
||||
125 | $types = explode(',', $ccTypes); |
||||
126 | foreach ($types as $code => $label) { |
||||
127 | if (!array_key_exists($code, $this->icons)) { |
||||
128 | $asset = $this->ccConfig->createAsset('Moip_Magento2::images/cc/'.strtolower($label).'.svg'); |
||||
129 | $placeholder = $this->assetSource->findSource($asset); |
||||
130 | if ($placeholder) { |
||||
131 | list($width, $height) = getimagesizefromstring($asset->getSourceFile()); |
||||
132 | $this->icons[$label] = [ |
||||
133 | 'url' => $asset->getUrl(), |
||||
134 | 'width' => $width, |
||||
135 | 'height' => $height, |
||||
136 | 'title' => __($label), |
||||
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
137 | ]; |
||||
138 | } |
||||
139 | } |
||||
140 | } |
||||
141 | |||||
142 | return $this->icons; |
||||
143 | } |
||||
144 | |||||
145 | /** |
||||
146 | * Get Cvv. |
||||
147 | * |
||||
148 | * @return array |
||||
149 | */ |
||||
150 | public function getImageCvv() |
||||
151 | { |
||||
152 | $imageCvv = null; |
||||
153 | $asset = $this->ccConfig->createAsset('Moip_Magento2::images/cc/cvv.gif'); |
||||
154 | $placeholder = $this->assetSource->findSource($asset); |
||||
155 | if ($placeholder) { |
||||
156 | $imageCvv = $asset->getUrl(); |
||||
157 | } |
||||
158 | |||||
159 | return $imageCvv; |
||||
160 | } |
||||
161 | |||||
162 | /** |
||||
163 | * Get icons for available payment methods. |
||||
164 | * |
||||
165 | * @return array |
||||
166 | */ |
||||
167 | public function getLogo() |
||||
168 | { |
||||
169 | $logo = []; |
||||
170 | $asset = $this->ccConfig->createAsset('Moip_Magento2::images/cc/credit-card.svg'); |
||||
171 | $placeholder = $this->assetSource->findSource($asset); |
||||
172 | if ($placeholder) { |
||||
173 | list($width, $height) = getimagesizefromstring($asset->getSourceFile()); |
||||
174 | $logo = [ |
||||
175 | 'url' => $asset->getUrl(), |
||||
176 | 'width' => $width, |
||||
177 | 'height' => $height, |
||||
178 | 'title' => __('Wirecard'), |
||||
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
179 | ]; |
||||
180 | } |
||||
181 | |||||
182 | return $logo; |
||||
183 | } |
||||
184 | } |
||||
185 |
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