@@ -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 | } |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | $okUrlRoute = 'pagantis/notify/indexV2'; |
262 | 262 | } |
263 | 263 | |
264 | - $okUrlUser = $this->_url->getUrl($okUrlRoute, ['_query' => ['quoteId'=>$quoteId,'origin'=>'redirect']]); |
|
265 | - $okUrlNot = $this->_url->getUrl($okUrlRoute, ['_query' => ['quoteId'=>$quoteId,'origin'=>'notification']]); |
|
264 | + $okUrlUser = $this->_url->getUrl($okUrlRoute, ['_query' => ['quoteId'=>$quoteId, 'origin'=>'redirect']]); |
|
265 | + $okUrlNot = $this->_url->getUrl($okUrlRoute, ['_query' => ['quoteId'=>$quoteId, 'origin'=>'notification']]); |
|
266 | 266 | |
267 | 267 | $orderConfigurationUrls |
268 | 268 | ->setCancel($cancelUrl) |
@@ -277,15 +277,12 @@ discard block |
||
277 | 277 | ->setType(Channel::ONLINE) |
278 | 278 | ; |
279 | 279 | |
280 | - $haystack = ($this->store->getLocale()!=null) ? $this->store->getLocale() : $this->getResolverCountry(); |
|
280 | + $haystack = ($this->store->getLocale() != null) ? $this->store->getLocale() : $this->getResolverCountry(); |
|
281 | 281 | $langCountry = strtolower(strstr($haystack, '_', true)); |
282 | 282 | $allowedCountries = unserialize($this->extraConfig['PAGANTIS_ALLOWED_COUNTRIES']); |
283 | 283 | |
284 | 284 | $purchaseCountry = |
285 | - in_array($langCountry, $allowedCountries) ? $langCountry : |
|
286 | - in_array(strtolower($shippingAddress->getCountry()), $allowedCountries)? $shippingAddress->getCountry(): |
|
287 | - in_array(strtolower($billingAddress->getCountry()), $allowedCountries)? $billingAddress->getCountry() : |
|
288 | - null; |
|
285 | + in_array($langCountry, $allowedCountries) ? $langCountry : in_array(strtolower($shippingAddress->getCountry()), $allowedCountries) ? $shippingAddress->getCountry() : in_array(strtolower($billingAddress->getCountry()), $allowedCountries) ? $billingAddress->getCountry() : null; |
|
289 | 286 | |
290 | 287 | $orderConfiguration = new Configuration(); |
291 | 288 | $orderConfiguration |
@@ -303,7 +300,7 @@ discard block |
||
303 | 300 | ->setUser($orderUser) |
304 | 301 | ; |
305 | 302 | |
306 | - if ($this->config['pagantis_public_key']=='' || $this->config['pagantis_private_key']=='') { |
|
303 | + if ($this->config['pagantis_public_key'] == '' || $this->config['pagantis_private_key'] == '') { |
|
307 | 304 | throw new \Exception('Public and Secret Key not found'); |
308 | 305 | } |
309 | 306 | |
@@ -329,7 +326,7 @@ discard block |
||
329 | 326 | } |
330 | 327 | |
331 | 328 | $displayMode = $this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE']; |
332 | - if ($displayMode==='0') { |
|
329 | + if ($displayMode === '0') { |
|
333 | 330 | echo $url; |
334 | 331 | exit; |
335 | 332 | } else { |
@@ -351,11 +348,11 @@ discard block |
||
351 | 348 | private function getOrders($customerId) |
352 | 349 | { |
353 | 350 | $orderCollection = array(); |
354 | - if ($customerId!='') { |
|
351 | + if ($customerId != '') { |
|
355 | 352 | $this->orderCollection->addAttributeToFilter('customer_id', $customerId) |
356 | 353 | ->addAttributeToFilter( |
357 | 354 | 'status', |
358 | - ['in' => ['processing','pending','complete']] |
|
355 | + ['in' => ['processing', 'pending', 'complete']] |
|
359 | 356 | ) |
360 | 357 | ->load(); |
361 | 358 | $orderCollection = $this->orderCollection->getData(); |
@@ -398,7 +395,7 @@ discard block |
||
398 | 395 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
399 | 396 | return $dbConnection->insertOnDuplicate( |
400 | 397 | $tableName, |
401 | - array('id'=>$quoteId,'order_id'=>$pagantisOrderId), |
|
398 | + array('id'=>$quoteId, 'order_id'=>$pagantisOrderId), |
|
402 | 399 | array('order_id') |
403 | 400 | ); |
404 | 401 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $this->checkPagantisStatus(array('AUTHORIZED')); |
292 | 292 | } catch (\Exception $e) { |
293 | 293 | $this->getMagentoOrderId(); |
294 | - if ($this->magentoOrderId!='') { |
|
294 | + if ($this->magentoOrderId != '') { |
|
295 | 295 | throw new AlreadyProcessedException(); |
296 | 296 | } else { |
297 | 297 | throw new WrongStatusException($this->pagantisOrder->getStatus()); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | */ |
305 | 305 | private function checkMerchantOrderStatus() |
306 | 306 | { |
307 | - if ($this->quote->getIsActive()=='0') { |
|
307 | + if ($this->quote->getIsActive() == '0') { |
|
308 | 308 | $this->getMagentoOrderId(); |
309 | 309 | throw new AlreadyProcessedException(); |
310 | 310 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | $tableName = $this->dbObject->getTableName(self::CONCURRENCY_TABLE); |
437 | 437 | if ($mode == false) { |
438 | 438 | $dbConnection->delete($tableName, "timestamp<".(time() - 5)); |
439 | - } elseif ($this->quoteId!='') { |
|
439 | + } elseif ($this->quoteId != '') { |
|
440 | 440 | $dbConnection->delete($tableName, "id=".$this->quoteId); |
441 | 441 | } |
442 | 442 | } catch (Exception $exception) { |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | sleep($expirationSec + 1); |
473 | 473 | } |
474 | 474 | |
475 | - $logMessage = sprintf( |
|
475 | + $logMessage = sprintf( |
|
476 | 476 | "User waiting %s seconds, default seconds %s, bd time to expire %s seconds", |
477 | 477 | $expirationSec, |
478 | 478 | self::CONCURRENCY_TIMEOUT, |
@@ -522,14 +522,14 @@ discard block |
||
522 | 522 | $this->getPagantisOrderId(); |
523 | 523 | } |
524 | 524 | |
525 | - $pagantisOrderId = $this->pagantisOrderId; |
|
526 | - $query = sprintf( |
|
525 | + $pagantisOrderId = $this->pagantisOrderId; |
|
526 | + $query = sprintf( |
|
527 | 527 | "select mg_order_id from %s where id='%s' and order_id='%s'", |
528 | 528 | $tableName, |
529 | 529 | $this->quoteId, |
530 | 530 | $pagantisOrderId |
531 | 531 | ); |
532 | - $queryResult = $dbConnection->fetchRow($query); |
|
532 | + $queryResult = $dbConnection->fetchRow($query); |
|
533 | 533 | $this->magentoOrderId = $queryResult['mg_order_id']; |
534 | 534 | } catch (\Exception $e) { |
535 | 535 | throw new UnknownException($e->getMessage()); |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | $metadataInfo = null; |
553 | 553 | foreach ($metadataOrder as $metadataKey => $metadataValue) { |
554 | 554 | if ($metadataKey == 'promotedProduct') { |
555 | - $metadataInfo.= "/Producto promocionado = $metadataValue"; |
|
555 | + $metadataInfo .= "/Producto promocionado = $metadataValue"; |
|
556 | 556 | } |
557 | 557 | } |
558 | 558 | |
@@ -561,9 +561,9 @@ discard block |
||
561 | 561 | ->setEntityName('order') |
562 | 562 | ->save(); |
563 | 563 | |
564 | - $comment = 'pagantisOrderId: ' . $this->pagantisOrder->getId(). ' ' . |
|
565 | - 'pagantisOrderStatus: '. $this->pagantisOrder->getStatus(). ' ' . |
|
566 | - 'via: '. $this->origin; |
|
564 | + $comment = 'pagantisOrderId: '.$this->pagantisOrder->getId().' '. |
|
565 | + 'pagantisOrderStatus: '.$this->pagantisOrder->getStatus().' '. |
|
566 | + 'via: '.$this->origin; |
|
567 | 567 | $this->magentoOrder->addStatusHistoryComment($comment) |
568 | 568 | ->setIsCustomerNotified(false) |
569 | 569 | ->setEntityName('order') |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */ |
587 | 587 | $dbConnection = $this->dbObject->getConnection(); |
588 | 588 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
589 | - $pagantisOrderId = $this->pagantisOrder->getId(); |
|
589 | + $pagantisOrderId = $this->pagantisOrder->getId(); |
|
590 | 590 | $dbConnection->update( |
591 | 591 | $tableName, |
592 | 592 | array('mg_order_id' => $this->magentoOrderId), |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | $this->getPagantisOrderId(); |
641 | 641 | } |
642 | 642 | |
643 | - if ($this->magentoOrderId!='') { |
|
643 | + if ($this->magentoOrderId != '') { |
|
644 | 644 | /** @var Order $this->magentoOrder */ |
645 | 645 | $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId); |
646 | 646 | if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | $orderStatus = strtolower($this->magentoOrder->getStatus()); |
658 | 658 | $acceptedStatus = array('processing', 'completed'); |
659 | 659 | if (in_array($orderStatus, $acceptedStatus)) { |
660 | - if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL']!= '') { |
|
660 | + if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL'] != '') { |
|
661 | 661 | $returnUrl = $this->extraConfig['PAGANTIS_OK_URL']; |
662 | 662 | } else { |
663 | 663 | $returnUrl = 'checkout/onepage/success'; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $this->checkPagantisStatus(array('AUTHORIZED')); |
278 | 278 | } catch (\Exception $e) { |
279 | 279 | $this->getMagentoOrderId(); |
280 | - if ($this->magentoOrderId!='') { |
|
280 | + if ($this->magentoOrderId != '') { |
|
281 | 281 | throw new AlreadyProcessedException(); |
282 | 282 | } else { |
283 | 283 | throw new WrongStatusException($this->pagantisOrder->getStatus()); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | */ |
291 | 291 | private function checkMerchantOrderStatus() |
292 | 292 | { |
293 | - if ($this->quote->getIsActive()=='0') { |
|
293 | + if ($this->quote->getIsActive() == '0') { |
|
294 | 294 | $this->getMagentoOrderId(); |
295 | 295 | throw new AlreadyProcessedException(); |
296 | 296 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $tableName = $this->dbObject->getTableName(self::CONCURRENCY_TABLE); |
423 | 423 | if ($mode == false) { |
424 | 424 | $dbConnection->delete($tableName, "timestamp<".(time() - 5)); |
425 | - } elseif ($this->quoteId!='') { |
|
425 | + } elseif ($this->quoteId != '') { |
|
426 | 426 | $dbConnection->delete($tableName, "id=".$this->quoteId); |
427 | 427 | } |
428 | 428 | } catch (Exception $exception) { |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | sleep($expirationSec + 1); |
459 | 459 | } |
460 | 460 | |
461 | - $logMessage = sprintf( |
|
461 | + $logMessage = sprintf( |
|
462 | 462 | "User waiting %s seconds, default seconds %s, bd time to expire %s seconds", |
463 | 463 | $expirationSec, |
464 | 464 | self::CONCURRENCY_TIMEOUT, |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | if ($this->pagantisOrderId == '') { |
508 | 508 | $this->getPagantisOrderId(); |
509 | 509 | } |
510 | - $pagantisOrderId = $this->pagantisOrderId; |
|
510 | + $pagantisOrderId = $this->pagantisOrderId; |
|
511 | 511 | |
512 | 512 | $query = "select mg_order_id from $tableName where id='$this->quoteId' and order_id='$pagantisOrderId'"; |
513 | 513 | $queryResult = $dbConnection->fetchRow($query); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | $metadataInfo = null; |
535 | 535 | foreach ($metadataOrder as $metadataKey => $metadataValue) { |
536 | 536 | if ($metadataKey == 'promotedProduct') { |
537 | - $metadataInfo.= " Producto promocionado = $metadataValue //"; |
|
537 | + $metadataInfo .= " Producto promocionado = $metadataValue //"; |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | ->setEntityName('order') |
544 | 544 | ->save(); |
545 | 545 | |
546 | - $comment = 'pagantisOrderId: '.$this->pagantisOrder->getId(). ' ' . |
|
547 | - 'pagantisOrderStatus: '.$this->pagantisOrder->getStatus(). ' ' . |
|
546 | + $comment = 'pagantisOrderId: '.$this->pagantisOrder->getId().' '. |
|
547 | + 'pagantisOrderStatus: '.$this->pagantisOrder->getStatus().' '. |
|
548 | 548 | 'via: '.$this->origin; |
549 | 549 | $this->magentoOrder->addStatusHistoryComment($comment) |
550 | 550 | ->setIsCustomerNotified(false) |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */ |
569 | 569 | $dbConnection = $this->dbObject->getConnection(); |
570 | 570 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
571 | - $pagantisOrderId = $this->pagantisOrder->getId(); |
|
571 | + $pagantisOrderId = $this->pagantisOrder->getId(); |
|
572 | 572 | $dbConnection->update( |
573 | 573 | $tableName, |
574 | 574 | array('mg_order_id' => $this->magentoOrderId), |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $this->getPagantisOrderId(); |
623 | 623 | } |
624 | 624 | |
625 | - if ($this->magentoOrderId!='') { |
|
625 | + if ($this->magentoOrderId != '') { |
|
626 | 626 | /** @var Order $this->magentoOrder */ |
627 | 627 | $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId); |
628 | 628 | if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | $orderStatus = strtolower($this->magentoOrder->getStatus()); |
640 | 640 | $acceptedStatus = array('processing', 'completed'); |
641 | 641 | if (in_array($orderStatus, $acceptedStatus)) { |
642 | - if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL']!= '') { |
|
642 | + if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL'] != '') { |
|
643 | 643 | $returnUrl = $this->extraConfig['PAGANTIS_OK_URL']; |
644 | 644 | } else { |
645 | 645 | $returnUrl = 'checkout/onepage/success'; |