@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | private function getPmtOrderId() |
| 192 | 192 | { |
| 193 | 193 | try { |
| 194 | - $this->pmtOrderId= Db::getInstance()->getValue( |
|
| 194 | + $this->pmtOrderId = Db::getInstance()->getValue( |
|
| 195 | 195 | 'select order_id from '._DB_PREFIX_.'pmt_order where id = '.$this->merchantOrderId |
| 196 | 196 | ); |
| 197 | 197 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | public function validateAmount() |
| 254 | 254 | { |
| 255 | 255 | $totalAmount = $this->pmtOrder->getShoppingCart()->getTotalAmount(); |
| 256 | - $merchantAmount = (int)((string) (100 * $this->merchantOrder->getOrderTotal(true))); |
|
| 256 | + $merchantAmount = (int) ((string) (100 * $this->merchantOrder->getOrderTotal(true))); |
|
| 257 | 257 | if ($totalAmount != $merchantAmount) { |
| 258 | 258 | throw new AmountMismatchException($totalAmount, $merchantAmount); |
| 259 | 259 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | Configuration::get('PS_OS_PAYMENT'), |
| 273 | 273 | $this->merchantOrder->getOrderTotal(true), |
| 274 | 274 | $this->module->displayName, |
| 275 | - 'pmtOrderId: ' . $this->pmtOrder->getId(), |
|
| 275 | + 'pmtOrderId: '.$this->pmtOrder->getId(), |
|
| 276 | 276 | array('transaction_id' => $this->pmtOrderId), |
| 277 | 277 | null, |
| 278 | 278 | false, |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | protected function unblockConcurrency() |
| 332 | 332 | { |
| 333 | 333 | try { |
| 334 | - Db::getInstance()->delete('pmt_cart_process', 'timestamp < ' . (time() - 6)); |
|
| 334 | + Db::getInstance()->delete('pmt_cart_process', 'timestamp < '.(time() - 6)); |
|
| 335 | 335 | } catch (\Exception $exception) { |
| 336 | 336 | throw new ConcurrencyException(); |
| 337 | 337 | } |
@@ -348,13 +348,13 @@ discard block |
||
| 348 | 348 | public function cancelProcess($response = null) |
| 349 | 349 | { |
| 350 | 350 | if ($this->merchantOrder) { |
| 351 | - $id = (!is_null($this->pmtOrder))?$this->pmtOrder->getId():null; |
|
| 351 | + $id = (!is_null($this->pmtOrder)) ? $this->pmtOrder->getId() : null; |
|
| 352 | 352 | $this->module->validateOrder( |
| 353 | 353 | $this->merchantOrderId, |
| 354 | 354 | Configuration::get('PS_OS_ERROR'), |
| 355 | 355 | $this->merchantOrder->getOrderTotal(true), |
| 356 | 356 | $this->module->displayName, |
| 357 | - 'pmtOrderId: ' . $id, |
|
| 357 | + 'pmtOrderId: '.$id, |
|
| 358 | 358 | null, |
| 359 | 359 | null, |
| 360 | 360 | false, |
@@ -390,9 +390,9 @@ discard block |
||
| 390 | 390 | 'id_cart' => $this->merchantOrderId, |
| 391 | 391 | 'key' => $this->config['secureKey'], |
| 392 | 392 | 'id_module' => $this->module->id, |
| 393 | - 'id_order' => ($this->pmtOrder)?$this->pmtOrder->getId(): null, |
|
| 393 | + 'id_order' => ($this->pmtOrder) ? $this->pmtOrder->getId() : null, |
|
| 394 | 394 | ); |
| 395 | - $url = ($error)? $this->config['urlKO'] : $this->config['urlOK']; |
|
| 395 | + $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK']; |
|
| 396 | 396 | return $this->redirect($url, $parameters); |
| 397 | 397 | } |
| 398 | 398 | } |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | if (_PS_VERSION_ < 1.6) { |
| 27 | 27 | Logger::addLog( |
| 28 | - 'PagaMasTarde Exception For user ' . |
|
| 29 | - $customer->email . |
|
| 30 | - ' : ' . |
|
| 28 | + 'PagaMasTarde Exception For user '. |
|
| 29 | + $customer->email. |
|
| 30 | + ' : '. |
|
| 31 | 31 | $exception->getMessage(), |
| 32 | 32 | 3, |
| 33 | 33 | $exception->getCode(), |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | ); |
| 38 | 38 | } else { |
| 39 | 39 | PrestaShopLogger::addLog( |
| 40 | - 'PagaMasTarde Exception For user ' . |
|
| 41 | - $customer->email . |
|
| 42 | - ' : ' . |
|
| 40 | + 'PagaMasTarde Exception For user '. |
|
| 41 | + $customer->email. |
|
| 42 | + ' : '. |
|
| 43 | 43 | $exception->getMessage(), |
| 44 | 44 | 3, |
| 45 | 45 | $exception->getCode(), |
@@ -98,22 +98,22 @@ discard block |
||
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | 100 | try { |
| 101 | - $userAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
|
| 101 | + $userAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
|
| 102 | 102 | $userAddress |
| 103 | 103 | ->setZipCode($shippingAddress->postcode) |
| 104 | - ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname) |
|
| 104 | + ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname) |
|
| 105 | 105 | ->setCountryCode('ES') |
| 106 | 106 | ->setCity($shippingAddress->city) |
| 107 | - ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2) |
|
| 107 | + ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2) |
|
| 108 | 108 | ; |
| 109 | 109 | |
| 110 | - $orderShippingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
|
| 110 | + $orderShippingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
|
| 111 | 111 | $orderShippingAddress |
| 112 | 112 | ->setZipCode($shippingAddress->postcode) |
| 113 | - ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname) |
|
| 113 | + ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname) |
|
| 114 | 114 | ->setCountryCode('ES') |
| 115 | 115 | ->setCity($shippingAddress->city) |
| 116 | - ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2) |
|
| 116 | + ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2) |
|
| 117 | 117 | ->setDni($shippingAddress->dni) |
| 118 | 118 | ->setFixPhone($shippingAddress->phone) |
| 119 | 119 | ->setMobilePhone($shippingAddress->phone_mobile) |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | $orderBillingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
| 123 | 123 | $orderBillingAddress |
| 124 | 124 | ->setZipCode($billingAddress->postcode) |
| 125 | - ->setFullName($billingAddress->firstname . ' ' . $billingAddress->lastname) |
|
| 125 | + ->setFullName($billingAddress->firstname.' '.$billingAddress->lastname) |
|
| 126 | 126 | ->setCountryCode('ES') |
| 127 | 127 | ->setCity($billingAddress->city) |
| 128 | - ->setAddress($billingAddress->address1 . ' ' . $billingAddress->address2) |
|
| 128 | + ->setAddress($billingAddress->address1.' '.$billingAddress->address2) |
|
| 129 | 129 | ->setDni($billingAddress->dni) |
| 130 | 130 | ->setFixPhone($billingAddress->phone) |
| 131 | 131 | ->setMobilePhone($billingAddress->phone_mobile) |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ->setDni($shippingAddress->dni) |
| 144 | 144 | ; |
| 145 | 145 | |
| 146 | - if ($customer->birthday!='0000-00-00') { |
|
| 146 | + if ($customer->birthday != '0000-00-00') { |
|
| 147 | 147 | $orderUser->setDateOfBirth($customer->birthday); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | Tools::redirect($cancelUrl); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - $url =''; |
|
| 222 | + $url = ''; |
|
| 223 | 223 | try { |
| 224 | 224 | $orderClient = new \PagaMasTarde\OrdersApiClient\Client( |
| 225 | 225 | $paylaterPublicKey, |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | if ($order instanceof \PagaMasTarde\OrdersApiClient\Model\Order) { |
| 230 | 230 | $url = $order->getActionUrls()->getForm(); |
| 231 | 231 | $orderId = $order->getId(); |
| 232 | - $sql = "INSERT INTO `" . _DB_PREFIX_ . "pmt_order` (`id`, `order_id`) |
|
| 232 | + $sql = "INSERT INTO `"._DB_PREFIX_."pmt_order` (`id`, `order_id`) |
|
| 233 | 233 | VALUES ('$cart->id','$orderId') |
| 234 | 234 | ON DUPLICATE KEY UPDATE `order_id` = '$orderId'"; |
| 235 | 235 | $result = Db::getInstance()->execute($sql); |
| 236 | 236 | if (!$result) { |
| 237 | - throw new UnknownException('Unable to save pmt-order-id in database: '. $sql); |
|
| 237 | + throw new UnknownException('Unable to save pmt-order-id in database: '.$sql); |
|
| 238 | 238 | } |
| 239 | 239 | } else { |
| 240 | 240 | throw new OrderNotFoundException(); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -define('_PS_PAYLATER_DIR', _PS_MODULE_DIR_. '/paylater'); |
|
| 14 | +define('_PS_PAYLATER_DIR', _PS_MODULE_DIR_.'/paylater'); |
|
| 15 | 15 | |
| 16 | 16 | require _PS_PAYLATER_DIR.'/vendor/autoload.php'; |
| 17 | 17 | |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | 'Instant, easy and effective financial tool for your customers' |
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | - if (!file_exists(_PS_PAYLATER_DIR . '/.env')) { |
|
| 61 | + if (!file_exists(_PS_PAYLATER_DIR.'/.env')) { |
|
| 62 | 62 | copy( |
| 63 | - _PS_PAYLATER_DIR . '/.env.dist', |
|
| 64 | - _PS_PAYLATER_DIR . '/.env' |
|
| 63 | + _PS_PAYLATER_DIR.'/.env.dist', |
|
| 64 | + _PS_PAYLATER_DIR.'/.env' |
|
| 65 | 65 | ); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | $envFile = new Dotenv\Dotenv(_PS_PAYLATER_DIR); |
| 72 | 72 | $envFile->load(); |
| 73 | 73 | } catch (\Exception $exception) { |
| 74 | - $this->context->controller->errors[] = $this->l('Unable to read file') . |
|
| 75 | - ' ' . _PS_PAYLATER_DIR . '/.env ' . |
|
| 74 | + $this->context->controller->errors[] = $this->l('Unable to read file'). |
|
| 75 | + ' '._PS_PAYLATER_DIR.'/.env '. |
|
| 76 | 76 | $this->l('Ensure that the file exists and have the correct permissions'); |
| 77 | - $this->dotEnvError = $this->l('Unable to read file') . |
|
| 78 | - ' ' . _PS_PAYLATER_DIR . '/.env ' . |
|
| 77 | + $this->dotEnvError = $this->l('Unable to read file'). |
|
| 78 | + ' '._PS_PAYLATER_DIR.'/.env '. |
|
| 79 | 79 | $this->l('Ensure that the file exists and have the correct permissions'); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | return false; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if (file_exists(_PS_PAYLATER_DIR . '/.env')) { |
|
| 108 | + if (file_exists(_PS_PAYLATER_DIR.'/.env')) { |
|
| 109 | 109 | $this->upgrade(); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -147,16 +147,16 @@ discard block |
||
| 147 | 147 | $sql_file = dirname(__FILE__).'/sql/install.sql'; |
| 148 | 148 | $this->loadSQLFile($sql_file); |
| 149 | 149 | |
| 150 | - if (file_exists(_PS_PAYLATER_DIR . '/.env') && file_exists(_PS_PAYLATER_DIR . '/.env.dist')) { |
|
| 151 | - $envFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR . '/.env'); |
|
| 152 | - $distFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR . '/.env.dist'); |
|
| 153 | - $distFile = Tools::file_get_contents(_PS_PAYLATER_DIR . '/.env.dist'); |
|
| 150 | + if (file_exists(_PS_PAYLATER_DIR.'/.env') && file_exists(_PS_PAYLATER_DIR.'/.env.dist')) { |
|
| 151 | + $envFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR.'/.env'); |
|
| 152 | + $distFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR.'/.env.dist'); |
|
| 153 | + $distFile = Tools::file_get_contents(_PS_PAYLATER_DIR.'/.env.dist'); |
|
| 154 | 154 | |
| 155 | 155 | if ($distFileVariables != $envFileVariables) { |
| 156 | 156 | $newEnvFileArr = array_merge($distFileVariables, $envFileVariables); |
| 157 | 157 | $newEnvFile = $this->replaceEnvFileValues($distFile, $newEnvFileArr); |
| 158 | 158 | |
| 159 | - file_put_contents(_PS_PAYLATER_DIR . '/.env', $newEnvFile); |
|
| 159 | + file_put_contents(_PS_PAYLATER_DIR.'/.env', $newEnvFile); |
|
| 160 | 160 | |
| 161 | 161 | // migrating pk/tk from previous version |
| 162 | 162 | if (Configuration::get('pmt_public_key') === false |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | $from = strpos($envFile, $key); |
| 224 | 224 | if ($from !== false) { |
| 225 | 225 | $to = strpos($envFile, '#', $from); |
| 226 | - $fromReplace = Tools::substr($envFile, $from, (($to - $from)-1)); |
|
| 227 | - $toReplace = $key . '=' . $value; |
|
| 226 | + $fromReplace = Tools::substr($envFile, $from, (($to - $from) - 1)); |
|
| 227 | + $toReplace = $key.'='.$value; |
|
| 228 | 228 | $envFile = str_replace($fromReplace, $toReplace, $envFile); |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $paymentOption |
| 332 | 332 | ->setCallToActionText($pmtTitle) |
| 333 | 333 | ->setAction($link->getModuleLink('paylater', 'payment')) |
| 334 | - ->setLogo($this->getPathUri(). 'logo.gif') |
|
| 334 | + ->setLogo($this->getPathUri().'logo.gif') |
|
| 335 | 335 | ->setModuleName(__CLASS__) |
| 336 | 336 | ; |
| 337 | 337 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | 'input' => array( |
| 366 | 366 | array( |
| 367 | 367 | 'name' => 'pmt_is_enabled', |
| 368 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
| 368 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
| 369 | 369 | 'label' => $this->l('Module is enabled'), |
| 370 | 370 | 'prefix' => '<i class="icon icon-key"></i>', |
| 371 | 371 | 'class' => 't', |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | ), |
| 406 | 406 | array( |
| 407 | 407 | 'name' => 'pmt_simulator_is_enabled', |
| 408 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
| 408 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
| 409 | 409 | 'label' => $this->l('Simulator is enabled'), |
| 410 | 410 | 'prefix' => '<i class="icon icon-key"></i>', |
| 411 | 411 | 'class' => 't', |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | $message = $this->displayError($this->dotEnvError); |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - $logo = $this->getPathUri(). 'views/img/logo_pagamastarde.png'; |
|
| 527 | + $logo = $this->getPathUri().'views/img/logo_pagamastarde.png'; |
|
| 528 | 528 | $tpl = $this->local_path.'views/templates/admin/config-info.tpl'; |
| 529 | 529 | $this->context->smarty->assign(array( |
| 530 | 530 | 'logo' => $logo, |
@@ -701,10 +701,10 @@ discard block |
||
| 701 | 701 | */ |
| 702 | 702 | public function checkLogoExists() |
| 703 | 703 | { |
| 704 | - $logo = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/'. Tools::strtolower(__CLASS__). '.png'; |
|
| 705 | - if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) { |
|
| 704 | + $logo = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/'.Tools::strtolower(__CLASS__).'.png'; |
|
| 705 | + if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) { |
|
| 706 | 706 | copy( |
| 707 | - _PS_PAYLATER_DIR . '/views/img/logo-64x64.png', |
|
| 707 | + _PS_PAYLATER_DIR.'/views/img/logo-64x64.png', |
|
| 708 | 708 | $logo |
| 709 | 709 | ); |
| 710 | 710 | } |