Completed
Push — master ( 7cc2c2...10410a )
by Cesar
11s
created
controllers/front/log.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
controllers/front/payment.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,8 +72,8 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 );
Please login to merge, or discard this patch.
controllers/front/api.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
paylater.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 
@@ -63,24 +63,24 @@  discard block
 block discarded – undo
63 63
             $this->upgrade();
64 64
         } else {
65 65
             copy(
66
-                $_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name . '/.env.dist',
67
-                $_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name . '/.env'
66
+                $_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name.'/.env.dist',
67
+                $_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name.'/.env'
68 68
             );
69 69
         }
70 70
 
71 71
 
72
-        $sql_file = dirname($_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name).'/sql/install.sql';
72
+        $sql_file = dirname($_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name).'/sql/install.sql';
73 73
         $this->loadSQLFile($sql_file);
74 74
 
75 75
         try {
76
-            $envFile = new Dotenv\Dotenv($_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name);
76
+            $envFile = new Dotenv\Dotenv($_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name);
77 77
             $envFile->load();
78 78
         } catch (\Exception $exception) {
79
-            $this->context->controller->errors[] = $this->l('Unable to read file') .
80
-                ' ' . $_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name . '/.env ' .
79
+            $this->context->controller->errors[] = $this->l('Unable to read file').
80
+                ' '.$_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name.'/.env '.
81 81
                 $this->l('Ensure that the file exists and have the correct permissions');
82
-            $this->dotEnvError = $this->l('Unable to read file') .
83
-                ' ' . $_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name . '/.env ' .
82
+            $this->dotEnvError = $this->l('Unable to read file').
83
+                ' '.$_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name.'/.env '.
84 84
                 $this->l('Ensure that the file exists and have the correct permissions');
85 85
         }
86 86
 
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
     public function upgrade()
150 150
     {
151 151
 
152
-        if (!is_writable($_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name . '/.env')) {
152
+        if (!is_writable($_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name.'/.env')) {
153 153
             return false;
154 154
         }
155
-        $envFileVariables = $this->readEnvFileAsArray($_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name . '/.env');
156
-        $distFileVariables = $this->readEnvFileAsArray($_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name . '/.env.dist');
157
-        $distFile = Tools::file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name . '/.env.dist');
155
+        $envFileVariables = $this->readEnvFileAsArray($_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name.'/.env');
156
+        $distFileVariables = $this->readEnvFileAsArray($_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name.'/.env.dist');
157
+        $distFile = Tools::file_get_contents($_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name.'/.env.dist');
158 158
 
159 159
         $newEnvFileArr = array_merge($distFileVariables, $envFileVariables);
160 160
         $newEnvFile = $this->replaceEnvFileValues($distFile, $newEnvFileArr);
161
-        file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/modules/' . $this->name . '/.env', $newEnvFile);
161
+        file_put_contents($_SERVER['DOCUMENT_ROOT'].'/modules/'.$this->name.'/.env', $newEnvFile);
162 162
         return true;
163 163
     }
164 164
 
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
             $from = strpos($envFile, $key);
202 202
             if ($from !== false) {
203 203
                 $to = strpos($envFile, '#', $from);
204
-                $fromReplace = Tools::substr($envFile, $from, (($to - $from)-1));
205
-                $toReplace = $key . '=' . $value;
204
+                $fromReplace = Tools::substr($envFile, $from, (($to - $from) - 1));
205
+                $toReplace = $key.'='.$value;
206 206
                 $envFile = str_replace($fromReplace, $toReplace, $envFile);
207 207
             }
208 208
         }
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
         $cart                       = $this->context->cart;
245 245
         $currency                   = new Currency($cart->id_currency);
246 246
         $availableCurrencies        = array('EUR');
247
-        $pmtDisplayMinAmount          = getenv('PMT_DISPLAY_MIN_AMOUNT');
247
+        $pmtDisplayMinAmount = getenv('PMT_DISPLAY_MIN_AMOUNT');
248 248
         $pmtPublicKey               = Configuration::get('pmt_public_key');
249
-        $pmtPrivateKey             = Configuration::get('pmt_private_key');
249
+        $pmtPrivateKey = Configuration::get('pmt_private_key');
250 250
 
251 251
         return (
252 252
             $cart->getOrderTotal() >= $pmtDisplayMinAmount &&
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
         $paymentOption
310 310
             ->setCallToActionText($pmtTitle)
311 311
             ->setAction($link->getModuleLink('paylater', 'payment'))
312
-            ->setLogo($this->getPathUri(). 'logo.gif')
312
+            ->setLogo($this->getPathUri().'logo.gif')
313 313
             ->setModuleName(__CLASS__)
314 314
         ;
315 315
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
                 'input' => array(
344 344
                     array(
345 345
                         'name' => 'pmt_is_enabled',
346
-                        'type' =>  (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
346
+                        'type' =>  (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
347 347
                         'label' => $this->l('Module is enabled'),
348 348
                         'prefix' => '<i class="icon icon-key"></i>',
349 349
                         'class' => 't',
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
                     ),
384 384
                     array(
385 385
                         'name' => 'pmt_simulator_is_enabled',
386
-                        'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
386
+                        'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
387 387
                         'label' => $this->l('Simulator is enabled'),
388 388
                         'prefix' => '<i class="icon icon-key"></i>',
389 389
                         'class' => 't',
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
             $message = $this->displayError($this->dotEnvError);
503 503
         }
504 504
 
505
-        $logo = $this->getPathUri(). 'views/img/logo_pagamastarde.png';
505
+        $logo = $this->getPathUri().'views/img/logo_pagamastarde.png';
506 506
         $tpl = $this->local_path.'views/templates/admin/config-info.tpl';
507 507
         $this->context->smarty->assign(array(
508 508
             'logo' => $logo,
@@ -679,10 +679,10 @@  discard block
 block discarded – undo
679 679
      */
680 680
     public function checkLogoExists()
681 681
     {
682
-        $logo = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/'. Tools::strtolower(__CLASS__). '.png';
683
-        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) {
682
+        $logo = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/'.Tools::strtolower(__CLASS__).'.png';
683
+        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) {
684 684
             copy(
685
-                _PS_PAYLATER_DIR . '/views/img/logo-64x64.png',
685
+                _PS_PAYLATER_DIR.'/views/img/logo-64x64.png',
686 686
                 $logo
687 687
             );
688 688
         }
Please login to merge, or discard this patch.
controllers/front/AbstractController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
controllers/front/notify.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     private function getPmtOrderId()
195 195
     {
196 196
         try {
197
-            $this->pmtOrderId= Db::getInstance()->getValue(
197
+            $this->pmtOrderId = Db::getInstance()->getValue(
198 198
                 'select order_id from '._DB_PREFIX_.'pmt_order where id = '.$this->merchantOrderId
199 199
             );
200 200
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     public function validateAmount()
257 257
     {
258 258
         $totalAmount = $this->pmtOrder->getShoppingCart()->getTotalAmount();
259
-        $merchantAmount = (int)((string) (100 * $this->merchantOrder->getOrderTotal(true)));
259
+        $merchantAmount = (int) ((string) (100 * $this->merchantOrder->getOrderTotal(true)));
260 260
         if ($totalAmount != $merchantAmount) {
261 261
             throw new AmountMismatchException($totalAmount, $merchantAmount);
262 262
         }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
                 Configuration::get('PS_OS_PAYMENT'),
276 276
                 $this->merchantOrder->getOrderTotal(true),
277 277
                 $this->module->displayName,
278
-                'pmtOrderId: ' . $this->pmtOrder->getId(),
278
+                'pmtOrderId: '.$this->pmtOrder->getId(),
279 279
                 array('transaction_id' => $this->pmtOrderId),
280 280
                 null,
281 281
                 false,
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     protected function unblockConcurrency()
335 335
     {
336 336
         try {
337
-            Db::getInstance()->delete('pmt_cart_process', 'timestamp < ' . (time() - 6));
337
+            Db::getInstance()->delete('pmt_cart_process', 'timestamp < '.(time() - 6));
338 338
         } catch (\Exception $exception) {
339 339
             throw new ConcurrencyException();
340 340
         }
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
     public function cancelProcess()
350 350
     {
351 351
         if ($this->merchantOrder) {
352
-            $id = (!is_null($this->pmtOrder))?$this->pmtOrder->getId():null;
352
+            $id = (!is_null($this->pmtOrder)) ? $this->pmtOrder->getId() : null;
353 353
             $this->module->validateOrder(
354 354
                 $this->merchantOrderId,
355 355
                 Configuration::get('PS_OS_ERROR'),
356 356
                 $this->merchantOrder->getOrderTotal(true),
357 357
                 $this->module->displayName,
358
-                'pmtOrderId: ' . $id,
358
+                'pmtOrderId: '.$id,
359 359
                 null,
360 360
                 null,
361 361
                 false,
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
         $method = $debug[1]['function'];
368 368
         $line = $debug[1]['line'];
369 369
         $this->saveLog(array(
370
-            'message' => array (
371
-                'pmtOrderId: ' . $this->pmtOrderId,
370
+            'message' => array(
371
+                'pmtOrderId: '.$this->pmtOrderId,
372 372
                 'pmtOrderId' => $this->pmtOrderId,
373 373
                 'merchantOrderId' => $this->merchantOrderId,
374 374
                 'method' => $method,
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
             'id_cart' => $this->merchantOrderId,
396 396
             'key' => $this->config['secureKey'],
397 397
             'id_module' => $this->module->id,
398
-            'id_order' => ($this->pmtOrder)?$this->pmtOrder->getId(): null,
398
+            'id_order' => ($this->pmtOrder) ? $this->pmtOrder->getId() : null,
399 399
         );
400
-        $url = ($error)? $this->config['urlKO'] : $this->config['urlOK'];
400
+        $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK'];
401 401
         return $this->redirect($url, $parameters);
402 402
     }
403 403
 }
Please login to merge, or discard this patch.