@@ -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,13 +301,13 @@ 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($this->config['pagantis_public_key_4x'], $this->config['pagantis_private_key_4x']); |
| 311 | 308 | } |
| 312 | 309 | } else { |
| 313 | - if ($this->config['pagantis_public_key']=='' || $this->config['pagantis_private_key']=='') { |
|
| 310 | + if ($this->config['pagantis_public_key'] == '' || $this->config['pagantis_private_key'] == '') { |
|
| 314 | 311 | throw new \Exception('Public and Secret Key not found'); |
| 315 | 312 | } else { |
| 316 | 313 | $orderClient = new Client($this->config['pagantis_public_key'], $this->config['pagantis_private_key']); |
@@ -334,7 +331,7 @@ discard block |
||
| 334 | 331 | } |
| 335 | 332 | |
| 336 | 333 | $displayMode = $this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE']; |
| 337 | - if ($displayMode==='0') { |
|
| 334 | + if ($displayMode === '0') { |
|
| 338 | 335 | echo $url; |
| 339 | 336 | exit; |
| 340 | 337 | } else { |
@@ -356,11 +353,11 @@ discard block |
||
| 356 | 353 | private function getOrders($customerId) |
| 357 | 354 | { |
| 358 | 355 | $orderCollection = array(); |
| 359 | - if ($customerId!='') { |
|
| 356 | + if ($customerId != '') { |
|
| 360 | 357 | $this->orderCollection->addAttributeToFilter('customer_id', $customerId) |
| 361 | 358 | ->addAttributeToFilter( |
| 362 | 359 | 'status', |
| 363 | - ['in' => ['processing','pending','complete']] |
|
| 360 | + ['in' => ['processing', 'pending', 'complete']] |
|
| 364 | 361 | ) |
| 365 | 362 | ->load(); |
| 366 | 363 | $orderCollection = $this->orderCollection->getData(); |
@@ -403,7 +400,7 @@ discard block |
||
| 403 | 400 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
| 404 | 401 | return $dbConnection->insertOnDuplicate( |
| 405 | 402 | $tableName, |
| 406 | - array('id'=>$quoteId,'order_id'=>$pagantisOrderId), |
|
| 403 | + array('id'=>$quoteId, 'order_id'=>$pagantisOrderId), |
|
| 407 | 404 | array('order_id') |
| 408 | 405 | ); |
| 409 | 406 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | public function getFinalPrice4x() |
| 307 | 307 | { |
| 308 | - return number_format($this->getProduct()->getFinalPrice()/4, 2); |
|
| 308 | + return number_format($this->getProduct()->getFinalPrice() / 4, 2); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | $minAmount = $this->getMinAmount(); |
| 543 | 543 | $totalPrice = (string) floor($this->getFinalPrice()); |
| 544 | 544 | |
| 545 | - return ($totalPrice>=$minAmount && ($totalPrice<=$maxAmount||$maxAmount=='0')); |
|
| 545 | + return ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount == '0')); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | /** |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | $minAmount = $this->getMinAmount4x(); |
| 555 | 555 | $totalPrice = (string) floor($this->getFinalPrice()); |
| 556 | 556 | |
| 557 | - return ($totalPrice>=$minAmount && ($totalPrice<=$maxAmount||$maxAmount=='0')); |
|
| 557 | + return ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount == '0')); |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | /** |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | public function execute(\Magento\Framework\Event\Observer $observer) |
| 18 | 18 | { |
| 19 | 19 | try { |
| 20 | - if ($observer->getEvent()->getMethodInstance()->getCode()==ConfigProvider::CODE) { |
|
| 20 | + if ($observer->getEvent()->getMethodInstance()->getCode() == ConfigProvider::CODE) { |
|
| 21 | 21 | $checkResult = $observer->getEvent()->getResult(); |
| 22 | 22 | $totalPrice = (string) floor($observer->getEvent()->getQuote()->getGrandTotal()); |
| 23 | 23 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | $availableCountry = (in_array(strtolower($locale), $allowedCountries)); |
| 30 | 30 | $maxAmount = $extraConfig['PAGANTIS_DISPLAY_MAX_AMOUNT']; |
| 31 | 31 | $minAmount = $extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']; |
| 32 | - $validAmount = ($totalPrice>=$minAmount && ($totalPrice<=$maxAmount||$maxAmount=='0')); |
|
| 32 | + $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount == '0')); |
|
| 33 | 33 | $disabledPg = (!isset($config['pagantis_public_key']) || $config['pagantis_public_key'] == '' || |
| 34 | 34 | !isset($config['pagantis_private_key']) || $config['pagantis_private_key'] == '' || |
| 35 | - !$availableCountry || !$validAmount || $config['active_12x']!=='1' |
|
| 36 | - || $config['active']!=='1' ); |
|
| 35 | + !$availableCountry || !$validAmount || $config['active_12x'] !== '1' |
|
| 36 | + || $config['active'] !== '1'); |
|
| 37 | 37 | if ($disabledPg) { |
| 38 | 38 | $checkResult->setData('is_available', false); |
| 39 | 39 | } else { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if ($observer->getEvent()->getMethodInstance()->getCode()==ConfigProvider::CODE4X) { |
|
| 44 | + if ($observer->getEvent()->getMethodInstance()->getCode() == ConfigProvider::CODE4X) { |
|
| 45 | 45 | $checkResult = $observer->getEvent()->getResult(); |
| 46 | 46 | $totalPrice = (string) floor($observer->getEvent()->getQuote()->getGrandTotal()); |
| 47 | 47 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | $availableCountry = (in_array(strtolower($locale), $allowedCountries)); |
| 54 | 54 | $maxAmount = $extraConfig['PAGANTIS_DISPLAY_MAX_AMOUNT_4x']; |
| 55 | 55 | $minAmount = $extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT_4x']; |
| 56 | - $validAmount = ($totalPrice>=$minAmount && ($totalPrice<=$maxAmount||$maxAmount=='0')); |
|
| 57 | - $disabledPg4x = (!isset($config['pagantis_public_key_4x']) || $config['pagantis_public_key_4x']=='' || |
|
| 58 | - !isset($config['pagantis_private_key_4x']) || $config['pagantis_private_key_4x']=='' || |
|
| 59 | - !$availableCountry || !$validAmount || $config['active_4x']!=='1' |
|
| 60 | - || $config['active']!=='1' ); |
|
| 56 | + $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount == '0')); |
|
| 57 | + $disabledPg4x = (!isset($config['pagantis_public_key_4x']) || $config['pagantis_public_key_4x'] == '' || |
|
| 58 | + !isset($config['pagantis_private_key_4x']) || $config['pagantis_private_key_4x'] == '' || |
|
| 59 | + !$availableCountry || !$validAmount || $config['active_4x'] !== '1' |
|
| 60 | + || $config['active'] !== '1'); |
|
| 61 | 61 | if ($disabledPg4x) { |
| 62 | 62 | $checkResult->setData('is_available', false); |
| 63 | 63 | } else { |