@@ -116,20 +116,20 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function sendRequest(PayoneMethod $oPayment, Order $oOrder, $dAmount) |
118 | 118 | { |
119 | - $this->setOrderId($oOrder->getRealOrderId());// save order id to object for later use |
|
119 | + $this->setOrderId($oOrder->getRealOrderId()); // save order id to object for later use |
|
120 | 120 | |
121 | - $this->addParameter('request', $oPayment->getAuthorizationMode());// add request type |
|
122 | - $this->addParameter('mode', $oPayment->getOperationMode());// add mode ( live or test ) |
|
123 | - $this->addParameter('customerid', $oOrder->getCustomerId());// add customer id |
|
124 | - $this->addParameter('aid', $this->shopHelper->getConfigParam('aid'));// add sub account id |
|
125 | - $this->setAuthorizationParameters($oPayment, $oOrder, $dAmount);// set authorization params |
|
121 | + $this->addParameter('request', $oPayment->getAuthorizationMode()); // add request type |
|
122 | + $this->addParameter('mode', $oPayment->getOperationMode()); // add mode ( live or test ) |
|
123 | + $this->addParameter('customerid', $oOrder->getCustomerId()); // add customer id |
|
124 | + $this->addParameter('aid', $this->shopHelper->getConfigParam('aid')); // add sub account id |
|
125 | + $this->setAuthorizationParameters($oPayment, $oOrder, $dAmount); // set authorization params |
|
126 | 126 | if ($oPayment->hasCustomConfig()) {// if payment type doesnt use the global settings |
127 | - $this->addCustomParameters($oPayment);// add custom connection settings |
|
127 | + $this->addCustomParameters($oPayment); // add custom connection settings |
|
128 | 128 | } |
129 | 129 | |
130 | - $aResponse = $this->send();// send request to PAYONE Server API |
|
130 | + $aResponse = $this->send(); // send request to PAYONE Server API |
|
131 | 131 | |
132 | - $this->apiHelper->addPayoneOrderData($oOrder, $this->getParameters(), $aResponse);// add payone data to order |
|
132 | + $this->apiHelper->addPayoneOrderData($oOrder, $this->getParameters(), $aResponse); // add payone data to order |
|
133 | 133 | |
134 | 134 | return $aResponse; |
135 | 135 | } |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function setUserParameters(PayoneMethod $oPayment, Order $oOrder) |
145 | 145 | { |
146 | - $oQuote = $this->checkoutSession->getQuote();// get quote from session |
|
147 | - $oCustomer = $oQuote->getCustomer();// get customer object from quote |
|
146 | + $oQuote = $this->checkoutSession->getQuote(); // get quote from session |
|
147 | + $oCustomer = $oQuote->getCustomer(); // get customer object from quote |
|
148 | 148 | $this->addUserDataParameters($oOrder->getBillingAddress(), $oPayment, $oCustomer->getGender(), $oOrder->getCustomerEmail(), $oCustomer->getDob()); |
149 | 149 | |
150 | 150 | $oShipping = $oOrder->getShippingAddress(); // get shipping address from order |
151 | 151 | if ($oShipping) {// shipping address existing? |
152 | - $this->addAddress($oShipping, true);// add regular shipping address |
|
152 | + $this->addAddress($oShipping, true); // add regular shipping address |
|
153 | 153 | } elseif ($oPayment->getCode() == PayoneConfig::METHOD_PAYPAL && $this->shopHelper->getConfigParam('bill_as_del_address', PayoneConfig::METHOD_PAYPAL, 'payone_payment')) { |
154 | - $this->addAddress($oOrder->getBillingAddress(), true);// add billing address as shipping address |
|
154 | + $this->addAddress($oOrder->getBillingAddress(), true); // add billing address as shipping address |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
@@ -165,22 +165,22 @@ discard block |
||
165 | 165 | */ |
166 | 166 | protected function setAuthorizationParameters(PayoneMethod $oPayment, Order $oOrder, $dAmount) |
167 | 167 | { |
168 | - $sRefNr = $this->shopHelper->getConfigParam('ref_prefix').$oOrder->getIncrementId();// ref_prefix to prevent duplicate refnumbers in testing environments |
|
169 | - $sRefNr = $oPayment->formatReferenceNumber($sRefNr);// some payment methods have refnr regulations |
|
170 | - $this->addParameter('reference', $sRefNr);// add ref-nr to request |
|
171 | - $this->addParameter('amount', number_format($dAmount, 2, '.', '')*100);// add price to request |
|
172 | - $this->addParameter('currency', $oOrder->getOrderCurrencyCode());// add currency to request |
|
168 | + $sRefNr = $this->shopHelper->getConfigParam('ref_prefix').$oOrder->getIncrementId(); // ref_prefix to prevent duplicate refnumbers in testing environments |
|
169 | + $sRefNr = $oPayment->formatReferenceNumber($sRefNr); // some payment methods have refnr regulations |
|
170 | + $this->addParameter('reference', $sRefNr); // add ref-nr to request |
|
171 | + $this->addParameter('amount', number_format($dAmount, 2, '.', '') * 100); // add price to request |
|
172 | + $this->addParameter('currency', $oOrder->getOrderCurrencyCode()); // add currency to request |
|
173 | 173 | if ($this->shopHelper->getConfigParam('transmit_ip') == '1') {// is IP transmission needed? |
174 | - $sIp = $this->environmentHelper->getRemoteIp();// get remote IP |
|
174 | + $sIp = $this->environmentHelper->getRemoteIp(); // get remote IP |
|
175 | 175 | if ($sIp != '') {// is IP not empty |
176 | - $this->addParameter('ip', $sIp);// add IP address to the request |
|
176 | + $this->addParameter('ip', $sIp); // add IP address to the request |
|
177 | 177 | } |
178 | 178 | } |
179 | - $this->setUserParameters($oPayment, $oOrder);// add user data - addresses etc. |
|
180 | - $this->setPaymentParameters($oPayment, $oOrder);// add payment specific parameters |
|
179 | + $this->setUserParameters($oPayment, $oOrder); // add user data - addresses etc. |
|
180 | + $this->setPaymentParameters($oPayment, $oOrder); // add payment specific parameters |
|
181 | 181 | |
182 | 182 | if ($this->apiHelper->isInvoiceDataNeeded($oPayment)) {// |
183 | - $this->invoiceGenerator->addProductInfo($this, $oOrder);// add invoice parameters |
|
183 | + $this->invoiceGenerator->addProductInfo($this, $oOrder); // add invoice parameters |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | */ |
194 | 194 | protected function setPaymentParameters(PayoneMethod $oPayment, Order $oOrder) |
195 | 195 | { |
196 | - $this->addParameter('clearingtype', $oPayment->getClearingtype());// add payment type to request |
|
196 | + $this->addParameter('clearingtype', $oPayment->getClearingtype()); // add payment type to request |
|
197 | 197 | $sNarrativeText = $this->toolkitHelper->getNarrativeText($oOrder, $oPayment); |
198 | 198 | if (!empty($sNarrativeText)) {// narrative text existing? |
199 | - $this->addParameter('narrative_text', $sNarrativeText);// add narrative text parameter |
|
199 | + $this->addParameter('narrative_text', $sNarrativeText); // add narrative text parameter |
|
200 | 200 | } |
201 | - $aPaymentParams = $oPayment->getPaymentSpecificParameters($oOrder);// get payment params specific to the payment type |
|
202 | - $this->aParameters = array_merge($this->aParameters, $aPaymentParams);// merge payment params with other params |
|
201 | + $aPaymentParams = $oPayment->getPaymentSpecificParameters($oOrder); // get payment params specific to the payment type |
|
202 | + $this->aParameters = array_merge($this->aParameters, $aPaymentParams); // merge payment params with other params |
|
203 | 203 | if ($oPayment->needsRedirectUrls() === true) {// does the used payment type need redirect urls? |
204 | - $this->addRedirectUrls($oPayment);// add needed redirect urls |
|
204 | + $this->addRedirectUrls($oPayment); // add needed redirect urls |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | protected function addCustomParameters(PayoneMethod $oPayment) |
215 | 215 | { |
216 | 216 | foreach ($this->aCustomParamMap as $sParamName => $sConfigName) {// add all custom parameters |
217 | - $sCustomConfig = $oPayment->getCustomConfigParam($sConfigName);// get custom config param |
|
217 | + $sCustomConfig = $oPayment->getCustomConfigParam($sConfigName); // get custom config param |
|
218 | 218 | if (!empty($sCustomConfig)) {// only add if the param is configured |
219 | - $this->addParameter($sParamName, $sCustomConfig);// add custom param to request |
|
219 | + $this->addParameter($sParamName, $sCustomConfig); // add custom param to request |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | } |
@@ -79,12 +79,12 @@ |
||
79 | 79 | $this->setOrderId($oOrder->getRealOrderId()); |
80 | 80 | |
81 | 81 | $this->addParameter('request', 'capture'); // Request method |
82 | - $this->addParameter('mode', $oPayment->getOperationMode());// PayOne Portal Operation Mode (live or test) |
|
82 | + $this->addParameter('mode', $oPayment->getOperationMode()); // PayOne Portal Operation Mode (live or test) |
|
83 | 83 | $this->addParameter('language', Locale::getPrimaryLanguage(Locale::getDefault())); |
84 | 84 | |
85 | 85 | // Total order sum in smallest currency unit |
86 | - $this->addParameter('amount', number_format($dAmount, 2, '.', '')*100); |
|
87 | - $this->addParameter('currency', $oOrder->getOrderCurrencyCode());// Currency |
|
86 | + $this->addParameter('amount', number_format($dAmount, 2, '.', '') * 100); |
|
87 | + $this->addParameter('currency', $oOrder->getOrderCurrencyCode()); // Currency |
|
88 | 88 | |
89 | 89 | $this->addParameter('txid', $iTxid); // PayOne Transaction ID |
90 | 90 | $this->addParameter('sequencenumber', $this->databaseHelper->getSequenceNumber($iTxid)); |
@@ -48,10 +48,10 @@ |
||
48 | 48 | { |
49 | 49 | $this->addParameter('request', 'genericpayment'); |
50 | 50 | $this->addParameter('mode', $oPayment->getOperationMode()); |
51 | - $this->addParameter('aid', $this->shopHelper->getConfigParam('aid'));// ID of PayOne Sub-Account |
|
51 | + $this->addParameter('aid', $this->shopHelper->getConfigParam('aid')); // ID of PayOne Sub-Account |
|
52 | 52 | $this->addParameter('clearingtype', 'wlt'); |
53 | 53 | $this->addParameter('wallettype', 'PPE'); |
54 | - $this->addParameter('amount', number_format($oQuote->getGrandTotal(), 2, '.', '')*100); |
|
54 | + $this->addParameter('amount', number_format($oQuote->getGrandTotal(), 2, '.', '') * 100); |
|
55 | 55 | $this->addParameter('currency', $oQuote->getQuoteCurrencyCode()); |
56 | 56 | $this->addParameter('narrative_text', 'Test'); |
57 | 57 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $sPre = ''; |
79 | 79 | if ($blIsShipping === true) { |
80 | - $sPre = 'shipping_';// add shipping prefix for shipping addresses |
|
80 | + $sPre = 'shipping_'; // add shipping prefix for shipping addresses |
|
81 | 81 | } |
82 | 82 | $this->addParameter($sPre.'firstname', $oAddress->getFirstname()); |
83 | 83 | $this->addParameter($sPre.'lastname', $oAddress->getLastname()); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $aStreet = $oAddress->getStreet(); |
89 | - $sStreet = is_array($aStreet) ? implode(' ', $aStreet) : $aStreet;// street may be an array |
|
89 | + $sStreet = is_array($aStreet) ? implode(' ', $aStreet) : $aStreet; // street may be an array |
|
90 | 90 | $this->addParameter($sPre.'street', trim($sStreet)); |
91 | 91 | $this->addParameter($sPre.'zip', $oAddress->getPostcode()); |
92 | 92 | $this->addParameter($sPre.'city', $oAddress->getCity()); |
@@ -77,8 +77,8 @@ |
||
77 | 77 | $oCustomer = $oQuote->getCustomer(); |
78 | 78 | |
79 | 79 | $this->addParameter('request', 'managemandate'); // Request method |
80 | - $this->addParameter('mode', $oPayment->getOperationMode());// PayOne Portal Operation Mode (live or test) |
|
81 | - $this->addParameter('aid', $this->shopHelper->getConfigParam('aid'));// ID of PayOne Sub-Account |
|
80 | + $this->addParameter('mode', $oPayment->getOperationMode()); // PayOne Portal Operation Mode (live or test) |
|
81 | + $this->addParameter('aid', $this->shopHelper->getConfigParam('aid')); // ID of PayOne Sub-Account |
|
82 | 82 | $this->addParameter('clearingtype', 'elv'); |
83 | 83 | |
84 | 84 | $this->addParameter('customerid', $oCustomer->getId()); |
@@ -65,7 +65,7 @@ |
||
65 | 65 | 'content' => http_build_query($this->aParameters), |
66 | 66 | ], |
67 | 67 | ]; |
68 | - $oContext = stream_context_create($aOptions); |
|
68 | + $oContext = stream_context_create($aOptions); |
|
69 | 69 | $sMandate = file_get_contents($this->sApiUrl, false, $oContext); |
70 | 70 | if ($sMandate !== false) { |
71 | 71 | $sReturn = $sMandate; |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | */ |
121 | 121 | protected function initRequest() |
122 | 122 | { |
123 | - $this->addParameter('mid', $this->shopHelper->getConfigParam('mid'));// PayOne Merchant ID |
|
124 | - $this->addParameter('portalid', $this->shopHelper->getConfigParam('portalid'));// PayOne Portal ID |
|
125 | - $this->addParameter('key', md5($this->shopHelper->getConfigParam('key')));// PayOne Portal Key |
|
126 | - $this->addParameter('encoding', $this->environmentHelper->getEncoding());// Encoding |
|
127 | - $this->addParameter('integrator_name', 'Magento2');// Shop-system |
|
128 | - $this->addParameter('integrator_version', $this->shopHelper->getMagentoVersion());// Shop version |
|
129 | - $this->addParameter('solution_name', 'fatchip');// Company developing the module |
|
130 | - $this->addParameter('solution_version', PayoneConfig::MODULE_VERSION);// Module version |
|
123 | + $this->addParameter('mid', $this->shopHelper->getConfigParam('mid')); // PayOne Merchant ID |
|
124 | + $this->addParameter('portalid', $this->shopHelper->getConfigParam('portalid')); // PayOne Portal ID |
|
125 | + $this->addParameter('key', md5($this->shopHelper->getConfigParam('key'))); // PayOne Portal Key |
|
126 | + $this->addParameter('encoding', $this->environmentHelper->getEncoding()); // Encoding |
|
127 | + $this->addParameter('integrator_name', 'Magento2'); // Shop-system |
|
128 | + $this->addParameter('integrator_version', $this->shopHelper->getMagentoVersion()); // Shop version |
|
129 | + $this->addParameter('solution_name', 'fatchip'); // Company developing the module |
|
130 | + $this->addParameter('solution_version', PayoneConfig::MODULE_VERSION); // Module version |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function addParameter($sKey, $sValue, $blAddAsNullIfEmpty = false) |
142 | 142 | { |
143 | 143 | if ($blAddAsNullIfEmpty === true && empty($sValue)) { |
144 | - $sValue = 'NULL';// add value as string NULL - needed in certain situations |
|
144 | + $sValue = 'NULL'; // add value as string NULL - needed in certain situations |
|
145 | 145 | } |
146 | 146 | $this->aParameters[$sKey] = $sValue; |
147 | 147 | } |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | return $sRequestUrl; |
252 | 252 | } |
253 | 253 | |
254 | - $aResponse = $this->apiHelper->sendApiRequest($sRequestUrl);// send request to PAYONE |
|
255 | - $this->apiLog->addApiLogEntry($this, $aResponse, $aResponse['status']);// log request to db |
|
254 | + $aResponse = $this->apiHelper->sendApiRequest($sRequestUrl); // send request to PAYONE |
|
255 | + $this->apiLog->addApiLogEntry($this, $aResponse, $aResponse['status']); // log request to db |
|
256 | 256 | return $aResponse; |
257 | 257 | } |
258 | 258 | } |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | */ |
101 | 101 | protected function addInvoicePosition($sId, $dPrice, $sItemType, $iAmount, $sDesc, $dVat) |
102 | 102 | { |
103 | - $this->oRequest->addParameter('id['.$this->iIndex.']', $sId);// add invoice item id |
|
104 | - $this->oRequest->addParameter('pr['.$this->iIndex.']', $this->toolkitHelper->formatNumber($dPrice) * 100);// expected in smallest unit of currency |
|
105 | - $this->oRequest->addParameter('it['.$this->iIndex.']', $sItemType);// add invoice item type |
|
106 | - $this->oRequest->addParameter('no['.$this->iIndex.']', $iAmount);// add invoice item amount |
|
107 | - $this->oRequest->addParameter('de['.$this->iIndex.']', $sDesc);// add invoice item description |
|
108 | - $this->oRequest->addParameter('va['.$this->iIndex.']', $this->toolkitHelper->formatNumber($dVat * 100, 0));// expected * 100 to also handle vats with decimals |
|
109 | - $this->dAmount += $dPrice * $iAmount;// needed for return of the main method |
|
110 | - $this->iIndex++;// increase index for next item |
|
103 | + $this->oRequest->addParameter('id['.$this->iIndex.']', $sId); // add invoice item id |
|
104 | + $this->oRequest->addParameter('pr['.$this->iIndex.']', $this->toolkitHelper->formatNumber($dPrice) * 100); // expected in smallest unit of currency |
|
105 | + $this->oRequest->addParameter('it['.$this->iIndex.']', $sItemType); // add invoice item type |
|
106 | + $this->oRequest->addParameter('no['.$this->iIndex.']', $iAmount); // add invoice item amount |
|
107 | + $this->oRequest->addParameter('de['.$this->iIndex.']', $sDesc); // add invoice item description |
|
108 | + $this->oRequest->addParameter('va['.$this->iIndex.']', $this->toolkitHelper->formatNumber($dVat * 100, 0)); // expected * 100 to also handle vats with decimals |
|
109 | + $this->dAmount += $dPrice * $iAmount; // needed for return of the main method |
|
110 | + $this->iIndex++; // increase index for next item |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function addProductInfo(Base $oRequest, Order $oOrder, $aPositions = false, $blDebit = false) |
123 | 123 | { |
124 | - $this->oRequest = $oRequest;// write request to property for manipulation of the object |
|
125 | - $sInvoiceAppendix = $this->toolkitHelper->getInvoiceAppendix($oOrder);// get invoice appendix |
|
124 | + $this->oRequest = $oRequest; // write request to property for manipulation of the object |
|
125 | + $sInvoiceAppendix = $this->toolkitHelper->getInvoiceAppendix($oOrder); // get invoice appendix |
|
126 | 126 | if (!empty($sInvoiceAppendix)) {// invoice appendix existing? |
127 | - $this->oRequest->addParameter('invoiceappendix', $sInvoiceAppendix);// add appendix to request |
|
127 | + $this->oRequest->addParameter('invoiceappendix', $sInvoiceAppendix); // add appendix to request |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | foreach ($oOrder->getAllItems() as $oItem) {// add invoice items for all order items |
131 | - $this->addProductItem($oItem, $aPositions);// add product invoice params to request |
|
131 | + $this->addProductItem($oItem, $aPositions); // add product invoice params to request |
|
132 | 132 | } |
133 | 133 | |
134 | - $blFirstCapture = true;// Is first capture? |
|
134 | + $blFirstCapture = true; // Is first capture? |
|
135 | 135 | if ($aPositions === false || $blFirstCapture === true || $blDebit === true) { |
136 | - $this->addShippingItem($oOrder, $aPositions, $blDebit);// add shipping invoice params to request |
|
137 | - $this->addDiscountItem($oOrder, $aPositions, $blDebit);// add discount invoice params to request |
|
136 | + $this->addShippingItem($oOrder, $aPositions, $blDebit); // add shipping invoice params to request |
|
137 | + $this->addDiscountItem($oOrder, $aPositions, $blDebit); // add discount invoice params to request |
|
138 | 138 | } |
139 | 139 | return $this->dAmount; |
140 | 140 | } |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | protected function addProductItem($oItem, $aPositions) |
150 | 150 | { |
151 | 151 | if ($aPositions === false || array_key_exists($oItem->getProductId(), $aPositions) !== false) {// full or single-invoice? |
152 | - $dItemAmount = $oItem->getQtyOrdered();// get ordered item amount |
|
152 | + $dItemAmount = $oItem->getQtyOrdered(); // get ordered item amount |
|
153 | 153 | if ($aPositions !== false && array_key_exists($oItem->getProductId(), $aPositions) !== false) {// product existing in single-invoice? |
154 | - $dItemAmount = $aPositions[$oItem->getProductId()]['amount'];// use amount from single-invoice |
|
154 | + $dItemAmount = $aPositions[$oItem->getProductId()]['amount']; // use amount from single-invoice |
|
155 | 155 | } |
156 | - $dBrutPrice = $oItem->getBasePrice() + ($oItem->getBaseTaxAmount() / $oItem->getQtyOrdered());// cals single item price |
|
156 | + $dBrutPrice = $oItem->getBasePrice() + ($oItem->getBaseTaxAmount() / $oItem->getQtyOrdered()); // cals single item price |
|
157 | 157 | $this->addInvoicePosition($oItem->getSku(), $dBrutPrice, 'goods', $dItemAmount, $oItem->getName(), $oItem->getTaxPercent()); |
158 | 158 | if ($this->dTax === false) {// is dTax not set yet? |
159 | - $this->dTax = $oItem->getTaxPercent();// set the tax for following entities which dont have the vat attached to it |
|
159 | + $this->dTax = $oItem->getTaxPercent(); // set the tax for following entities which dont have the vat attached to it |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | { |
174 | 174 | // shipping costs existing or given for partial captures/debits? |
175 | 175 | if ($oOrder->getBaseShippingInclTax() != 0 && ($aPositions === false || ($blDebit === false || array_key_exists('oxdelcost', $aPositions) !== false))) { |
176 | - $sDelDesc = __('Surcharge').' '.__('Shipping Costs');// default description |
|
176 | + $sDelDesc = __('Surcharge').' '.__('Shipping Costs'); // default description |
|
177 | 177 | if ($oOrder->getBaseShippingInclTax() < 0) {// negative shipping cost |
178 | - $sDelDesc = __('Deduction').' '.__('Shipping Costs');// change item description to deduction |
|
178 | + $sDelDesc = __('Deduction').' '.__('Shipping Costs'); // change item description to deduction |
|
179 | 179 | } |
180 | - $sShippingSku = $this->toolkitHelper->getConfigParam('sku', 'costs', 'payone_misc');// get configured shipping SKU |
|
180 | + $sShippingSku = $this->toolkitHelper->getConfigParam('sku', 'costs', 'payone_misc'); // get configured shipping SKU |
|
181 | 181 | $this->addInvoicePosition($sShippingSku, $oOrder->getBaseShippingInclTax(), 'shipment', 1, $sDelDesc, $this->dTax); |
182 | 182 | } |
183 | 183 | } |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | if ($aPositions === false) {// full invoice? |
199 | 199 | // The calculations broken down to single items of Magento2 are unprecise and the Payone API will send an error if |
200 | 200 | // the calculated positions don't match, so we compensate for rounding-problems here |
201 | - $dDiff = ($this->dAmount + $oOrder->getBaseDiscountAmount()) - $oOrder->getGrandTotal();// calc rounding discrepancy |
|
202 | - $dDiscount -= $dDiff;// subtract difference from discount |
|
201 | + $dDiff = ($this->dAmount + $oOrder->getBaseDiscountAmount()) - $oOrder->getGrandTotal(); // calc rounding discrepancy |
|
202 | + $dDiscount -= $dDiff; // subtract difference from discount |
|
203 | 203 | } |
204 | - $sDiscountSku = $this->toolkitHelper->getConfigParam('sku', 'discount', 'payone_misc');// get configured discount SKU |
|
205 | - $sDesc = (string)__('Discount');// default description |
|
204 | + $sDiscountSku = $this->toolkitHelper->getConfigParam('sku', 'discount', 'payone_misc'); // get configured discount SKU |
|
205 | + $sDesc = (string)__('Discount'); // default description |
|
206 | 206 | if ($oOrder->getCouponCode()) {// was a coupon code used? |
207 | - $sDiscountSku = $this->toolkitHelper->getConfigParam('sku', 'voucher', 'payone_misc');// get configured voucher SKU |
|
208 | - $sDesc = (string)__('Coupon').' - '.$oOrder->getCouponCode();// add counpon code to description |
|
207 | + $sDiscountSku = $this->toolkitHelper->getConfigParam('sku', 'voucher', 'payone_misc'); // get configured voucher SKU |
|
208 | + $sDesc = (string)__('Coupon').' - '.$oOrder->getCouponCode(); // add counpon code to description |
|
209 | 209 | } |
210 | - $this->addInvoicePosition($sDiscountSku, $dDiscount, 'voucher', 1, $sDesc, $this->dTax);// add invoice params to request |
|
210 | + $this->addInvoicePosition($sDiscountSku, $dDiscount, 'voucher', 1, $sDesc, $this->dTax); // add invoice params to request |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $sRequest = $this->getData($sKey); |
76 | 76 | if ($sRequest) { |
77 | 77 | if (Toolkit::isUTF8($sRequest)) { |
78 | - $sRequest = utf8_decode($sRequest);// needed for unserializing the array |
|
78 | + $sRequest = utf8_decode($sRequest); // needed for unserializing the array |
|
79 | 79 | } |
80 | 80 | $aRequest = unserialize($sRequest); |
81 | 81 | if (is_array($aRequest)) { |