@@ -177,6 +177,6 @@ |
||
| 177 | 177 | if ($this->getPaymentConfig('allowspecific', $sPaymentCode, $sStoreCode, true) == '1') { |
| 178 | 178 | return $this->getPaymentConfig('specificcountry', $sPaymentCode, $sStoreCode, true); |
| 179 | 179 | } |
| 180 | - return '';// empty return value if all countries are available |
|
| 180 | + return ''; // empty return value if all countries are available |
|
| 181 | 181 | } |
| 182 | 182 | } |
@@ -188,6 +188,6 @@ |
||
| 188 | 188 | if ($iCount === null) { |
| 189 | 189 | return 0; |
| 190 | 190 | } |
| 191 | - return $iCount+1; |
|
| 191 | + return $iCount + 1; |
|
| 192 | 192 | } |
| 193 | 193 | } |
@@ -156,15 +156,15 @@ |
||
| 156 | 156 | */ |
| 157 | 157 | public function getHostedFieldConfig() |
| 158 | 158 | { |
| 159 | - $aHostedParams = $this->getHostedParams();// get hosted params from config |
|
| 159 | + $aHostedParams = $this->getHostedParams(); // get hosted params from config |
|
| 160 | 160 | |
| 161 | 161 | $aFieldConfig = []; |
| 162 | 162 | if (!empty($aHostedParams)) { |
| 163 | - $aFieldConfig['fields'] = $this->getFieldConfig();// generate config for all field types |
|
| 163 | + $aFieldConfig['fields'] = $this->getFieldConfig(); // generate config for all field types |
|
| 164 | 164 | $aFieldConfig['defaultStyle'] = $this->getDefaultStyles($aHostedParams); |
| 165 | 165 | if ($aHostedParams['Errors_active'] == "true") { |
| 166 | - $aFieldConfig['error'] = 'errorOutput';// area to display error-messages (optional) |
|
| 167 | - $aFieldConfig['language'] = $aHostedParams['Errors_lang'];// has to be defined in javascript |
|
| 166 | + $aFieldConfig['error'] = 'errorOutput'; // area to display error-messages (optional) |
|
| 167 | + $aFieldConfig['language'] = $aHostedParams['Errors_lang']; // has to be defined in javascript |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | return $aFieldConfig; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function getInstructions() |
| 237 | 237 | { |
| 238 | - return trim($this->getConfigData('instructions'));// return description text |
|
| 238 | + return trim($this->getConfigData('instructions')); // return description text |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
@@ -247,9 +247,9 @@ discard block |
||
| 247 | 247 | { |
| 248 | 248 | $sRequestType = $this->getAuthorizationMode(); |
| 249 | 249 | if ($sRequestType == PayoneConfig::REQUEST_TYPE_PREAUTHORIZATION) { |
| 250 | - return AbstractMethod::ACTION_AUTHORIZE;// only create order |
|
| 250 | + return AbstractMethod::ACTION_AUTHORIZE; // only create order |
|
| 251 | 251 | } elseif ($sRequestType == PayoneConfig::REQUEST_TYPE_AUTHORIZATION) { |
| 252 | - return AbstractMethod::ACTION_AUTHORIZE_CAPTURE;// create order and capture |
|
| 252 | + return AbstractMethod::ACTION_AUTHORIZE_CAPTURE; // create order and capture |
|
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function authorize(InfoInterface $payment, $amount) |
| 264 | 264 | { |
| 265 | - $oReturn = parent::authorize($payment, $amount);// execute Magento parent authorization |
|
| 266 | - $this->sendPayoneAuthorization($payment, $amount);// send auth request to PAYONE |
|
| 267 | - return $oReturn;// return magento parent auth value |
|
| 265 | + $oReturn = parent::authorize($payment, $amount); // execute Magento parent authorization |
|
| 266 | + $this->sendPayoneAuthorization($payment, $amount); // send auth request to PAYONE |
|
| 267 | + return $oReturn; // return magento parent auth value |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -276,9 +276,9 @@ discard block |
||
| 276 | 276 | */ |
| 277 | 277 | public function refund(InfoInterface $payment, $amount) |
| 278 | 278 | { |
| 279 | - $oReturn = parent::refund($payment, $amount);// execute Magento parent refund |
|
| 280 | - $this->sendPayoneDebit($payment, $amount);// send debit request to PAYONE |
|
| 281 | - return $oReturn;// return magento parent refund value |
|
| 279 | + $oReturn = parent::refund($payment, $amount); // execute Magento parent refund |
|
| 280 | + $this->sendPayoneDebit($payment, $amount); // send debit request to PAYONE |
|
| 281 | + return $oReturn; // return magento parent refund value |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | */ |
| 291 | 291 | public function capture(InfoInterface $payment, $amount) |
| 292 | 292 | { |
| 293 | - $oReturn = parent::capture($payment, $amount);// execute Magento parent capture |
|
| 293 | + $oReturn = parent::capture($payment, $amount); // execute Magento parent capture |
|
| 294 | 294 | if ($payment->getParentTransactionId()) {// does the order already have a transaction? |
| 295 | - $this->sendPayoneCapture($payment, $amount);// is probably admin invoice capture |
|
| 295 | + $this->sendPayoneCapture($payment, $amount); // is probably admin invoice capture |
|
| 296 | 296 | } else { |
| 297 | - $this->sendPayoneAuthorization($payment, $amount);// is probably frontend checkout capture |
|
| 297 | + $this->sendPayoneAuthorization($payment, $amount); // is probably frontend checkout capture |
|
| 298 | 298 | } |
| 299 | - return $oReturn;// return magento parent capture value |
|
| 299 | + return $oReturn; // return magento parent capture value |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -311,12 +311,12 @@ discard block |
||
| 311 | 311 | $iAllowSpecific = $this->shopHelper->getConfigParam('allowspecific'); |
| 312 | 312 | $aAvailableCountries = explode(',', $this->shopHelper->getConfigParam('specificcountry')); |
| 313 | 313 | if ($this->hasCustomConfig()) {// check for non-global configuration |
| 314 | - $iAllowSpecific = $this->getCustomConfigParam('allowspecific');// only specific countries allowed? |
|
| 315 | - $aAvailableCountries = explode(',', $this->getCustomConfigParam('specificcountry'));// get allowed countries |
|
| 314 | + $iAllowSpecific = $this->getCustomConfigParam('allowspecific'); // only specific countries allowed? |
|
| 315 | + $aAvailableCountries = explode(',', $this->getCustomConfigParam('specificcountry')); // get allowed countries |
|
| 316 | 316 | } |
| 317 | 317 | if ($iAllowSpecific == 1 && !in_array($country, $aAvailableCountries)) {// only specific but not included |
| 318 | - return false;// cant use for given country |
|
| 318 | + return false; // cant use for given country |
|
| 319 | 319 | } |
| 320 | - return true;// can use for given country |
|
| 320 | + return true; // can use for given country |
|
| 321 | 321 | } |
| 322 | 322 | } |
@@ -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 | /** |
@@ -86,19 +86,19 @@ |
||
| 86 | 86 | $oOrder = $oPaymentInfo->getOrder(); |
| 87 | 87 | $iTxid = $oPaymentInfo->getParentTransactionId(); |
| 88 | 88 | if (strpos($iTxid, '-') !== false) { |
| 89 | - $iTxid = substr($iTxid, 0, strpos($iTxid, '-'));// clean the txid from the magento-suffixes |
|
| 89 | + $iTxid = substr($iTxid, 0, strpos($iTxid, '-')); // clean the txid from the magento-suffixes |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $this->setOrderId($oOrder->getRealOrderId()); |
| 93 | 93 | |
| 94 | 94 | $this->addParameter('request', 'debit'); // Request method |
| 95 | - $this->addParameter('mode', $oPayment->getOperationMode());// PayOne Portal Operation Mode (live or test) |
|
| 95 | + $this->addParameter('mode', $oPayment->getOperationMode()); // PayOne Portal Operation Mode (live or test) |
|
| 96 | 96 | $this->addParameter('txid', $iTxid); // PayOne Transaction ID |
| 97 | 97 | $this->addParameter('sequencenumber', $this->databaseHelper->getSequenceNumber($iTxid)); |
| 98 | 98 | |
| 99 | 99 | // Total order sum in smallest currency unit |
| 100 | - $this->addParameter('amount', number_format((-1 * $dAmount), 2, '.', '')*100); |
|
| 101 | - $this->addParameter('currency', $oOrder->getOrderCurrencyCode());// Currency |
|
| 100 | + $this->addParameter('amount', number_format((-1 * $dAmount), 2, '.', '') * 100); |
|
| 101 | + $this->addParameter('currency', $oOrder->getOrderCurrencyCode()); // Currency |
|
| 102 | 102 | $this->addParameter('transactiontype', 'GT'); |
| 103 | 103 | |
| 104 | 104 | $sRefundAppendix = $this->getRefundAppendix($oOrder, $oPayment); |
@@ -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 | |