@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | $customer = $quote->getCustomer(); |
126 | 126 | $shippingAddress = $quote->getShippingAddress(); |
127 | 127 | |
128 | - if (isset($params['email']) && $params['email']!='') { |
|
128 | + if (isset($params['email']) && $params['email'] != '') { |
|
129 | 129 | $this->session->setEmail($params['email']); //Get guest email after refresh page |
130 | 130 | $customer->setEmail($params['email']); |
131 | 131 | $quote->setCheckoutMethod('guest'); |
132 | 132 | $quote->getBillingAddress()->setEmail($params['email']); |
133 | - } elseif ($customer->getEmail()=='') { |
|
133 | + } elseif ($customer->getEmail() == '') { |
|
134 | 134 | $customer->setEmail($this->session->getEmail()); |
135 | 135 | $quote->setCheckoutMethod('guest'); |
136 | 136 | $quote->getBillingAddress()->setEmail($this->session->getEmail()); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $currentQuote->setCustomerEmail($customer->getEmail()); |
142 | 142 | $this->quoteRepository->save($currentQuote); |
143 | 143 | |
144 | - $userAddress = new Address(); |
|
144 | + $userAddress = new Address(); |
|
145 | 145 | $userAddress |
146 | 146 | ->setZipCode($shippingAddress->getPostcode()) |
147 | 147 | ->setFullName($shippingAddress->getFirstname()." ".$shippingAddress->getLastname()) |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | ->setTaxId($tax_id) |
164 | 164 | ; |
165 | 165 | |
166 | - $orderBillingAddress = new Address(); |
|
166 | + $orderBillingAddress = new Address(); |
|
167 | 167 | $billingAddress = $quote->getBillingAddress(); |
168 | 168 | $orderBillingAddress |
169 | 169 | ->setZipCode($billingAddress->getPostcode()) |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | if ($customer->getDob()) { |
193 | 193 | $orderUser->setDateOfBirth($customer->getDob()); |
194 | 194 | } |
195 | - if ($customer->getTaxvat()!='') { |
|
195 | + if ($customer->getTaxvat() != '') { |
|
196 | 196 | $orderUser->setDni($customer->getTaxvat()); |
197 | 197 | $orderBillingAddress->setDni($customer->getTaxvat()); |
198 | 198 | $orderShippingAddress->setDni($customer->getTaxvat()); |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | |
233 | 233 | $promotedProduct = $this->isPromoted($item); |
234 | 234 | if ($promotedProduct == 'true') { |
235 | - $promotedAmount+=$product->getAmount()*$item->getQty(); |
|
236 | - $promotedMessage = 'Promoted Item: ' . $item->getName() . |
|
237 | - ' Price: ' . $item->getPrice() . |
|
238 | - ' Qty: ' . $item->getQty() . |
|
239 | - ' Item ID: ' . $item->getItemId(); |
|
235 | + $promotedAmount += $product->getAmount() * $item->getQty(); |
|
236 | + $promotedMessage = 'Promoted Item: '.$item->getName(). |
|
237 | + ' Price: '.$item->getPrice(). |
|
238 | + ' Qty: '.$item->getQty(). |
|
239 | + ' Item ID: '.$item->getItemId(); |
|
240 | 240 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
241 | 241 | } |
242 | 242 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | ->setType(Channel::ONLINE) |
274 | 274 | ; |
275 | 275 | |
276 | - $haystack = $this->store->getLocale(); |
|
276 | + $haystack = $this->store->getLocale(); |
|
277 | 277 | $language = strstr($haystack, '_', true); |
278 | 278 | $orderConfiguration = new Configuration(); |
279 | 279 | $orderConfiguration |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | ->setUser($orderUser) |
292 | 292 | ; |
293 | 293 | |
294 | - if ($this->config['pagantis_public_key']=='' || $this->config['pagantis_private_key']=='') { |
|
294 | + if ($this->config['pagantis_public_key'] == '' || $this->config['pagantis_private_key'] == '') { |
|
295 | 295 | throw new \Exception('Public and Secret Key not found'); |
296 | 296 | } |
297 | 297 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | $displayMode = $this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE']; |
320 | - if ($displayMode==='0') { |
|
320 | + if ($displayMode === '0') { |
|
321 | 321 | echo $url; |
322 | 322 | exit; |
323 | 323 | } else { |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | private function getOrders($customerId) |
340 | 340 | { |
341 | 341 | $orderCollection = array(); |
342 | - if ($customerId!='') { |
|
342 | + if ($customerId != '') { |
|
343 | 343 | $this->orderCollection->addAttributeToFilter('customer_id', $customerId) |
344 | 344 | ->addAttributeToFilter( |
345 | 345 | 'status', |
346 | - ['in' => ['processing','pending','complete']] |
|
346 | + ['in' => ['processing', 'pending', 'complete']] |
|
347 | 347 | ) |
348 | 348 | ->load(); |
349 | 349 | $orderCollection = $this->orderCollection->getData(); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
387 | 387 | return $dbConnection->insertOnDuplicate( |
388 | 388 | $tableName, |
389 | - array('id'=>$quoteId,'order_id'=>$pagantisOrderId), |
|
389 | + array('id'=>$quoteId, 'order_id'=>$pagantisOrderId), |
|
390 | 390 | array('order_id') |
391 | 391 | ); |
392 | 392 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $curlVersion = $curlInfo['version']; |
401 | 401 | $magentoVersion = $this->productMetadataInterface->getVersion(); |
402 | 402 | $moduleInfo = $this->moduleList->getOne('Pagantis_Pagantis'); |
403 | - return array( 'magento' => $magentoVersion, |
|
403 | + return array('magento' => $magentoVersion, |
|
404 | 404 | 'pagantis' => $moduleInfo['setup_version'], |
405 | 405 | 'php' => phpversion(), |
406 | 406 | 'curl' => $curlVersion); |
@@ -107,7 +107,7 @@ |
||
107 | 107 | foreach ($items as $key => $item) { |
108 | 108 | $promotedProduct = $this->isPromoted($item); |
109 | 109 | if ($promotedProduct == 'true') { |
110 | - $promotedAmount+=$item->getPrice()*$item->getQty(); |
|
110 | + $promotedAmount += $item->getPrice() * $item->getQty(); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $this->checkPagantisStatus(array('AUTHORIZED')); |
270 | 270 | } catch (\Exception $e) { |
271 | 271 | $this->getMagentoOrderId(); |
272 | - if ($this->magentoOrderId!='') { |
|
272 | + if ($this->magentoOrderId != '') { |
|
273 | 273 | throw new AlreadyProcessedException(); |
274 | 274 | } else { |
275 | 275 | throw new WrongStatusException($this->pagantisOrder->getStatus()); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | private function checkMerchantOrderStatus() |
284 | 284 | { |
285 | - if ($this->quote->getIsActive()=='0') { |
|
285 | + if ($this->quote->getIsActive() == '0') { |
|
286 | 286 | $this->getMagentoOrderId(); |
287 | 287 | throw new AlreadyProcessedException(); |
288 | 288 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $tableName = $this->dbObject->getTableName(self::CONCURRENCY_TABLE); |
405 | 405 | if ($mode == false) { |
406 | 406 | $dbConnection->delete($tableName, "timestamp<".(time() - 5)); |
407 | - } elseif ($this->quoteId!='') { |
|
407 | + } elseif ($this->quoteId != '') { |
|
408 | 408 | $dbConnection->delete($tableName, "id=".$this->quoteId); |
409 | 409 | } |
410 | 410 | } catch (Exception $exception) { |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */ |
460 | 460 | $dbConnection = $this->dbObject->getConnection(); |
461 | 461 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
462 | - $pagantisOrderId = $this->pagantisOrderId; |
|
462 | + $pagantisOrderId = $this->pagantisOrderId; |
|
463 | 463 | $query = "select mg_order_id from $tableName where id='$this->quoteId' and order_id='$pagantisOrderId'"; |
464 | 464 | $queryResult = $dbConnection->fetchRow($query); |
465 | 465 | $this->magentoOrderId = $queryResult['mg_order_id']; |
@@ -484,15 +484,15 @@ discard block |
||
484 | 484 | $metadataInfo = null; |
485 | 485 | foreach ($metadataOrder as $metadataKey => $metadataValue) { |
486 | 486 | if ($metadataKey == 'promotedProduct') { |
487 | - $metadataInfo.= "/Producto promocionado = $metadataValue"; |
|
487 | + $metadataInfo .= "/Producto promocionado = $metadataValue"; |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
491 | 491 | $this->magentoOrder->addStatusHistoryComment($metadataInfo)->setIsCustomerNotified(false)->setEntityName('order')->save(); |
492 | 492 | |
493 | - $comment = 'pagantisOrderId: ' . $this->pagantisOrder->getId(). ' ' . |
|
494 | - 'pagantisOrderStatus: '. $this->pagantisOrder->getStatus(). ' ' . |
|
495 | - 'via: '. $this->origin; |
|
493 | + $comment = 'pagantisOrderId: '.$this->pagantisOrder->getId().' '. |
|
494 | + 'pagantisOrderStatus: '.$this->pagantisOrder->getStatus().' '. |
|
495 | + 'via: '.$this->origin; |
|
496 | 496 | $this->magentoOrder->addStatusHistoryComment($comment)->setIsCustomerNotified(false)->setEntityName('order')->save(); |
497 | 497 | |
498 | 498 | if ($this->magentoOrderId == '') { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */ |
513 | 513 | $dbConnection = $this->dbObject->getConnection(); |
514 | 514 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
515 | - $pagantisOrderId = $this->pagantisOrder->getId(); |
|
515 | + $pagantisOrderId = $this->pagantisOrder->getId(); |
|
516 | 516 | $dbConnection->update( |
517 | 517 | $tableName, |
518 | 518 | array('mg_order_id' => $this->magentoOrderId), |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | { |
546 | 546 | //$returnUrl = 'checkout/#payment'; |
547 | 547 | $returnUrl = $this->_url->getUrl('checkout', ['_fragment' => 'payment']); |
548 | - if ($this->magentoOrderId!='') { |
|
548 | + if ($this->magentoOrderId != '') { |
|
549 | 549 | /** @var Order $this->magentoOrder */ |
550 | 550 | $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId); |
551 | 551 | if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | $orderStatus = strtolower($this->magentoOrder->getStatus()); |
563 | 563 | $acceptedStatus = array('processing', 'completed'); |
564 | 564 | if (in_array($orderStatus, $acceptedStatus)) { |
565 | - if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL']!= '') { |
|
565 | + if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL'] != '') { |
|
566 | 566 | $returnUrl = $this->extraConfig['PAGANTIS_OK_URL']; |
567 | 567 | } else { |
568 | 568 | $returnUrl = 'checkout/onepage/success'; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $this->checkPagantisStatus(array('AUTHORIZED')); |
267 | 267 | } catch (\Exception $e) { |
268 | 268 | $this->getMagentoOrderId(); |
269 | - if ($this->magentoOrderId!='') { |
|
269 | + if ($this->magentoOrderId != '') { |
|
270 | 270 | throw new AlreadyProcessedException(); |
271 | 271 | } else { |
272 | 272 | throw new WrongStatusException($this->pagantisOrder->getStatus()); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | private function checkMerchantOrderStatus() |
281 | 281 | { |
282 | - if ($this->quote->getIsActive()=='0') { |
|
282 | + if ($this->quote->getIsActive() == '0') { |
|
283 | 283 | $this->getMagentoOrderId(); |
284 | 284 | throw new AlreadyProcessedException(); |
285 | 285 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $tableName = $this->dbObject->getTableName(self::CONCURRENCY_TABLE); |
402 | 402 | if ($mode == false) { |
403 | 403 | $dbConnection->delete($tableName, "timestamp<".(time() - 5)); |
404 | - } elseif ($this->quoteId!='') { |
|
404 | + } elseif ($this->quoteId != '') { |
|
405 | 405 | $dbConnection->delete($tableName, "id=".$this->quoteId); |
406 | 406 | } |
407 | 407 | } catch (Exception $exception) { |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */ |
457 | 457 | $dbConnection = $this->dbObject->getConnection(); |
458 | 458 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
459 | - $pagantisOrderId = $this->pagantisOrderId; |
|
459 | + $pagantisOrderId = $this->pagantisOrderId; |
|
460 | 460 | |
461 | 461 | $query = "select mg_order_id from $tableName where id='$this->quoteId' and order_id='$pagantisOrderId'"; |
462 | 462 | $queryResult = $dbConnection->fetchRow($query); |
@@ -483,13 +483,13 @@ discard block |
||
483 | 483 | $metadataInfo = null; |
484 | 484 | foreach ($metadataOrder as $metadataKey => $metadataValue) { |
485 | 485 | if ($metadataKey == 'promotedProduct') { |
486 | - $metadataInfo.= " Producto promocionado = $metadataValue //"; |
|
486 | + $metadataInfo .= " Producto promocionado = $metadataValue //"; |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 | $this->magentoOrder->addStatusHistoryComment($metadataInfo)->setIsCustomerNotified(false)->setEntityName('order')->save(); |
490 | 490 | |
491 | - $comment = 'pagantisOrderId: '.$this->pagantisOrder->getId(). ' ' . |
|
492 | - 'pagantisOrderStatus: '.$this->pagantisOrder->getStatus(). ' ' . |
|
491 | + $comment = 'pagantisOrderId: '.$this->pagantisOrder->getId().' '. |
|
492 | + 'pagantisOrderStatus: '.$this->pagantisOrder->getStatus().' '. |
|
493 | 493 | 'via: '.$this->origin; |
494 | 494 | $this->magentoOrder->addStatusHistoryComment($comment)->setIsCustomerNotified(false)->setEntityName('order')->save(); |
495 | 495 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */ |
511 | 511 | $dbConnection = $this->dbObject->getConnection(); |
512 | 512 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
513 | - $pagantisOrderId = $this->pagantisOrder->getId(); |
|
513 | + $pagantisOrderId = $this->pagantisOrder->getId(); |
|
514 | 514 | $dbConnection->update( |
515 | 515 | $tableName, |
516 | 516 | array('mg_order_id' => $this->magentoOrderId), |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | { |
544 | 544 | //$returnUrl = 'checkout/#payment'; |
545 | 545 | $returnUrl = $this->_url->getUrl('checkout', ['_fragment' => 'payment']); |
546 | - if ($this->magentoOrderId!='') { |
|
546 | + if ($this->magentoOrderId != '') { |
|
547 | 547 | /** @var Order $this->magentoOrder */ |
548 | 548 | $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId); |
549 | 549 | if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | $orderStatus = strtolower($this->magentoOrder->getStatus()); |
561 | 561 | $acceptedStatus = array('processing', 'completed'); |
562 | 562 | if (in_array($orderStatus, $acceptedStatus)) { |
563 | - if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL']!= '') { |
|
563 | + if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL'] != '') { |
|
564 | 564 | $returnUrl = $this->extraConfig['PAGANTIS_OK_URL']; |
565 | 565 | } else { |
566 | 566 | $returnUrl = 'checkout/onepage/success'; |