@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | protected function sendPayoneAuthorization(InfoInterface $payment, $amount) |
112 | 112 | { |
113 | 113 | $oOrder = $payment->getOrder(); |
114 | - $this->checkoutSession->unsPayoneRedirectUrl();// remove redirect url from session |
|
114 | + $this->checkoutSession->unsPayoneRedirectUrl(); // remove redirect url from session |
|
115 | 115 | $aResponse = $this->authorizationRequest->sendRequest($this, $oOrder, $amount); |
116 | 116 | $this->handleResponse($aResponse); |
117 | 117 | if ($aResponse['status'] == 'ERROR') {// request returned an error |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function getPaymentSpecificParameters(Order $oOrder) |
156 | 156 | { |
157 | - return [];// filled in child classes |
|
157 | + return []; // filled in child classes |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function getSubTypeSpecificParameters(Order $oOrder) |
274 | 274 | { |
275 | - return [];// filled in child classes |
|
275 | + return []; // filled in child classes |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -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,22 +121,22 @@ 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 | 131 | if ($oItem->isDummy() === false) {// prevent variant-products of adding 2 items |
132 | - $this->addProductItem($oItem, $aPositions);// add product invoice params to request |
|
132 | + $this->addProductItem($oItem, $aPositions); // add product invoice params to request |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - $blFirstCapture = true;// Is first capture? |
|
136 | + $blFirstCapture = true; // Is first capture? |
|
137 | 137 | if ($aPositions === false || $blFirstCapture === true || $blDebit === true) { |
138 | - $this->addShippingItem($oOrder, $aPositions, $blDebit);// add shipping invoice params to request |
|
139 | - $this->addDiscountItem($oOrder, $aPositions, $blDebit);// add discount invoice params to request |
|
138 | + $this->addShippingItem($oOrder, $aPositions, $blDebit); // add shipping invoice params to request |
|
139 | + $this->addDiscountItem($oOrder, $aPositions, $blDebit); // add discount invoice params to request |
|
140 | 140 | } |
141 | 141 | return $this->dAmount; |
142 | 142 | } |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | protected function addProductItem($oItem, $aPositions) |
152 | 152 | { |
153 | 153 | if ($aPositions === false || array_key_exists($oItem->getProductId(), $aPositions) !== false) {// full or single-invoice? |
154 | - $dItemAmount = $oItem->getQtyOrdered();// get ordered item amount |
|
154 | + $dItemAmount = $oItem->getQtyOrdered(); // get ordered item amount |
|
155 | 155 | if ($aPositions !== false && array_key_exists($oItem->getProductId(), $aPositions) !== false) {// product existing in single-invoice? |
156 | - $dItemAmount = $aPositions[$oItem->getProductId()]['amount'];// use amount from single-invoice |
|
156 | + $dItemAmount = $aPositions[$oItem->getProductId()]['amount']; // use amount from single-invoice |
|
157 | 157 | } |
158 | - $dBrutPrice = $oItem->getBasePrice() + ($oItem->getBaseTaxAmount() / $oItem->getQtyOrdered());// cals single item price |
|
158 | + $dBrutPrice = $oItem->getBasePrice() + ($oItem->getBaseTaxAmount() / $oItem->getQtyOrdered()); // cals single item price |
|
159 | 159 | $this->addInvoicePosition($oItem->getSku(), $dBrutPrice, 'goods', $dItemAmount, $oItem->getName(), $oItem->getTaxPercent()); |
160 | 160 | if ($this->dTax === false) {// is dTax not set yet? |
161 | - $this->dTax = $oItem->getTaxPercent();// set the tax for following entities which dont have the vat attached to it |
|
161 | + $this->dTax = $oItem->getTaxPercent(); // set the tax for following entities which dont have the vat attached to it |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | { |
176 | 176 | // shipping costs existing or given for partial captures/debits? |
177 | 177 | if ($oOrder->getBaseShippingInclTax() != 0 && ($aPositions === false || ($blDebit === false || array_key_exists('oxdelcost', $aPositions) !== false))) { |
178 | - $sDelDesc = __('Surcharge').' '.__('Shipping Costs');// default description |
|
178 | + $sDelDesc = __('Surcharge').' '.__('Shipping Costs'); // default description |
|
179 | 179 | if ($oOrder->getBaseShippingInclTax() < 0) {// negative shipping cost |
180 | - $sDelDesc = __('Deduction').' '.__('Shipping Costs');// change item description to deduction |
|
180 | + $sDelDesc = __('Deduction').' '.__('Shipping Costs'); // change item description to deduction |
|
181 | 181 | } |
182 | - $sShippingSku = $this->toolkitHelper->getConfigParam('sku', 'costs', 'payone_misc');// get configured shipping SKU |
|
182 | + $sShippingSku = $this->toolkitHelper->getConfigParam('sku', 'costs', 'payone_misc'); // get configured shipping SKU |
|
183 | 183 | $this->addInvoicePosition($sShippingSku, $oOrder->getBaseShippingInclTax(), 'shipment', 1, $sDelDesc, $this->dTax); |
184 | 184 | } |
185 | 185 | } |
@@ -200,16 +200,16 @@ discard block |
||
200 | 200 | if ($aPositions === false) {// full invoice? |
201 | 201 | // The calculations broken down to single items of Magento2 are unprecise and the Payone API will send an error if |
202 | 202 | // the calculated positions don't match, so we compensate for rounding-problems here |
203 | - $dDiff = ($this->dAmount + $oOrder->getBaseDiscountAmount()) - $oOrder->getGrandTotal();// calc rounding discrepancy |
|
204 | - $dDiscount -= $dDiff;// subtract difference from discount |
|
203 | + $dDiff = ($this->dAmount + $oOrder->getBaseDiscountAmount()) - $oOrder->getGrandTotal(); // calc rounding discrepancy |
|
204 | + $dDiscount -= $dDiff; // subtract difference from discount |
|
205 | 205 | } |
206 | - $sDiscountSku = $this->toolkitHelper->getConfigParam('sku', 'discount', 'payone_misc');// get configured discount SKU |
|
207 | - $sDesc = (string)__('Discount');// default description |
|
206 | + $sDiscountSku = $this->toolkitHelper->getConfigParam('sku', 'discount', 'payone_misc'); // get configured discount SKU |
|
207 | + $sDesc = (string)__('Discount'); // default description |
|
208 | 208 | if ($oOrder->getCouponCode()) {// was a coupon code used? |
209 | - $sDiscountSku = $this->toolkitHelper->getConfigParam('sku', 'voucher', 'payone_misc');// get configured voucher SKU |
|
210 | - $sDesc = (string)__('Coupon').' - '.$oOrder->getCouponCode();// add counpon code to description |
|
209 | + $sDiscountSku = $this->toolkitHelper->getConfigParam('sku', 'voucher', 'payone_misc'); // get configured voucher SKU |
|
210 | + $sDesc = (string)__('Coupon').' - '.$oOrder->getCouponCode(); // add counpon code to description |
|
211 | 211 | } |
212 | - $this->addInvoicePosition($sDiscountSku, $dDiscount, 'voucher', 1, $sDesc, $this->dTax);// add invoice params to request |
|
212 | + $this->addInvoicePosition($sDiscountSku, $dDiscount, 'voucher', 1, $sDesc, $this->dTax); // add invoice params to request |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $aParsedRequestUrl = parse_url($sRequestUrl); |
97 | 97 | |
98 | 98 | if ($aParsedRequestUrl === false) { |
99 | - throw new \Exception("Malformed URL " . $sRequestUrl); |
|
99 | + throw new \Exception("Malformed URL ".$sRequestUrl); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $aResponse = []; |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | foreach ($aResponse as $iLinenum => $sLine) {// go through line by line |
131 | 131 | $iPos = strpos($sLine, "="); |
132 | 132 | if ($iPos > 0) {// is a "=" as delimiter existing? |
133 | - $aOutput[substr($sLine, 0, $iPos)] = trim(substr($sLine, $iPos+1)); |
|
133 | + $aOutput[substr($sLine, 0, $iPos)] = trim(substr($sLine, $iPos + 1)); |
|
134 | 134 | } elseif (!empty($sLine)) {// is line not empty? |
135 | - $aOutput[$iLinenum] = $sLine;// add the line unedited |
|
135 | + $aOutput[$iLinenum] = $sLine; // add the line unedited |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | public function addPayoneOrderData(SalesOrder $oOrder, $aRequest, $aResponse) |
173 | 173 | { |
174 | 174 | if (isset($aResponse['txid'])) {// txid existing? |
175 | - $oOrder->setPayoneTxid($aResponse['txid']);// add txid to order entity |
|
175 | + $oOrder->setPayoneTxid($aResponse['txid']); // add txid to order entity |
|
176 | 176 | } |
177 | - $oOrder->setPayoneRefnr($aRequest['reference']);// add refnr to order entity |
|
178 | - $oOrder->setPayoneAuthmode($aRequest['request']);// add authmode to order entity |
|
179 | - $oOrder->setPayoneMode($aRequest['mode']);// add payone mode to order entity |
|
177 | + $oOrder->setPayoneRefnr($aRequest['reference']); // add refnr to order entity |
|
178 | + $oOrder->setPayoneAuthmode($aRequest['request']); // add authmode to order entity |
|
179 | + $oOrder->setPayoneMode($aRequest['mode']); // add payone mode to order entity |
|
180 | 180 | if (isset($aRequest['mandate_identification'])) {// mandate id existing in request? |
181 | 181 | $oOrder->setPayoneMandateId($aRequest['mandate_identification']); |
182 | 182 | } elseif (isset($aResponse['mandate_identification'])) {// mandate id existing in response? |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function isInvoiceDataNeeded(PayoneMethod $oPayment) |
194 | 194 | { |
195 | - $sType = $this->getConfigParam('request_type');// auth or preauth? |
|
196 | - $blInvoiceEnabled = (bool)$this->getConfigParam('transmit_enabled', 'invoicing');// invoicing enabled? |
|
195 | + $sType = $this->getConfigParam('request_type'); // auth or preauth? |
|
196 | + $blInvoiceEnabled = (bool)$this->getConfigParam('transmit_enabled', 'invoicing'); // invoicing enabled? |
|
197 | 197 | if ($oPayment->needsProductInfo() || ($sType == PayoneConfig::REQUEST_TYPE_AUTHORIZATION && $blInvoiceEnabled)) { |
198 | - return true;// invoice data needed |
|
198 | + return true; // invoice data needed |
|
199 | 199 | } |
200 | - return false;// invoice data not needed |
|
200 | + return false; // invoice data not needed |
|
201 | 201 | } |
202 | 202 | } |