Passed
Pull Request — master (#34)
by Raúl
03:39 queued 01:18
created
controllers/front/payment.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,8 +83,8 @@
 block discarded – undo
83 83
         $pagantisPublicKey = Configuration::get('pagantis_public_key');
84 84
         $pagantisPrivateKey = Configuration::get('pagantis_private_key');
85 85
         $okUrl = _PS_BASE_URL_.__PS_BASE_URI__
86
-                 .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&'
87
-                 .http_build_query($query)
86
+                    .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&'
87
+                    .http_build_query($query)
88 88
         ;
89 89
 
90 90
         $shippingAddress = new Address($cart->id_address_delivery);
Please login to merge, or discard this patch.
controllers/front/config.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
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
         }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function getExtraConfigs()
40 40
     {
41
-        $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config';
41
+        $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config';
42 42
         $dbConfigs = Db::getInstance()->executeS($sql_content);
43 43
 
44 44
         $simpleDbConfigs = array();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                     Db::getInstance()->update(
68 68
                         'pagantis_config',
69 69
                         array('value' => pSQL($value)),
70
-                        'config = \''. pSQL($config) .'\''
70
+                        'config = \''.pSQL($config).'\''
71 71
                     );
72 72
                 } else {
73 73
                     $errors[$config] = $value;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function getMethod()
93 93
     {
94
-        $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config';
94
+        $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config';
95 95
         $dbConfigs = Db::getInstance()->executeS($sql_content);
96 96
 
97 97
         $simpleDbConfigs = array();
Please login to merge, or discard this patch.
pagantis.php 1 patch
Spacing   +19 added lines, -19 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_PAGANTIS_DIR', _PS_MODULE_DIR_. '/pagantis');
14
+define('_PS_PAGANTIS_DIR', _PS_MODULE_DIR_.'/pagantis');
15 15
 
16 16
 require _PS_PAGANTIS_DIR.'/vendor/autoload.php';
17 17
 
@@ -195,18 +195,18 @@  discard block
 block discarded – undo
195 195
     public function checkHooks()
196 196
     {
197 197
         try {
198
-            $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where 
199
-            id_module = \'' . Module::getModuleIdByName($this->name) . '\' and 
200
-            id_shop = \'' . Shop::getContextShopID() . '\' and 
201
-            id_hook = \'' . Hook::getIdByName('header') . '\'';
198
+            $sql_content = 'select * from '._DB_PREFIX_.'hook_module where 
199
+            id_module = \'' . Module::getModuleIdByName($this->name).'\' and 
200
+            id_shop = \'' . Shop::getContextShopID().'\' and 
201
+            id_hook = \'' . Hook::getIdByName('header').'\'';
202 202
             $hook_exists = Db::getInstance()->ExecuteS($sql_content);
203 203
             if (empty($hook_exists)) {
204
-                $sql_insert = 'insert into ' . _DB_PREFIX_.  'hook_module 
204
+                $sql_insert = 'insert into '._DB_PREFIX_.'hook_module 
205 205
             (id_module, id_shop, id_hook, position)
206 206
             values
207
-            (\''. Module::getModuleIdByName($this->name) . '\',
208
-            \''. Shop::getContextShopID() . '\',
209
-            \''. Hook::getIdByName('header') . '\',
207
+            (\''. Module::getModuleIdByName($this->name).'\',
208
+            \''. Shop::getContextShopID().'\',
209
+            \''. Hook::getIdByName('header').'\',
210 210
             150)';
211 211
                 Db::getInstance()->execute($sql_insert);
212 212
             }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      */
221 221
     public function checkEnvVariables()
222 222
     {
223
-        $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config';
223
+        $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config';
224 224
         $dbConfigs = Db::getInstance()->executeS($sql_content);
225 225
 
226 226
         // Convert a multimple dimension array for SQL insert statements into a simple key/value
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
         } else {
318 318
             $this->context->controller->addJS('https://cdn.pagantis.com/js/pg-v2/sdk.js');
319 319
         }
320
-        $this->context->controller->addJS($this->getPathUri(). 'views/js/simulator.js');
320
+        $this->context->controller->addJS($this->getPathUri().'views/js/simulator.js');
321 321
     }
322 322
 
323 323
     /**
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
         $paymentOption
367 367
             ->setCallToActionText($pagantisTitle)
368 368
             ->setAction($link->getModuleLink('pagantis', 'payment'))
369
-            ->setLogo($this->getPathUri(). 'logo.gif')
369
+            ->setLogo($this->getPathUri().'logo.gif')
370 370
             ->setModuleName(__CLASS__)
371 371
         ;
372 372
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                 'input' => array(
397 397
                     array(
398 398
                         'name' => 'pagantis_is_enabled',
399
-                        'type' =>  (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
399
+                        'type' =>  (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
400 400
                         'label' => $this->l('Module is enabled'),
401 401
                         'prefix' => '<i class="icon icon-key"></i>',
402 402
                         'class' => 't',
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
                     ),
437 437
                     array(
438 438
                         'name' => 'pagantis_simulator_is_enabled',
439
-                        'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
439
+                        'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
440 440
                         'label' => $this->l('Simulator is enabled'),
441 441
                         'prefix' => '<i class="icon icon-key"></i>',
442 442
                         'class' => 't',
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
             $message = $this->displayError($error);
553 553
         }
554 554
 
555
-        $logo = $this->getPathUri(). 'views/img/logo_pagantis.png';
555
+        $logo = $this->getPathUri().'views/img/logo_pagantis.png';
556 556
         $tpl = $this->local_path.'views/templates/admin/config-info.tpl';
557 557
         $this->context->smarty->assign(array(
558 558
             'logo' => $logo,
@@ -747,10 +747,10 @@  discard block
 block discarded – undo
747 747
      */
748 748
     public function checkLogoExists()
749 749
     {
750
-        $logo = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/'. Tools::strtolower(__CLASS__). '.png';
751
-        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) {
750
+        $logo = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/'.Tools::strtolower(__CLASS__).'.png';
751
+        if (!file_exists($logo) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) {
752 752
             copy(
753
-                _PS_PAGANTIS_DIR . '/views/img/logo-64x64.png',
753
+                _PS_PAGANTIS_DIR.'/views/img/logo-64x64.png',
754 754
                 $logo
755 755
             );
756 756
         }
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
             return '';
763 763
         }
764 764
 
765
-        $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \'' . pSQL($config) . '\' limit 1';
765
+        $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \''.pSQL($config).'\' limit 1';
766 766
         if ($results = Db::getInstance()->ExecuteS($sql)) {
767 767
             if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) {
768 768
                 return $results[0]['value'];
Please login to merge, or discard this patch.
controllers/front/notify.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     private function getPagantisOrderId()
197 197
     {
198 198
         try {
199
-            $this->pagantisOrderId= Db::getInstance()->getValue(
199
+            $this->pagantisOrderId = Db::getInstance()->getValue(
200 200
                 'select order_id from '._DB_PREFIX_.'pagantis_order where id = '.$this->merchantOrderId
201 201
             );
202 202
 
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
                 Configuration::get('PS_OS_PAYMENT'),
283 283
                 $this->merchantOrder->getOrderTotal(true),
284 284
                 $this->module->displayName,
285
-                'pagantisOrderId: ' . $this->pagantisOrder->getId().
286
-                'pagantisOrderStatus: '. $this->pagantisOrder->getStatus(),
285
+                'pagantisOrderId: '.$this->pagantisOrder->getId().
286
+                'pagantisOrderStatus: '.$this->pagantisOrder->getStatus(),
287 287
                 array('transaction_id' => $this->pagantisOrderId),
288 288
                 null,
289 289
                 false,
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
             $this->orderClient->confirmOrder($this->pagantisOrderId);
306 306
             try {
307 307
                 $this->saveLog(array(
308
-                    'message' => "Order CONFIRMED. " .
309
-                    'The order was confirmed by a ' .
308
+                    'message' => "Order CONFIRMED. ".
309
+                    'The order was confirmed by a '.
310 310
                     ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'NOTIFICATION' : 'REDIRECTION'
311 311
                 ));
312 312
             } catch (\Exception $e) {
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
     protected function unblockConcurrency()
352 352
     {
353 353
         try {
354
-            Db::getInstance()->delete('pagantis_cart_process', 'timestamp < ' . (time() - 6));
354
+            Db::getInstance()->delete('pagantis_cart_process', 'timestamp < '.(time() - 6));
355 355
         } catch (\Exception $exception) {
356 356
             throw new ConcurrencyException();
357 357
         }
@@ -369,15 +369,15 @@  discard block
 block discarded – undo
369 369
     {
370 370
         if ($this->merchantOrder && $this->processError === true) {
371 371
             sleep(5);
372
-            $id = (!is_null($this->pagantisOrder))?$this->pagantisOrder->getId():null;
373
-            $status = (!is_null($this->pagantisOrder))?$this->pagantisOrder->getStatus():null;
372
+            $id = (!is_null($this->pagantisOrder)) ? $this->pagantisOrder->getId() : null;
373
+            $status = (!is_null($this->pagantisOrder)) ? $this->pagantisOrder->getStatus() : null;
374 374
             $this->module->validateOrder(
375 375
                 $this->merchantOrderId,
376 376
                 Configuration::get('PS_OS_ERROR'),
377 377
                 $this->merchantOrder->getOrderTotal(true),
378 378
                 $this->module->displayName,
379
-                ' pagantisOrderId: ' . $id.
380
-                ' pagantisOrderStatus: '. $status,
379
+                ' pagantisOrderId: '.$id.
380
+                ' pagantisOrderStatus: '.$status,
381 381
                 null,
382 382
                 null,
383 383
                 false,
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
             'id_cart' => $this->merchantOrderId,
414 414
             'key' => $this->config['secureKey'],
415 415
             'id_module' => $this->module->id,
416
-            'id_order' => ($this->pagantisOrder)?$this->pagantisOrder->getId(): null,
416
+            'id_order' => ($this->pagantisOrder) ? $this->pagantisOrder->getId() : null,
417 417
         );
418
-        $url = ($error)? $this->config['urlKO'] : $this->config['urlOK'];
418
+        $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK'];
419 419
         return $this->redirect($url, $parameters);
420 420
     }
421 421
 }
Please login to merge, or discard this patch.