@@ -607,9 +607,9 @@ discard block |
||
607 | 607 | } |
608 | 608 | |
609 | 609 | $this->magentoOrder->addStatusHistoryComment($metadataInfo) |
610 | - ->setIsCustomerNotified(false) |
|
611 | - ->setEntityName('order') |
|
612 | - ->save(); |
|
610 | + ->setIsCustomerNotified(false) |
|
611 | + ->setEntityName('order') |
|
612 | + ->save(); |
|
613 | 613 | |
614 | 614 | $comment = sprintf( |
615 | 615 | 'pagantisOrderId: %s || pagantisOrderStatus: %s || via: %s || product: %s', |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | ); |
621 | 621 | |
622 | 622 | $this->magentoOrder->addStatusHistoryComment($comment) |
623 | - ->setIsCustomerNotified(false) |
|
624 | - ->setEntityName('order') |
|
625 | - ->save(); |
|
623 | + ->setIsCustomerNotified(false) |
|
624 | + ->setEntityName('order') |
|
625 | + ->save(); |
|
626 | 626 | |
627 | 627 | if ($this->magentoOrderId == '') { |
628 | 628 | throw new UnknownException('Order can not be saved'); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $this->checkoutSession = $checkoutSession; |
155 | 155 | $this->_request = $request; |
156 | 156 | $this->origin = ( |
157 | - $this->_request->isPost() || $this->_request->getParam('origin')=='notification' |
|
157 | + $this->_request->isPost() || $this->_request->getParam('origin') == 'notification' |
|
158 | 158 | ) ? 'Notification' : 'Order'; |
159 | 159 | $this->product = $this->_request->getParam('product'); |
160 | 160 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | private function getPagantisOrder() |
310 | 310 | { |
311 | 311 | try { |
312 | - if ($this->getProduct()===ConfigProvider::CODE4X) { |
|
312 | + if ($this->getProduct() === ConfigProvider::CODE4X) { |
|
313 | 313 | $this->orderClient = new Client( |
314 | 314 | $this->config['pagantis_public_key_4x'], |
315 | 315 | $this->config['pagantis_private_key_4x'] |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $this->checkPagantisStatus(array('AUTHORIZED')); |
337 | 337 | } catch (\Exception $e) { |
338 | 338 | $this->getMagentoOrderId(); |
339 | - if ($this->magentoOrderId!='') { |
|
339 | + if ($this->magentoOrderId != '') { |
|
340 | 340 | throw new AlreadyProcessedException(); |
341 | 341 | } else { |
342 | 342 | throw new WrongStatusException($this->pagantisOrder->getStatus()); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | private function checkMerchantOrderStatus() |
351 | 351 | { |
352 | - if ($this->quote->getIsActive()=='0') { |
|
352 | + if ($this->quote->getIsActive() == '0') { |
|
353 | 353 | $this->getMagentoOrderId(); |
354 | 354 | throw new AlreadyProcessedException(); |
355 | 355 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $tableName = $this->dbObject->getTableName(self::CONCURRENCY_TABLE); |
482 | 482 | if ($mode == false) { |
483 | 483 | $dbConnection->delete($tableName, "timestamp<".(time() - 5)); |
484 | - } elseif ($this->quoteId!='') { |
|
484 | + } elseif ($this->quoteId != '') { |
|
485 | 485 | $dbConnection->delete($tableName, "id=".$this->quoteId); |
486 | 486 | } |
487 | 487 | } catch (Exception $exception) { |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $this->getPagantisOrderId(); |
521 | 521 | $this->getMagentoOrderId(); |
522 | 522 | |
523 | - $logMessage = sprintf( |
|
523 | + $logMessage = sprintf( |
|
524 | 524 | "User waiting %s seconds, default seconds %s, bd time to expire %s seconds[quoteId=%s][origin=%s]", |
525 | 525 | $expirationSec, |
526 | 526 | self::CONCURRENCY_TIMEOUT, |
@@ -572,14 +572,14 @@ discard block |
||
572 | 572 | $this->getPagantisOrderId(); |
573 | 573 | } |
574 | 574 | |
575 | - $pagantisOrderId = $this->pagantisOrderId; |
|
576 | - $query = sprintf( |
|
575 | + $pagantisOrderId = $this->pagantisOrderId; |
|
576 | + $query = sprintf( |
|
577 | 577 | "select mg_order_id from %s where id='%s' and order_id='%s'", |
578 | 578 | $tableName, |
579 | 579 | $this->quoteId, |
580 | 580 | $pagantisOrderId |
581 | 581 | ); |
582 | - $queryResult = $dbConnection->fetchRow($query); |
|
582 | + $queryResult = $dbConnection->fetchRow($query); |
|
583 | 583 | $this->magentoOrderId = $queryResult['mg_order_id']; |
584 | 584 | } catch (\Exception $e) { |
585 | 585 | throw new UnknownException($e->getMessage()); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $metadataInfo = null; |
603 | 603 | foreach ($metadataOrder as $metadataKey => $metadataValue) { |
604 | 604 | if ($metadataKey == 'promotedProduct') { |
605 | - $metadataInfo.= "/Producto promocionado = $metadataValue"; |
|
605 | + $metadataInfo .= "/Producto promocionado = $metadataValue"; |
|
606 | 606 | } |
607 | 607 | } |
608 | 608 | |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */ |
642 | 642 | $dbConnection = $this->dbObject->getConnection(); |
643 | 643 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
644 | - $pagantisOrderId = $this->pagantisOrder->getId(); |
|
644 | + $pagantisOrderId = $this->pagantisOrder->getId(); |
|
645 | 645 | $dbConnection->update( |
646 | 646 | $tableName, |
647 | 647 | array('mg_order_id' => $this->magentoOrderId), |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | $this->getMagentoOrderId(); |
717 | 717 | } |
718 | 718 | |
719 | - if ($this->magentoOrderId!='') { |
|
719 | + if ($this->magentoOrderId != '') { |
|
720 | 720 | /** @var Order $this->magentoOrder */ |
721 | 721 | $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId); |
722 | 722 | if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | $orderStatus = strtolower($this->magentoOrder->getStatus()); |
742 | 742 | $acceptedStatus = array('processing', 'completed'); |
743 | 743 | if (in_array($orderStatus, $acceptedStatus)) { |
744 | - if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL']!= '') { |
|
744 | + if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL'] != '') { |
|
745 | 745 | $returnUrl = $this->extraConfig['PAGANTIS_OK_URL']; |
746 | 746 | } else { |
747 | 747 | $returnUrl = 'checkout/onepage/success'; |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | /** @var Order $order */ |
124 | 124 | $lastOrder = $this->session->getLastRealOrder(); |
125 | 125 | $params = $this->getRequest()->getParams(); |
126 | - $pgProduct = (isset($params['product']) && $params['product']===ConfigProvider::CODE4X) ? ConfigProvider::CODE4X : ConfigProvider::CODE; |
|
126 | + $pgProduct = (isset($params['product']) && $params['product'] === ConfigProvider::CODE4X) ? ConfigProvider::CODE4X : ConfigProvider::CODE; |
|
127 | 127 | |
128 | 128 | $customer = $quote->getCustomer(); |
129 | 129 | $shippingAddress = $quote->getShippingAddress(); |
130 | 130 | |
131 | - if (isset($params['email']) && $params['email']!='') { |
|
131 | + if (isset($params['email']) && $params['email'] != '') { |
|
132 | 132 | $this->session->setEmail($params['email']); //Get guest email after refresh page |
133 | 133 | $customer->setEmail($params['email']); |
134 | 134 | $quote->setCheckoutMethod('guest'); |
135 | 135 | $quote->getBillingAddress()->setEmail($params['email']); |
136 | - } elseif ($customer->getEmail()=='') { |
|
136 | + } elseif ($customer->getEmail() == '') { |
|
137 | 137 | $customer->setEmail($this->session->getEmail()); |
138 | 138 | $quote->setCheckoutMethod('guest'); |
139 | 139 | $quote->getBillingAddress()->setEmail($this->session->getEmail()); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $currentQuote->setCustomerEmail($customer->getEmail()); |
145 | 145 | $this->quoteRepository->save($currentQuote); |
146 | 146 | |
147 | - $userAddress = new Address(); |
|
147 | + $userAddress = new Address(); |
|
148 | 148 | $userAddress |
149 | 149 | ->setZipCode($shippingAddress->getPostcode()) |
150 | 150 | ->setFullName($shippingAddress->getFirstname()." ".$shippingAddress->getLastname()) |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | ->setTaxId($tax_id) |
167 | 167 | ; |
168 | 168 | |
169 | - $orderBillingAddress = new Address(); |
|
169 | + $orderBillingAddress = new Address(); |
|
170 | 170 | $billingAddress = $quote->getBillingAddress(); |
171 | 171 | $orderBillingAddress |
172 | 172 | ->setZipCode($billingAddress->getPostcode()) |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | if ($customer->getDob()) { |
196 | 196 | $orderUser->setDateOfBirth($customer->getDob()); |
197 | 197 | } |
198 | - if ($customer->getTaxvat()!='') { |
|
198 | + if ($customer->getTaxvat() != '') { |
|
199 | 199 | $orderUser->setDni($customer->getTaxvat()); |
200 | 200 | $orderBillingAddress->setDni($customer->getTaxvat()); |
201 | 201 | $orderShippingAddress->setDni($customer->getTaxvat()); |
@@ -235,11 +235,11 @@ discard block |
||
235 | 235 | |
236 | 236 | $promotedProduct = $this->isPromoted($item); |
237 | 237 | if ($promotedProduct == 'true') { |
238 | - $promotedAmount+=$product->getAmount()*$item->getQty(); |
|
239 | - $promotedMessage = 'Promoted Item: ' . $item->getName() . |
|
240 | - ' Price: ' . $item->getPrice() . |
|
241 | - ' Qty: ' . $item->getQty() . |
|
242 | - ' Item ID: ' . $item->getItemId(); |
|
238 | + $promotedAmount += $product->getAmount() * $item->getQty(); |
|
239 | + $promotedMessage = 'Promoted Item: '.$item->getName(). |
|
240 | + ' Price: '.$item->getPrice(). |
|
241 | + ' Qty: '.$item->getQty(). |
|
242 | + ' Item ID: '.$item->getItemId(); |
|
243 | 243 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
244 | 244 | } |
245 | 245 | } |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | $uriRoute = 'pagantis/notify/indexV2'; |
261 | 261 | } |
262 | 262 | |
263 | - $okUrlUser = $this->_url->getUrl($uriRoute, ['_query' => ['quoteId'=>$quoteId,'origin'=>'redirect','product'=>$pgProduct]]); |
|
264 | - $okUrlNot = $this->_url->getUrl($uriRoute, ['_query' => ['quoteId'=>$quoteId,'origin'=>'notification','product'=>$pgProduct]]); |
|
265 | - $okUrl = $this->_url->getUrl($uriRoute, ['_query' => ['quoteId'=>$quoteId,'origin'=>'redirect','product'=>$pgProduct]]); |
|
263 | + $okUrlUser = $this->_url->getUrl($uriRoute, ['_query' => ['quoteId'=>$quoteId, 'origin'=>'redirect', 'product'=>$pgProduct]]); |
|
264 | + $okUrlNot = $this->_url->getUrl($uriRoute, ['_query' => ['quoteId'=>$quoteId, 'origin'=>'notification', 'product'=>$pgProduct]]); |
|
265 | + $okUrl = $this->_url->getUrl($uriRoute, ['_query' => ['quoteId'=>$quoteId, 'origin'=>'redirect', 'product'=>$pgProduct]]); |
|
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 |
@@ -304,7 +301,7 @@ discard block |
||
304 | 301 | ; |
305 | 302 | |
306 | 303 | if ($pgProduct === ConfigProvider::CODE4X) { |
307 | - if ($this->config['pagantis_public_key_4x']=='' || $this->config['pagantis_private_key_4x']=='') { |
|
304 | + if ($this->config['pagantis_public_key_4x'] == '' || $this->config['pagantis_private_key_4x'] == '') { |
|
308 | 305 | throw new \Exception('Public and Secret Key not found'); |
309 | 306 | } else { |
310 | 307 | $orderClient = new Client( |
@@ -313,7 +310,7 @@ discard block |
||
313 | 310 | ); |
314 | 311 | } |
315 | 312 | } else { |
316 | - if ($this->config['pagantis_public_key']=='' || $this->config['pagantis_private_key']=='') { |
|
313 | + if ($this->config['pagantis_public_key'] == '' || $this->config['pagantis_private_key'] == '') { |
|
317 | 314 | throw new \Exception('Public and Secret Key not found'); |
318 | 315 | } else { |
319 | 316 | $orderClient = new Client( |
@@ -340,7 +337,7 @@ discard block |
||
340 | 337 | } |
341 | 338 | |
342 | 339 | $displayMode = $this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE']; |
343 | - if ($displayMode==='0') { |
|
340 | + if ($displayMode === '0') { |
|
344 | 341 | echo $url; |
345 | 342 | exit; |
346 | 343 | } else { |
@@ -362,11 +359,11 @@ discard block |
||
362 | 359 | private function getOrders($customerId) |
363 | 360 | { |
364 | 361 | $orderCollection = array(); |
365 | - if ($customerId!='') { |
|
362 | + if ($customerId != '') { |
|
366 | 363 | $this->orderCollection->addAttributeToFilter('customer_id', $customerId) |
367 | 364 | ->addAttributeToFilter( |
368 | 365 | 'status', |
369 | - ['in' => ['processing','pending','complete']] |
|
366 | + ['in' => ['processing', 'pending', 'complete']] |
|
370 | 367 | ) |
371 | 368 | ->load(); |
372 | 369 | $orderCollection = $this->orderCollection->getData(); |
@@ -409,7 +406,7 @@ discard block |
||
409 | 406 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
410 | 407 | return $dbConnection->insertOnDuplicate( |
411 | 408 | $tableName, |
412 | - array('id'=>$quoteId,'order_id'=>$pagantisOrderId), |
|
409 | + array('id'=>$quoteId, 'order_id'=>$pagantisOrderId), |
|
413 | 410 | array('order_id') |
414 | 411 | ); |
415 | 412 | } |