@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | -define('_PS_PAYLATER_DIR', _PS_MODULE_DIR_. '/pagantis'); |
|
14 | +define('_PS_PAYLATER_DIR', _PS_MODULE_DIR_.'/pagantis'); |
|
15 | 15 | |
16 | 16 | require _PS_PAYLATER_DIR.'/vendor/autoload.php'; |
17 | 17 | |
@@ -194,18 +194,18 @@ discard block |
||
194 | 194 | public function checkHooks() |
195 | 195 | { |
196 | 196 | try { |
197 | - $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where |
|
198 | - id_module = \'' . Module::getModuleIdByName($this->name) . '\' and |
|
199 | - id_shop = \'' . Shop::getContextShopID() . '\' and |
|
200 | - id_hook = \'' . Hook::getIdByName('header') . '\''; |
|
197 | + $sql_content = 'select * from '._DB_PREFIX_.'hook_module where |
|
198 | + id_module = \'' . Module::getModuleIdByName($this->name).'\' and |
|
199 | + id_shop = \'' . Shop::getContextShopID().'\' and |
|
200 | + id_hook = \'' . Hook::getIdByName('header').'\''; |
|
201 | 201 | $hook_exists = Db::getInstance()->ExecuteS($sql_content); |
202 | 202 | if (empty($hook_exists)) { |
203 | - $sql_insert = 'insert into ' . _DB_PREFIX_. 'hook_module |
|
203 | + $sql_insert = 'insert into '._DB_PREFIX_.'hook_module |
|
204 | 204 | (id_module, id_shop, id_hook, position) |
205 | 205 | values |
206 | - (\''. Module::getModuleIdByName($this->name) . '\', |
|
207 | - \''. Shop::getContextShopID() . '\', |
|
208 | - \''. Hook::getIdByName('header') . '\', |
|
206 | + (\''. Module::getModuleIdByName($this->name).'\', |
|
207 | + \''. Shop::getContextShopID().'\', |
|
208 | + \''. Hook::getIdByName('header').'\', |
|
209 | 209 | 150)'; |
210 | 210 | Db::getInstance()->execute($sql_insert); |
211 | 211 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | public function loadEnvVariables() |
218 | 218 | { |
219 | - $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config'; |
|
219 | + $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config'; |
|
220 | 220 | $dbConfigs = Db::getInstance()->executeS($sql_content); |
221 | 221 | |
222 | 222 | // Convert a multimple dimension array for SQL insert statements into a simple key/value |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | foreach (array_merge($this->defaultConfigs, $simpleDbConfigs) as $key => $value) { |
240 | - putenv($key . '=' . $value); |
|
240 | + putenv($key.'='.$value); |
|
241 | 241 | } |
242 | 242 | |
243 | - putenv("PAGANTIS_DEFAULT_CONFIGS" . '=' . json_encode($this->defaultConfigs)); |
|
243 | + putenv("PAGANTIS_DEFAULT_CONFIGS".'='.json_encode($this->defaultConfigs)); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | } else { |
321 | 321 | $this->context->controller->addJS('https://cdn.pagamastarde.com/js/pmt-v2/sdk.js'); |
322 | 322 | } |
323 | - $this->context->controller->addJS($this->getPathUri(). 'views/js/simulator.js'); |
|
323 | + $this->context->controller->addJS($this->getPathUri().'views/js/simulator.js'); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $paymentOption |
371 | 371 | ->setCallToActionText($pagantisTitle) |
372 | 372 | ->setAction($link->getModuleLink('pagantis', 'payment')) |
373 | - ->setLogo($this->getPathUri(). 'logo.gif') |
|
373 | + ->setLogo($this->getPathUri().'logo.gif') |
|
374 | 374 | ->setModuleName(__CLASS__) |
375 | 375 | ; |
376 | 376 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | 'input' => array( |
401 | 401 | array( |
402 | 402 | 'name' => 'pagantis_is_enabled', |
403 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
403 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
404 | 404 | 'label' => $this->l('Module is enabled'), |
405 | 405 | 'prefix' => '<i class="icon icon-key"></i>', |
406 | 406 | 'class' => 't', |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | ), |
441 | 441 | array( |
442 | 442 | 'name' => 'pagantis_simulator_is_enabled', |
443 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
443 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
444 | 444 | 'label' => $this->l('Simulator is enabled'), |
445 | 445 | 'prefix' => '<i class="icon icon-key"></i>', |
446 | 446 | 'class' => 't', |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | $message = $this->displayError($error); |
557 | 557 | } |
558 | 558 | |
559 | - $logo = $this->getPathUri(). 'views/img/logo_pagantis.png'; |
|
559 | + $logo = $this->getPathUri().'views/img/logo_pagantis.png'; |
|
560 | 560 | $tpl = $this->local_path.'views/templates/admin/config-info.tpl'; |
561 | 561 | $this->context->smarty->assign(array( |
562 | 562 | 'logo' => $logo, |
@@ -748,10 +748,10 @@ discard block |
||
748 | 748 | */ |
749 | 749 | public function checkLogoExists() |
750 | 750 | { |
751 | - $logo = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/'. Tools::strtolower(__CLASS__). '.png'; |
|
752 | - if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) { |
|
751 | + $logo = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/'.Tools::strtolower(__CLASS__).'.png'; |
|
752 | + if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) { |
|
753 | 753 | copy( |
754 | - _PS_PAYLATER_DIR . '/views/img/logo-64x64.png', |
|
754 | + _PS_PAYLATER_DIR.'/views/img/logo-64x64.png', |
|
755 | 755 | $logo |
756 | 756 | ); |
757 | 757 | } |
@@ -82,8 +82,8 @@ |
||
82 | 82 | $pagantisPublicKey = Configuration::get('pagantis_public_key'); |
83 | 83 | $pagantisPrivateKey = Configuration::get('pagantis_private_key'); |
84 | 84 | $okUrl = _PS_BASE_URL_SSL_.__PS_BASE_URI__ |
85 | - .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&' |
|
86 | - .http_build_query($query) |
|
85 | + .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&' |
|
86 | + .http_build_query($query) |
|
87 | 87 | ; |
88 | 88 | |
89 | 89 | $shippingAddress = new Address($cart->id_address_delivery); |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | { |
26 | 26 | if (_PS_VERSION_ < 1.6) { |
27 | 27 | Logger::addLog( |
28 | - 'Pagantis Exception For user ' . |
|
29 | - $customer->email . |
|
30 | - ' : ' . |
|
28 | + 'Pagantis 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 | - 'Pagantis Exception For user ' . |
|
41 | - $customer->email . |
|
42 | - ' : ' . |
|
40 | + 'Pagantis 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 \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
101 | + $userAddress = new \Pagantis\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 \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
110 | + $orderShippingAddress = new \Pagantis\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 \Pagantis\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 \Pagantis\OrdersApiClient\Client( |
225 | 225 | $pagantisPublicKey, |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | if ($order instanceof \Pagantis\OrdersApiClient\Model\Order) { |
230 | 230 | $url = $order->getActionUrls()->getForm(); |
231 | 231 | $orderId = $order->getId(); |
232 | - $sql = "INSERT INTO `" . _DB_PREFIX_ . "pagantis_order` (`id`, `order_id`) |
|
232 | + $sql = "INSERT INTO `"._DB_PREFIX_."pagantis_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 pagantis-order-id in database: '. $sql); |
|
237 | + throw new UnknownException('Unable to save pagantis-order-id in database: '.$sql); |
|
238 | 238 | } |
239 | 239 | } else { |
240 | 240 | throw new OrderNotFoundException(); |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | public function initContent() |
19 | 19 | { |
20 | 20 | $this->authorize(); |
21 | - $method = Tools::strtolower($_SERVER['REQUEST_METHOD']) . "Method"; |
|
21 | + $method = Tools::strtolower($_SERVER['REQUEST_METHOD'])."Method"; |
|
22 | 22 | if (method_exists($this, $method)) { |
23 | 23 | header('HTTP/1.1 200 Ok', true, 200); |
24 | 24 | header('Content-Type: application/json', true); |
25 | 25 | $result = json_encode($this->{$method}()); |
26 | - header('Content-Length: ' . Tools::strlen($result)); |
|
26 | + header('Content-Length: '.Tools::strlen($result)); |
|
27 | 27 | echo $result; |
28 | 28 | exit(); |
29 | 29 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | Db::getInstance()->update( |
52 | 52 | 'pagantis_config', |
53 | 53 | array('value' => pSQL($value)), |
54 | - 'config = \''. pSQL($config) .'\'' |
|
54 | + 'config = \''.pSQL($config).'\'' |
|
55 | 55 | ); |
56 | 56 | } else { |
57 | 57 | $errors[$config] = $value; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getMethod() |
77 | 77 | { |
78 | - $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config'; |
|
78 | + $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config'; |
|
79 | 79 | $dbConfigs = Db::getInstance()->executeS($sql_content); |
80 | 80 | |
81 | 81 | $simpleDbConfigs = array(); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | private function getPagantisOrderId() |
192 | 192 | { |
193 | 193 | try { |
194 | - $this->pagantisOrderId= Db::getInstance()->getValue( |
|
194 | + $this->pagantisOrderId = Db::getInstance()->getValue( |
|
195 | 195 | 'select order_id from '._DB_PREFIX_.'pagantis_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->pagantisOrder->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,8 +272,8 @@ discard block |
||
272 | 272 | Configuration::get('PS_OS_PAYMENT'), |
273 | 273 | $this->merchantOrder->getOrderTotal(true), |
274 | 274 | $this->module->displayName, |
275 | - 'pagantisOrderId: ' . $this->pagantisOrder->getId(). |
|
276 | - 'pagantisOrderStatus: '. $this->pagantisOrder->getStatus(), |
|
275 | + 'pagantisOrderId: '.$this->pagantisOrder->getId(). |
|
276 | + 'pagantisOrderStatus: '.$this->pagantisOrder->getStatus(), |
|
277 | 277 | array('transaction_id' => $this->pagantisOrderId), |
278 | 278 | null, |
279 | 279 | false, |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | protected function unblockConcurrency() |
333 | 333 | { |
334 | 334 | try { |
335 | - Db::getInstance()->delete('pagantis_cart_process', 'timestamp < ' . (time() - 6)); |
|
335 | + Db::getInstance()->delete('pagantis_cart_process', 'timestamp < '.(time() - 6)); |
|
336 | 336 | } catch (\Exception $exception) { |
337 | 337 | throw new ConcurrencyException(); |
338 | 338 | } |
@@ -350,15 +350,15 @@ discard block |
||
350 | 350 | { |
351 | 351 | sleep(5); |
352 | 352 | if ($this->merchantOrder) { |
353 | - $id = (!is_null($this->pagantisOrder))?$this->pagantisOrder->getId():null; |
|
354 | - $status = (!is_null($this->pagantisOrder))?$this->pagantisOrder->getStatus():null; |
|
353 | + $id = (!is_null($this->pagantisOrder)) ? $this->pagantisOrder->getId() : null; |
|
354 | + $status = (!is_null($this->pagantisOrder)) ? $this->pagantisOrder->getStatus() : null; |
|
355 | 355 | $this->module->validateOrder( |
356 | 356 | $this->merchantOrderId, |
357 | 357 | Configuration::get('PS_OS_ERROR'), |
358 | 358 | $this->merchantOrder->getOrderTotal(true), |
359 | 359 | $this->module->displayName, |
360 | - 'pagantisOrderId: ' . $id. |
|
361 | - 'pagantisOrderStatus: '. $status, |
|
360 | + 'pagantisOrderId: '.$id. |
|
361 | + 'pagantisOrderStatus: '.$status, |
|
362 | 362 | null, |
363 | 363 | null, |
364 | 364 | false, |
@@ -394,9 +394,9 @@ discard block |
||
394 | 394 | 'id_cart' => $this->merchantOrderId, |
395 | 395 | 'key' => $this->config['secureKey'], |
396 | 396 | 'id_module' => $this->module->id, |
397 | - 'id_order' => ($this->pagantisOrder)?$this->pagantisOrder->getId(): null, |
|
397 | + 'id_order' => ($this->pagantisOrder) ? $this->pagantisOrder->getId() : null, |
|
398 | 398 | ); |
399 | - $url = ($error)? $this->config['urlKO'] : $this->config['urlOK']; |
|
399 | + $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK']; |
|
400 | 400 | return $this->redirect($url, $parameters); |
401 | 401 | } |
402 | 402 | } |