@@ -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; |
@@ -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)); |
@@ -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 | } |
@@ -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()); |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | array $meta = [], |
| 71 | 71 | array $data = [] |
| 72 | 72 | ) { |
| 73 | - $this->databaseHelper = $databaseHelper;// needs to be in front of constructor, doesnt work otherwise for no apparent reason |
|
| 73 | + $this->databaseHelper = $databaseHelper; // needs to be in front of constructor, doesnt work otherwise for no apparent reason |
|
| 74 | 74 | parent::__construct($name, $primaryFieldName, $requestFieldName, $reporting, $searchCritBuilder, $request, $filterBuilder, $meta, $data); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -113,9 +113,9 @@ |
||
| 113 | 113 | } |
| 114 | 114 | if ($this->blGotModuleInfo === true) {// was composer.json readable? |
| 115 | 115 | $sRequestUrl = $this->sVersionCheckUrl.'?module='.$this->sModuleId.'&version='.$this->sModuleVersion; |
| 116 | - $sResponse = file_get_contents($sRequestUrl);// request info from fatchip checksum server |
|
| 116 | + $sResponse = file_get_contents($sRequestUrl); // request info from fatchip checksum server |
|
| 117 | 117 | if (!empty($sResponse)) {// Did the server answer? |
| 118 | - $aFiles = json_decode($sResponse);// Decode the json encoded answer from the server |
|
| 118 | + $aFiles = json_decode($sResponse); // Decode the json encoded answer from the server |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | return $aFiles; |