@@ -44,7 +44,7 @@ |
||
| 44 | 44 | |
| 45 | 45 | header('HTTP/1.1 200 Ok', true, 200); |
| 46 | 46 | header('Content-Type: application/json', true); |
| 47 | - header('Content-Length: ' . Tools::strlen($result)); |
|
| 47 | + header('Content-Length: '.Tools::strlen($result)); |
|
| 48 | 48 | |
| 49 | 49 | echo $result; |
| 50 | 50 | exit(); |
@@ -72,8 +72,8 @@ |
||
| 72 | 72 | $paylaterPublicKey = Configuration::get('pmt_public_key'); |
| 73 | 73 | $paylaterPrivateKey = Configuration::get('pmt_private_key'); |
| 74 | 74 | $okUrl = _PS_BASE_URL_.__PS_BASE_URI__ |
| 75 | - .'index.php?canonical=true&fc=module&module=paylater&controller=notify&' |
|
| 76 | - .http_build_query($query) |
|
| 75 | + .'index.php?canonical=true&fc=module&module=paylater&controller=notify&' |
|
| 76 | + .http_build_query($query) |
|
| 77 | 77 | ; |
| 78 | 78 | |
| 79 | 79 | $shippingAddress = new Address($cart->id_address_delivery); |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | if (_PS_VERSION_ < 1.6) { |
| 26 | 26 | Logger::addLog( |
| 27 | - 'PagaMasTarde Exception For user ' . |
|
| 28 | - $customer->email . |
|
| 29 | - ' : ' . |
|
| 27 | + 'PagaMasTarde Exception For user '. |
|
| 28 | + $customer->email. |
|
| 29 | + ' : '. |
|
| 30 | 30 | $exception->getMessage(), |
| 31 | 31 | 3, |
| 32 | 32 | $exception->getCode(), |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | ); |
| 37 | 37 | } else { |
| 38 | 38 | PrestaShopLogger::addLog( |
| 39 | - 'PagaMasTarde Exception For user ' . |
|
| 40 | - $customer->email . |
|
| 41 | - ' : ' . |
|
| 39 | + 'PagaMasTarde Exception For user '. |
|
| 40 | + $customer->email. |
|
| 41 | + ' : '. |
|
| 42 | 42 | $exception->getMessage(), |
| 43 | 43 | 3, |
| 44 | 44 | $exception->getCode(), |
@@ -97,22 +97,22 @@ discard block |
||
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | 99 | try { |
| 100 | - $userAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
|
| 100 | + $userAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
|
| 101 | 101 | $userAddress |
| 102 | 102 | ->setZipCode($shippingAddress->postcode) |
| 103 | - ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname) |
|
| 103 | + ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname) |
|
| 104 | 104 | ->setCountryCode('ES') |
| 105 | 105 | ->setCity($shippingAddress->city) |
| 106 | - ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2) |
|
| 106 | + ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2) |
|
| 107 | 107 | ; |
| 108 | 108 | |
| 109 | - $orderShippingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
|
| 109 | + $orderShippingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
|
| 110 | 110 | $orderShippingAddress |
| 111 | 111 | ->setZipCode($shippingAddress->postcode) |
| 112 | - ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname) |
|
| 112 | + ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname) |
|
| 113 | 113 | ->setCountryCode('ES') |
| 114 | 114 | ->setCity($shippingAddress->city) |
| 115 | - ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2) |
|
| 115 | + ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2) |
|
| 116 | 116 | ->setDni($shippingAddress->dni) |
| 117 | 117 | ->setFixPhone($shippingAddress->phone) |
| 118 | 118 | ->setMobilePhone($shippingAddress->phone_mobile) |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | $orderBillingAddress = new \PagaMasTarde\OrdersApiClient\Model\Order\User\Address(); |
| 122 | 122 | $orderBillingAddress |
| 123 | 123 | ->setZipCode($billingAddress->postcode) |
| 124 | - ->setFullName($billingAddress->firstname . ' ' . $billingAddress->lastname) |
|
| 124 | + ->setFullName($billingAddress->firstname.' '.$billingAddress->lastname) |
|
| 125 | 125 | ->setCountryCode('ES') |
| 126 | 126 | ->setCity($billingAddress->city) |
| 127 | - ->setAddress($billingAddress->address1 . ' ' . $billingAddress->address2) |
|
| 127 | + ->setAddress($billingAddress->address1.' '.$billingAddress->address2) |
|
| 128 | 128 | ->setDni($billingAddress->dni) |
| 129 | 129 | ->setFixPhone($billingAddress->phone) |
| 130 | 130 | ->setMobilePhone($billingAddress->phone_mobile) |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | ->setDni($shippingAddress->dni) |
| 143 | 143 | ; |
| 144 | 144 | |
| 145 | - if ($customer->birthday!='0000-00-00') { |
|
| 145 | + if ($customer->birthday != '0000-00-00') { |
|
| 146 | 146 | $orderUser->setDateOfBirth($customer->birthday); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | Tools::redirect($cancelUrl); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $url =''; |
|
| 221 | + $url = ''; |
|
| 222 | 222 | try { |
| 223 | 223 | $orderClient = new \PagaMasTarde\OrdersApiClient\Client( |
| 224 | 224 | $paylaterPublicKey, |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $url = $order->getActionUrls()->getForm(); |
| 230 | 230 | $orderId = $order->getId(); |
| 231 | 231 | $result = Db::getInstance()->execute( |
| 232 | - "INSERT INTO `" . _DB_PREFIX_ . "pmt_order` (`id`, `order_id`) |
|
| 232 | + "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 | ); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | header('HTTP/1.1 200 Ok', true, 200); |
| 68 | 68 | header('Content-Type: application/json', true); |
| 69 | - header('Content-Length: ' . Tools::strlen($result)); |
|
| 69 | + header('Content-Length: '.Tools::strlen($result)); |
|
| 70 | 70 | |
| 71 | 71 | echo $result; |
| 72 | 72 | exit(); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | header('HTTP/1.1 403 Forbidden', true, 403); |
| 92 | 92 | header('Content-Type: application/json', true); |
| 93 | - header('Content-Length: ' . Tools::strlen($result)); |
|
| 93 | + header('Content-Length: '.Tools::strlen($result)); |
|
| 94 | 94 | |
| 95 | 95 | echo $result; |
| 96 | 96 | exit(); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | { |
| 35 | 35 | $parsedUrl = parse_url($url); |
| 36 | 36 | $separator = ($parsedUrl['query'] == null) ? '?' : '&'; |
| 37 | - $redirectUrl = $url. $separator . http_build_query($parameters); |
|
| 37 | + $redirectUrl = $url.$separator.http_build_query($parameters); |
|
| 38 | 38 | Tools::redirect($redirectUrl); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -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 | |
@@ -62,18 +62,18 @@ discard block |
||
| 62 | 62 | $continue = true; |
| 63 | 63 | if (Module::isInstalled($this->name)) { |
| 64 | 64 | if (!$this->upgrade()) { |
| 65 | - $this->context->controller->errors[] = $this->l('Unable to write file') . |
|
| 66 | - ' ' . _PS_PAYLATER_DIR . '/.env ' . |
|
| 65 | + $this->context->controller->errors[] = $this->l('Unable to write file'). |
|
| 66 | + ' '._PS_PAYLATER_DIR.'/.env '. |
|
| 67 | 67 | $this->l('Ensure that the file exists and have the correct permissions'); |
| 68 | - $this->dotEnvError = $this->l('Unable to write file') . |
|
| 69 | - ' ' . _PS_PAYLATER_DIR . '/.env ' . |
|
| 68 | + $this->dotEnvError = $this->l('Unable to write file'). |
|
| 69 | + ' '._PS_PAYLATER_DIR.'/.env '. |
|
| 70 | 70 | $this->l('Ensure that the file exists and have the correct permissions'); |
| 71 | 71 | $continue = false; |
| 72 | 72 | } |
| 73 | 73 | } else { |
| 74 | 74 | copy( |
| 75 | - _PS_PAYLATER_DIR . '/.env.dist', |
|
| 76 | - _PS_PAYLATER_DIR . '/.env' |
|
| 75 | + _PS_PAYLATER_DIR.'/.env.dist', |
|
| 76 | + _PS_PAYLATER_DIR.'/.env' |
|
| 77 | 77 | ); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | $envFile = new Dotenv\Dotenv(_PS_PAYLATER_DIR); |
| 86 | 86 | $envFile->load(); |
| 87 | 87 | } catch (\Exception $exception) { |
| 88 | - $this->context->controller->errors[] = $this->l('Unable to read file') . |
|
| 89 | - ' ' . _PS_PAYLATER_DIR . '/.env ' . |
|
| 88 | + $this->context->controller->errors[] = $this->l('Unable to read file'). |
|
| 89 | + ' '._PS_PAYLATER_DIR.'/.env '. |
|
| 90 | 90 | $this->l('Ensure that the file exists and have the correct permissions'); |
| 91 | - $this->dotEnvError = $this->l('Unable to read file') . |
|
| 92 | - ' ' . _PS_PAYLATER_DIR . '/.env ' . |
|
| 91 | + $this->dotEnvError = $this->l('Unable to read file'). |
|
| 92 | + ' '._PS_PAYLATER_DIR.'/.env '. |
|
| 93 | 93 | $this->l('Ensure that the file exists and have the correct permissions'); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -158,16 +158,16 @@ discard block |
||
| 158 | 158 | public function upgrade() |
| 159 | 159 | { |
| 160 | 160 | |
| 161 | - if (file_exists(_PS_PAYLATER_DIR . '/.env') && !is_writable(_PS_PAYLATER_DIR . '/.env')) { |
|
| 161 | + if (file_exists(_PS_PAYLATER_DIR.'/.env') && !is_writable(_PS_PAYLATER_DIR.'/.env')) { |
|
| 162 | 162 | return false; |
| 163 | 163 | } |
| 164 | - $envFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR . '/.env'); |
|
| 165 | - $distFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR . '/.env.dist'); |
|
| 166 | - $distFile = Tools::file_get_contents(_PS_PAYLATER_DIR . '/.env.dist'); |
|
| 164 | + $envFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR.'/.env'); |
|
| 165 | + $distFileVariables = $this->readEnvFileAsArray(_PS_PAYLATER_DIR.'/.env.dist'); |
|
| 166 | + $distFile = Tools::file_get_contents(_PS_PAYLATER_DIR.'/.env.dist'); |
|
| 167 | 167 | |
| 168 | 168 | $newEnvFileArr = array_merge($distFileVariables, $envFileVariables); |
| 169 | 169 | $newEnvFile = $this->replaceEnvFileValues($distFile, $newEnvFileArr); |
| 170 | - file_put_contents(_PS_PAYLATER_DIR . '/.env', $newEnvFile); |
|
| 170 | + file_put_contents(_PS_PAYLATER_DIR.'/.env', $newEnvFile); |
|
| 171 | 171 | |
| 172 | 172 | // migrating pk/tk from previous version |
| 173 | 173 | if (Configuration::get('pmt_public_key') === false && Configuration::get('PAYLATER_PUBLIC_KEY_PROD')) { |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | $from = strpos($envFile, $key); |
| 226 | 226 | if ($from !== false) { |
| 227 | 227 | $to = strpos($envFile, '#', $from); |
| 228 | - $fromReplace = Tools::substr($envFile, $from, (($to - $from)-1)); |
|
| 229 | - $toReplace = $key . '=' . $value; |
|
| 228 | + $fromReplace = Tools::substr($envFile, $from, (($to - $from) - 1)); |
|
| 229 | + $toReplace = $key.'='.$value; |
|
| 230 | 230 | $envFile = str_replace($fromReplace, $toReplace, $envFile); |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $paymentOption |
| 334 | 334 | ->setCallToActionText($pmtTitle) |
| 335 | 335 | ->setAction($link->getModuleLink('paylater', 'payment')) |
| 336 | - ->setLogo($this->getPathUri(). 'logo.gif') |
|
| 336 | + ->setLogo($this->getPathUri().'logo.gif') |
|
| 337 | 337 | ->setModuleName(__CLASS__) |
| 338 | 338 | ; |
| 339 | 339 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | 'input' => array( |
| 368 | 368 | array( |
| 369 | 369 | 'name' => 'pmt_is_enabled', |
| 370 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
| 370 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
| 371 | 371 | 'label' => $this->l('Module is enabled'), |
| 372 | 372 | 'prefix' => '<i class="icon icon-key"></i>', |
| 373 | 373 | 'class' => 't', |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | ), |
| 408 | 408 | array( |
| 409 | 409 | 'name' => 'pmt_simulator_is_enabled', |
| 410 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
| 410 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
| 411 | 411 | 'label' => $this->l('Simulator is enabled'), |
| 412 | 412 | 'prefix' => '<i class="icon icon-key"></i>', |
| 413 | 413 | 'class' => 't', |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $message = $this->displayError($this->dotEnvError); |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - $logo = $this->getPathUri(). 'views/img/logo_pagamastarde.png'; |
|
| 529 | + $logo = $this->getPathUri().'views/img/logo_pagamastarde.png'; |
|
| 530 | 530 | $tpl = $this->local_path.'views/templates/admin/config-info.tpl'; |
| 531 | 531 | $this->context->smarty->assign(array( |
| 532 | 532 | 'logo' => $logo, |
@@ -703,10 +703,10 @@ discard block |
||
| 703 | 703 | */ |
| 704 | 704 | public function checkLogoExists() |
| 705 | 705 | { |
| 706 | - $logo = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/'. Tools::strtolower(__CLASS__). '.png'; |
|
| 707 | - if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) { |
|
| 706 | + $logo = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/'.Tools::strtolower(__CLASS__).'.png'; |
|
| 707 | + if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) { |
|
| 708 | 708 | copy( |
| 709 | - _PS_PAYLATER_DIR . '/views/img/logo-64x64.png', |
|
| 709 | + _PS_PAYLATER_DIR.'/views/img/logo-64x64.png', |
|
| 710 | 710 | $logo |
| 711 | 711 | ); |
| 712 | 712 | } |
@@ -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 | } |