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 - 2025 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\Methods; |
||
28 | |||
29 | use Payone\Core\Model\PayoneConfig; |
||
30 | use Magento\Sales\Model\Order; |
||
0 ignored issues
–
show
|
|||
31 | use Magento\Framework\DataObject; |
||
0 ignored issues
–
show
The type
Magento\Framework\DataObject 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 ![]() |
|||
32 | |||
33 | /** |
||
34 | * Model for cash on delivery payment method |
||
35 | */ |
||
36 | class GooglePay extends PayoneMethod |
||
37 | { |
||
38 | /** |
||
39 | * Payment method code |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $_code = PayoneConfig::METHOD_GOOGLE_PAY; |
||
44 | |||
45 | /** |
||
46 | * Clearingtype for PAYONE authorization request |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $sClearingtype = 'wlt'; |
||
51 | |||
52 | /** |
||
53 | * Wallettype for PAYONE requests |
||
54 | * |
||
55 | * @var string|bool |
||
56 | */ |
||
57 | protected $sWallettype = 'GGP'; |
||
58 | |||
59 | /** |
||
60 | * Determines if the redirect-parameters have to be added |
||
61 | * to the authorization-request |
||
62 | * |
||
63 | * @var bool |
||
64 | */ |
||
65 | protected $blNeedsRedirectUrls = true; |
||
66 | |||
67 | /** |
||
68 | * Keys that need to be assigned to the additionalinformation fields |
||
69 | * |
||
70 | * @var array |
||
71 | */ |
||
72 | protected $aAssignKeys = [ |
||
73 | 'payment_token', |
||
74 | ]; |
||
75 | |||
76 | /** |
||
77 | * Add the checkout-form-data to the checkout session |
||
78 | * |
||
79 | * @param DataObject $data |
||
80 | * @return $this |
||
81 | */ |
||
82 | public function assignData(DataObject $data) |
||
83 | { |
||
84 | $mParentReturn = parent::assignData($data); |
||
85 | |||
86 | $oInfoInstance = $this->getInfoInstance(); |
||
87 | foreach ($this->aAssignKeys as $sKey) { |
||
88 | $sData = $this->toolkitHelper->getAdditionalDataEntry($data, $sKey); |
||
89 | if ($sData) { |
||
90 | $oInfoInstance->setAdditionalInformation($sKey, $sData); |
||
91 | } |
||
92 | } |
||
93 | |||
94 | return $mParentReturn; |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * Return store name from general config |
||
99 | * |
||
100 | * @return string|null |
||
101 | */ |
||
102 | protected function getGeneralConfigStoreName() |
||
103 | { |
||
104 | $oQuote = $this->checkoutSession->getQuote(); |
||
105 | if (!empty($oQuote)) { |
||
106 | $oStore = $oQuote->getStore(); |
||
107 | if (!empty($oStore)) { |
||
108 | return $oStore->getFrontendName(); |
||
109 | } |
||
110 | } |
||
111 | return null; |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * Return store name for Google Pay JS |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | protected function getStoreName() |
||
120 | { |
||
121 | $sStoreName = $this->shopHelper->getConfigParam('store_name', PayoneConfig::METHOD_GOOGLE_PAY, 'payment'); |
||
122 | if (empty($sStoreName)) { |
||
123 | $sStoreName = $this->getGeneralConfigStoreName(); |
||
124 | } |
||
125 | if (empty($sStoreName)) { |
||
126 | $sStoreName = 'Online Store'; // default |
||
127 | } |
||
128 | return $sStoreName; |
||
129 | } |
||
130 | |||
131 | /** |
||
132 | * @return string |
||
133 | */ |
||
134 | protected function getMerchantId() |
||
135 | { |
||
136 | $sMid = $this->shopHelper->getConfigParam('mid'); |
||
137 | $sCustomMid = $this->getCustomConfigParam('mid'); |
||
138 | if ($this->hasCustomConfig() && !empty($sCustomMid)) { |
||
139 | $sMid = $sCustomMid; |
||
140 | } |
||
141 | return $sMid; |
||
142 | } |
||
143 | |||
144 | /** |
||
145 | * @return array |
||
146 | */ |
||
147 | public function getFrontendConfig() |
||
148 | { |
||
149 | return [ |
||
150 | 'merchantId' => $this->getMerchantId(), |
||
151 | 'storeName' => $this->getStoreName(), |
||
152 | 'googlePayMerchantId' => $this->shopHelper->getConfigParam('google_pay_merchant_id', PayoneConfig::METHOD_GOOGLE_PAY, 'payment'), |
||
153 | 'operationMode' => $this->getOperationMode(), |
||
154 | ]; |
||
155 | } |
||
156 | |||
157 | /** |
||
158 | * Return parameters specific to this payment type |
||
159 | * |
||
160 | * @param Order $oOrder |
||
161 | * @return array |
||
162 | */ |
||
163 | public function getPaymentSpecificParameters(Order $oOrder) |
||
164 | { |
||
165 | return [ |
||
166 | 'wallettype' => $this->getWallettype(), |
||
167 | 'api_version' => '3.11', |
||
168 | 'add_paydata[paymentmethod_token_data]' => base64_encode($this->getInfoInstance()->getAdditionalInformation('payment_token')), |
||
169 | ]; |
||
170 | } |
||
171 | } |
||
172 |
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