@@ -26,9 +26,9 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $originalData = $element->getOriginalData(); |
| 28 | 28 | $label = __($originalData['button_label']); |
| 29 | - $url = $this->escapeHtml($originalData['button_url']); |
|
| 29 | + $url = $this->escapeHtml($originalData['button_url']); |
|
| 30 | 30 | $labelCredentials = __($originalData['button_credentials_label']); |
| 31 | - $urlCredentials = $this->escapeHtml($originalData['button_credentials_url']); |
|
| 31 | + $urlCredentials = $this->escapeHtml($originalData['button_credentials_url']); |
|
| 32 | 32 | return <<<EOD |
| 33 | 33 | <div class="pp-buttons-container"> |
| 34 | 34 | <button onclick="javascript:window.open('$url')" class="scalable" type="button" id="bo_paylater"> |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($elementSearch); |
| 73 | 73 | $this->webDriver->wait()->until($condition); |
| 74 | 74 | $otherElement = $this->findById('payment_us_other_payment_methods-head'); |
| 75 | - if ($otherElement->getAttribute('class')!='open') { |
|
| 75 | + if ($otherElement->getAttribute('class') != 'open') { |
|
| 76 | 76 | $otherElement->click(); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $this->webDriver->wait()->until($condition); |
| 82 | 82 | $this->assertTrue((bool) $condition, "PR4"); |
| 83 | 83 | $paylaterElement = $this->findById('payment_us_paylater-head'); |
| 84 | - if ($paylaterElement->getAttribute('class')!='open') { |
|
| 84 | + if ($paylaterElement->getAttribute('class') != 'open') { |
|
| 85 | 85 | $paylaterElement->click(); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $this->webDriver->get(self::MAGENTO_URL.self::CHECKOUT_FOLDER); |
| 279 | 279 | $condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); |
| 280 | 280 | $this->webDriver->wait()->until($condition); |
| 281 | - $this->assertTrue((bool)$condition, self::MAGENTO_URL.self::CHECKOUT_FOLDER); |
|
| 281 | + $this->assertTrue((bool) $condition, self::MAGENTO_URL.self::CHECKOUT_FOLDER); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $this->webDriver->wait()->until($condition); |
| 292 | 292 | $this->assertTrue((bool) $condition); |
| 293 | 293 | $this->assertSame( |
| 294 | - $this->configuration['firstname'] . ' ' . $this->configuration['lastname'], |
|
| 294 | + $this->configuration['firstname'].' '.$this->configuration['lastname'], |
|
| 295 | 295 | $this->findByClass('FieldsPreview-desc')->getText() |
| 296 | 296 | ); |
| 297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | { |
| 306 | 306 | $condition = WebDriverExpectedCondition::titleContains(self::PMT_TITLE); |
| 307 | 307 | $this->webDriver->wait(300)->until($condition, $this->webDriver->getCurrentURL()); |
| 308 | - $this->assertTrue((bool)$condition, $this->webDriver->getCurrentURL()); |
|
| 308 | + $this->assertTrue((bool) $condition, $this->webDriver->getCurrentURL()); |
|
| 309 | 309 | |
| 310 | 310 | SeleniumHelper::finishForm($this->webDriver); |
| 311 | 311 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public function execute(\Magento\Framework\Event\Observer $observer) |
| 17 | 17 | { |
| 18 | 18 | try { |
| 19 | - if ($observer->getEvent()->getMethodInstance()->getCode()=="paylater") { |
|
| 19 | + if ($observer->getEvent()->getMethodInstance()->getCode() == "paylater") { |
|
| 20 | 20 | $checkResult = $observer->getEvent()->getResult(); |
| 21 | 21 | $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); |
| 22 | 22 | $config = $objectManager->create('DigitalOrigin\Pmt\Helper\Config')->getConfig(); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $this->orderRepositoryInterface = $orderRepositoryInterface; |
| 116 | 116 | $this->dbObject = $dbObject; |
| 117 | 117 | $this->checkoutSession = $checkoutSession; |
| 118 | - $this->notifyResult = array('notification_message'=>'','notification_error'=>true); |
|
| 118 | + $this->notifyResult = array('notification_message'=>'', 'notification_error'=>true); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | header('HTTP/1.1 200 Ok', true, 200); |
| 152 | 152 | } |
| 153 | 153 | header('Content-Type: application/json', true); |
| 154 | - header('Content-Length: ' . strlen($response)); |
|
| 154 | + header('Content-Length: '.strlen($response)); |
|
| 155 | 155 | echo ($response); |
| 156 | 156 | exit(); |
| 157 | 157 | } else { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | private function getQuoteId() |
| 168 | 168 | { |
| 169 | - if ($this->getRequest()->getParam('quoteId')=='') { |
|
| 169 | + if ($this->getRequest()->getParam('quoteId') == '') { |
|
| 170 | 170 | $this->notifyResult['notification_error'] = false; |
| 171 | 171 | throw new \Exception(self::NO_QUOTE); |
| 172 | 172 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $pmtOrderId = $this->getPmtOrderId(); |
| 188 | 188 | $orderClient = new Client($this->config['public_key'], $this->config['secret_key']); |
| 189 | 189 | $this->pmtOrder = $orderClient->getOrder($pmtOrderId); |
| 190 | - $this->checkPmtStatus(array('CONFIRMED','AUTHORIZED')); |
|
| 190 | + $this->checkPmtStatus(array('CONFIRMED', 'AUTHORIZED')); |
|
| 191 | 191 | |
| 192 | 192 | $this->quote = $this->quoteRepository->get($this->quoteId); |
| 193 | 193 | $this->checkCartStatus(); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | private function checkCartStatus() |
| 264 | 264 | { |
| 265 | - if ($this->quote->getIsActive()=='0') { |
|
| 265 | + if ($this->quote->getIsActive() == '0') { |
|
| 266 | 266 | $this->magentoOrderId = $this->getMgOrderId(); |
| 267 | 267 | $this->notifyResult['notification_error'] = false; |
| 268 | 268 | throw new \Exception(self::ALREADY_PROCESSED); |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | private function getRedirectUrl() |
| 300 | 300 | { |
| 301 | 301 | $returnUrl = 'checkout/#payment'; |
| 302 | - if ($this->magentoOrderId!='') { |
|
| 302 | + if ($this->magentoOrderId != '') { |
|
| 303 | 303 | /** @var Order $order */ |
| 304 | 304 | $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId); |
| 305 | 305 | if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) { |
@@ -313,8 +313,8 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | //Magento status flow => https://docs.magento.com/m2/ce/user_guide/sales/order-status-workflow.html |
| 315 | 315 | //Order Workflow => https://docs.magento.com/m2/ce/user_guide/sales/order-workflow.html |
| 316 | - $orderStatus = strtolower($this->magentoOrder->getStatus()); |
|
| 317 | - $acceptedStatus = array('processing', 'completed'); |
|
| 316 | + $orderStatus = strtolower($this->magentoOrder->getStatus()); |
|
| 317 | + $acceptedStatus = array('processing', 'completed'); |
|
| 318 | 318 | if (in_array($orderStatus, $acceptedStatus)) { |
| 319 | 319 | if ($this->config['ok_url'] != '') { |
| 320 | 320 | $returnUrl = $this->config['ok_url']; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $tableName = $this->dbObject->getTableName(self::CONCURRENCY_TABLE); |
| 357 | 357 | if ($mode == false) { |
| 358 | 358 | $dbConnection->delete($tableName, "timestamp<".(time() - 5)); |
| 359 | - } elseif ($this->quoteId!='') { |
|
| 359 | + } elseif ($this->quoteId != '') { |
|
| 360 | 360 | $dbConnection->delete($tableName, "id=".$this->quoteId); |
| 361 | 361 | } |
| 362 | 362 | } catch (Exception $exception) { |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $query = "select mg_order_id from $tableName where id='$this->quoteId' and order_id='$pmtOrderId'"; |
| 415 | 415 | $queryResult = $dbConnection->fetchRow($query); |
| 416 | 416 | |
| 417 | - if ($queryResult['mg_order_id']=='') { |
|
| 417 | + if ($queryResult['mg_order_id'] == '') { |
|
| 418 | 418 | $this->notifyResult['notification_error'] = false; |
| 419 | 419 | throw new \Exception(self::NO_MGID); |
| 420 | 420 | } |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | $customer = $quote->getCustomer(); |
| 105 | 105 | $shippingAddress = $quote->getShippingAddress(); |
| 106 | 106 | |
| 107 | - if (isset($params['email']) && $params['email']!='') { |
|
| 107 | + if (isset($params['email']) && $params['email'] != '') { |
|
| 108 | 108 | $this->session->setEmail($params['email']); //Get guest email after refresh page |
| 109 | 109 | $customer->setEmail($params['email']); |
| 110 | 110 | $quote->setCheckoutMethod('guest'); |
| 111 | 111 | $quote->getBillingAddress()->setEmail($params['email']); |
| 112 | - } elseif ($customer->getEmail()=='') { |
|
| 112 | + } elseif ($customer->getEmail() == '') { |
|
| 113 | 113 | $customer->setEmail($this->session->getEmail()); |
| 114 | 114 | $quote->setCheckoutMethod('guest'); |
| 115 | 115 | $quote->getBillingAddress()->setEmail($this->session->getEmail()); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $currentQuote->setCustomerEmail($customer->getEmail()); |
| 121 | 121 | $this->quoteRepository->save($currentQuote); |
| 122 | 122 | |
| 123 | - $userAddress = new Address(); |
|
| 123 | + $userAddress = new Address(); |
|
| 124 | 124 | $userAddress |
| 125 | 125 | ->setZipCode($shippingAddress->getPostcode()) |
| 126 | 126 | ->setFullName($shippingAddress->getFirstname()." ".$shippingAddress->getLastname()) |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | ->setMobilePhone($shippingAddress->getTelephone()) |
| 141 | 141 | ; |
| 142 | 142 | |
| 143 | - $orderBillingAddress = new Address(); |
|
| 143 | + $orderBillingAddress = new Address(); |
|
| 144 | 144 | $billingAddress = $quote->getBillingAddress(); |
| 145 | 145 | $orderBillingAddress |
| 146 | 146 | ->setZipCode($billingAddress->getPostcode()) |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | try { |
| 249 | - if ($this->config['public_key']=='' || $this->config['secret_key']=='') { |
|
| 249 | + if ($this->config['public_key'] == '' || $this->config['secret_key'] == '') { |
|
| 250 | 250 | throw new \Exception('Public and Secret Key not found'); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | private function getOrders($customerId) |
| 295 | 295 | { |
| 296 | 296 | $orderCollection = array(); |
| 297 | - if ($customerId!='') { |
|
| 297 | + if ($customerId != '') { |
|
| 298 | 298 | $this->orderCollection->addAttributeToFilter('customer_id', $customerId) |
| 299 | 299 | ->addAttributeToFilter( |
| 300 | 300 | 'status', |
| 301 | - ['in' => ['processing','pending','complete']] |
|
| 301 | + ['in' => ['processing', 'pending', 'complete']] |
|
| 302 | 302 | ) |
| 303 | 303 | ->load(); |
| 304 | 304 | $orderCollection = $this->orderCollection->getData(); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE); |
| 332 | 332 | return $dbConnection->insertOnDuplicate( |
| 333 | 333 | $tableName, |
| 334 | - array('id'=>$quoteId,'order_id'=>$pmtOrderId), |
|
| 334 | + array('id'=>$quoteId, 'order_id'=>$pmtOrderId), |
|
| 335 | 335 | array('order_id') |
| 336 | 336 | ); |
| 337 | 337 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $curlVersion = $curlInfo['version']; |
| 346 | 346 | $magentoVersion = $this->productMetadataInterface->getVersion(); |
| 347 | 347 | $moduleInfo = $this->moduleList->getOne('DigitalOrigin_Pmt'); |
| 348 | - return array( 'magento' => $magentoVersion, |
|
| 348 | + return array('magento' => $magentoVersion, |
|
| 349 | 349 | 'pmt' => $moduleInfo['setup_version'], |
| 350 | 350 | 'php' => phpversion(), |
| 351 | 351 | 'curl' => $curlVersion); |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | header('Expires: 0'); |
| 32 | 32 | header('Cache-Control: must-revalidate'); |
| 33 | 33 | header('Pragma: public'); |
| 34 | - header('Content-Length: ' . filesize($file)); |
|
| 34 | + header('Content-Length: '.filesize($file)); |
|
| 35 | 35 | readfile($file); |
| 36 | 36 | exit; |
| 37 | 37 | } else { |