Passed
Pull Request — master (#64)
by Cesar
03:57
created
controllers/front/payment.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
     {
29 29
         if (_PS_VERSION_ < 1.6) {
30 30
             Logger::addLog(
31
-                'Pagantis Exception For user ' .
32
-                $customer->email .
33
-                ' : ' .
31
+                'Pagantis Exception For user '.
32
+                $customer->email.
33
+                ' : '.
34 34
                 $exception->getMessage(),
35 35
                 3,
36 36
                 $exception->getCode(),
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
             );
41 41
         } else {
42 42
             PrestaShopLogger::addLog(
43
-                'Pagantis Exception For user ' .
44
-                $customer->email .
45
-                ' : ' .
43
+                'Pagantis Exception For user '.
44
+                $customer->email.
45
+                ' : '.
46 46
                 $exception->getMessage(),
47 47
                 3,
48 48
                 $exception->getCode(),
@@ -102,24 +102,24 @@  discard block
 block discarded – undo
102 102
         );
103 103
 
104 104
         try {
105
-            $userAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
105
+            $userAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
106 106
             $userAddress
107 107
                 ->setZipCode($shippingAddress->postcode)
108
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
108
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
109 109
                 ->setCountryCode($this->language)
110 110
                 ->setCity($shippingAddress->city)
111
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
111
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
112 112
                 ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress))
113 113
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
114 114
             ;
115 115
 
116
-            $orderShippingAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
116
+            $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
117 117
             $orderShippingAddress
118 118
                 ->setZipCode($shippingAddress->postcode)
119
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
119
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
120 120
                 ->setCountryCode($this->language)
121 121
                 ->setCity($shippingAddress->city)
122
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
122
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
123 123
                 ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress))
124 124
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
125 125
                 ->setFixPhone($shippingAddress->phone)
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
             $orderBillingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
130 130
             $orderBillingAddress
131 131
                 ->setZipCode($billingAddress->postcode)
132
-                ->setFullName($billingAddress->firstname . ' ' . $billingAddress->lastname)
132
+                ->setFullName($billingAddress->firstname.' '.$billingAddress->lastname)
133 133
                 ->setCountryCode($this->language)
134 134
                 ->setCity($billingAddress->city)
135
-                ->setAddress($billingAddress->address1 . ' ' . $billingAddress->address2)
135
+                ->setAddress($billingAddress->address1.' '.$billingAddress->address2)
136 136
                 ->setTaxId($this->getTaxId($customer, $billingAddress, $shippingAddress))
137 137
                 ->setNationalId($this->getNationalId($customer, $billingAddress, $shippingAddress))
138 138
                 ->setFixPhone($billingAddress->phone)
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
153 153
             ;
154 154
 
155
-            if ($customer->birthday!='0000-00-00') {
155
+            if ($customer->birthday != '0000-00-00') {
156 156
                 $orderUser->setDateOfBirth($customer->birthday);
157 157
             }
158 158
 
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
                     ->setQuantity($item['quantity'])
187 187
                     ->setDescription($item['name']);
188 188
                 if ($promotedProduct) {
189
-                    $promotedAmount+=$product->getAmount();
189
+                    $promotedAmount += $product->getAmount();
190 190
                     $productId = $item['id_product'];
191 191
                     $finalPrice = Product::getPriceStatic($productId);
192
-                    $promotedMessage = 'Promoted Item: ' . $product->getDescription() .
193
-                         ' Price: ' . $finalPrice .
194
-                         ' Qty: ' . $product->getQuantity() .
195
-                         ' Item ID: ' . $item['id_product'];
192
+                    $promotedMessage = 'Promoted Item: '.$product->getDescription().
193
+                         ' Price: '.$finalPrice.
194
+                         ' Qty: '.$product->getQuantity().
195
+                         ' Item ID: '.$item['id_product'];
196 196
                     $metadataOrder->addMetadata('promotedProduct', $promotedMessage);
197 197
                 }
198 198
                 $details->addProduct($product);
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             Tools::redirect($cancelUrl);
243 243
         }
244 244
 
245
-        $url ='';
245
+        $url = '';
246 246
         try {
247 247
             $orderClient = new \Pagantis\OrdersApiClient\Client(
248 248
                 $pagantisPublicKey,
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
             if ($order instanceof \Pagantis\OrdersApiClient\Model\Order) {
254 254
                 $url = $order->getActionUrls()->getForm();
255 255
                 $orderId = $order->getId();
256
-                $sql = "INSERT INTO `" . _DB_PREFIX_ . "pagantis_order` (`id`, `order_id`)
256
+                $sql = "INSERT INTO `"._DB_PREFIX_."pagantis_order` (`id`, `order_id`)
257 257
                      VALUES ('$cart->id','$orderId') 
258 258
                      ON DUPLICATE KEY UPDATE `order_id` = '$orderId'";
259 259
                 $result = Db::getInstance()->execute($sql);
260 260
                 if (!$result) {
261
-                    throw new UnknownException('Unable to save pagantis-order-id in database: '. $sql);
261
+                    throw new UnknownException('Unable to save pagantis-order-id in database: '.$sql);
262 262
                 }
263 263
             } else {
264 264
                 throw new OrderNotFoundException();
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
         $pagantisPublicKey = Configuration::get('pagantis_public_key');
87 87
         $pagantisPrivateKey = Configuration::get('pagantis_private_key');
88 88
         $okUrl = _PS_BASE_URL_SSL_.__PS_BASE_URI__
89
-                 .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&origin=redirect&'
90
-                 .http_build_query($query)
89
+                    .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&origin=redirect&'
90
+                    .http_build_query($query)
91 91
         ;
92 92
         $notificationOkUrl = _PS_BASE_URL_SSL_.__PS_BASE_URI__
93 93
             .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&origin=notification&'
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
                     $productId = $item['id_product'];
195 195
                     $finalPrice = Product::getPriceStatic($productId);
196 196
                     $promotedMessage = 'Promoted Item: ' . $product->getDescription() .
197
-                         ' Price: ' . $finalPrice .
198
-                         ' Qty: ' . $product->getQuantity() .
199
-                         ' Item ID: ' . $item['id_product'];
197
+                            ' Price: ' . $finalPrice .
198
+                            ' Qty: ' . $product->getQuantity() .
199
+                            ' Item ID: ' . $item['id_product'];
200 200
                     $metadataOrder->addMetadata('promotedProduct', $promotedMessage);
201 201
                 }
202 202
                 $details->addProduct($product);
Please login to merge, or discard this patch.
pagantis.php 1 patch
Spacing   +23 added lines, -23 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
 define('PROMOTIONS_CATEGORY', 'pagantis-promotion-product');
16 16
 define('PROMOTIONS_CATEGORY_NAME', 'Pagantis Promoted Product');
17 17
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         Configuration::updateValue('pagantis_public_key', '');
134 134
         Configuration::updateValue('pagantis_private_key', '');
135 135
 
136
-        $return =  (parent::install()
136
+        $return = (parent::install()
137 137
             && $this->registerHook('displayShoppingCart')
138 138
             && $this->registerHook('paymentOptions')
139 139
             && $this->registerHook('displayRightColumn')
@@ -215,18 +215,18 @@  discard block
 block discarded – undo
215 215
     public function checkHooks()
216 216
     {
217 217
         try {
218
-            $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where 
219
-            id_module = \'' . Module::getModuleIdByName($this->name) . '\' and 
220
-            id_shop = \'' . Shop::getContextShopID() . '\' and 
221
-            id_hook = \'' . Hook::getIdByName('header') . '\'';
218
+            $sql_content = 'select * from '._DB_PREFIX_.'hook_module where 
219
+            id_module = \'' . Module::getModuleIdByName($this->name).'\' and 
220
+            id_shop = \'' . Shop::getContextShopID().'\' and 
221
+            id_hook = \'' . Hook::getIdByName('header').'\'';
222 222
             $hook_exists = Db::getInstance()->ExecuteS($sql_content);
223 223
             if (empty($hook_exists)) {
224
-                $sql_insert = 'insert into ' . _DB_PREFIX_.  'hook_module 
224
+                $sql_insert = 'insert into '._DB_PREFIX_.'hook_module 
225 225
             (id_module, id_shop, id_hook, position)
226 226
             values
227
-            (\''. Module::getModuleIdByName($this->name) . '\',
228
-            \''. Shop::getContextShopID() . '\',
229
-            \''. Hook::getIdByName('header') . '\',
227
+            (\''. Module::getModuleIdByName($this->name).'\',
228
+            \''. Shop::getContextShopID().'\',
229
+            \''. Hook::getIdByName('header').'\',
230 230
             150)';
231 231
                 Db::getInstance()->execute($sql_insert);
232 232
             }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     public function checkEnvVariables()
242 242
     {
243
-        $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config';
243
+        $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config';
244 244
         $dbConfigs = Db::getInstance()->executeS($sql_content);
245 245
 
246 246
         // Convert a multimple dimension array for SQL insert statements into a simple key/value
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         } else {
359 359
             $this->context->controller->addJS($url);
360 360
         }
361
-        $this->context->controller->addJS($this->getPathUri(). 'views/js/simulator.js');
361
+        $this->context->controller->addJS($this->getPathUri().'views/js/simulator.js');
362 362
     }
363 363
 
364 364
     /**
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
                 'input' => array(
457 457
                     array(
458 458
                         'name' => 'pagantis_is_enabled',
459
-                        'type' =>  (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
459
+                        'type' =>  (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
460 460
                         'label' => $this->l('Module is enabled'),
461 461
                         'prefix' => '<i class="icon icon-key"></i>',
462 462
                         'class' => 't',
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
                     ),
497 497
                     array(
498 498
                         'name' => 'pagantis_simulator_is_enabled',
499
-                        'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
499
+                        'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
500 500
                         'label' => $this->l('Simulator is enabled'),
501 501
                         'prefix' => '<i class="icon icon-key"></i>',
502 502
                         'class' => 't',
@@ -850,16 +850,16 @@  discard block
 block discarded – undo
850 850
         if (!in_array(PROMOTIONS_CATEGORY_NAME, $categories)) {
851 851
             /** @var CategoryCore $category */
852 852
             $category = new Category();
853
-            $categoryArray = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY );
853
+            $categoryArray = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY);
854 854
             $category->is_root_category = false;
855 855
             $category->link_rewrite = $categoryArray;
856 856
             $category->meta_description = $categoryArray;
857 857
             $category->meta_keywords = $categoryArray;
858 858
             $category->meta_title = $categoryArray;
859
-            $category->name = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME);
859
+            $category->name = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME);
860 860
             $category->id_parent = Configuration::get('PS_HOME_CATEGORY');
861
-            $category->active=0;
862
-            $description = 'Pagantis: Products with this category have free financing assumed by the merchant. ' .
861
+            $category->active = 0;
862
+            $description = 'Pagantis: Products with this category have free financing assumed by the merchant. '.
863 863
                 'Use it to promote your products or brands.';
864 864
             $category->description = $this->l($description);
865 865
             $category->save();
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
             return '';
874 874
         }
875 875
 
876
-        $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \'' . pSQL($config) . '\' limit 1';
876
+        $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \''.pSQL($config).'\' limit 1';
877 877
         if ($results = Db::getInstance()->ExecuteS($sql)) {
878 878
             if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) {
879 879
                 return $results[0]['value'];
@@ -888,10 +888,10 @@  discard block
 block discarded – undo
888 888
      */
889 889
     public function checkLogoExists()
890 890
     {
891
-        $logoPg = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/pagantis.png';
892
-        if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) {
891
+        $logoPg = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/pagantis.png';
892
+        if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) {
893 893
             copy(
894
-                _PS_PAGANTIS_DIR . '/logo.png',
894
+                _PS_PAGANTIS_DIR.'/logo.png',
895 895
                 $logoPg
896 896
             );
897 897
         }
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
         if (count($langArray) != 2 && isset($lang['locale'])) {
908 908
             $langArray = explode("-", $lang['locale']);
909 909
         }
910
-        $this->language = Tools::strtoupper($langArray[count($langArray)-1]);
910
+        $this->language = Tools::strtoupper($langArray[count($langArray) - 1]);
911 911
         // Prevent null language detection
912 912
         if (in_array(Tools::strtolower($this->language), $this->allowedCountries)) {
913 913
             return;
Please login to merge, or discard this patch.
controllers/front/notify.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     private function getPagantisOrderId()
215 215
     {
216 216
         try {
217
-            $this->pagantisOrderId= Db::getInstance()->getValue(
217
+            $this->pagantisOrderId = Db::getInstance()->getValue(
218 218
                 'select order_id from '._DB_PREFIX_.'pagantis_order where id = '.$this->merchantOrderId
219 219
             );
220 220
 
@@ -276,20 +276,20 @@  discard block
 block discarded – undo
276 276
         $merchantAmount = explode('.', explode(',', $merchantAmount)[0])[0];
277 277
         if ($totalAmount != $merchantAmount) {
278 278
             try {
279
-                $psTotalAmount = substr_replace($merchantAmount, '.', (Tools::strlen($merchantAmount) -2), 0);
279
+                $psTotalAmount = substr_replace($merchantAmount, '.', (Tools::strlen($merchantAmount) - 2), 0);
280 280
 
281 281
                 $pgTotalAmountInCents = (string) $this->pagantisOrder->getShoppingCart()->getTotalAmount();
282 282
                 $pgTotalAmount = substr_replace(
283 283
                     $pgTotalAmountInCents,
284 284
                     '.',
285
-                    (Tools::strlen($pgTotalAmountInCents) -2),
285
+                    (Tools::strlen($pgTotalAmountInCents) - 2),
286 286
                     0
287 287
                 );
288 288
 
289
-                $this->amountMismatchError = '. Amount mismatch in PrestaShop Order #'. $this->merchantOrderId .
290
-                    ' compared with Pagantis Order: ' . $this->pagantisOrderId .
291
-                    '. The order in PrestaShop has an amount of ' . $psTotalAmount . ' and in Pagantis ' .
292
-                    $pgTotalAmount . ' PLEASE REVIEW THE ORDER';
289
+                $this->amountMismatchError = '. Amount mismatch in PrestaShop Order #'.$this->merchantOrderId.
290
+                    ' compared with Pagantis Order: '.$this->pagantisOrderId.
291
+                    '. The order in PrestaShop has an amount of '.$psTotalAmount.' and in Pagantis '.
292
+                    $pgTotalAmount.' PLEASE REVIEW THE ORDER';
293 293
                 $this->saveLog(array(
294 294
                     'message' => $this->amountMismatchError
295 295
                 ));
@@ -309,21 +309,21 @@  discard block
 block discarded – undo
309 309
         try {
310 310
             if ($this->merchantOrder->orderExists() !== false) {
311 311
                 throw new WrongStatusException('PS->orderExists() cart_id = '
312
-                    . $this->merchantOrderId . ' pagantis_id = '
313
-                    . $this->pagantisOrderId . '): already_processed');
312
+                    . $this->merchantOrderId.' pagantis_id = '
313
+                    . $this->pagantisOrderId.'): already_processed');
314 314
             }
315 315
 
316 316
             // Double check
317
-            $tableName = _DB_PREFIX_ . 'pagantis_order';
317
+            $tableName = _DB_PREFIX_.'pagantis_order';
318 318
             $fieldName = 'ps_order_id';
319
-            $sql = ('select ' . $fieldName . ' from `' . $tableName . '` where `id` = ' . $this->merchantOrderId
320
-                . ' and `order_id` = \'' . $this->pagantisOrderId . '\''
321
-                . ' and `' . $fieldName . '` is not null');
319
+            $sql = ('select '.$fieldName.' from `'.$tableName.'` where `id` = '.$this->merchantOrderId
320
+                . ' and `order_id` = \''.$this->pagantisOrderId.'\''
321
+                . ' and `'.$fieldName.'` is not null');
322 322
             $results = Db::getInstance()->ExecuteS($sql);
323 323
             if (is_array($results) && count($results) === 1) {
324
-                throw new WrongStatusException('PS->record found in ' . $tableName
325
-                    . ' (cart_id = ' . $this->merchantOrderId . ' pagantis_id = '
326
-                    . $this->pagantisOrderId . '): already_processed');
324
+                throw new WrongStatusException('PS->record found in '.$tableName
325
+                    . ' (cart_id = '.$this->merchantOrderId.' pagantis_id = '
326
+                    . $this->pagantisOrderId.'): already_processed');
327 327
             }
328 328
         } catch (\Exception $exception) {
329 329
             throw new UnknownException($exception->getMessage());
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
                 Configuration::get('PS_OS_PAYMENT'),
353 353
                 $this->merchantOrder->getOrderTotal(true),
354 354
                 $this->module->displayName,
355
-                'pagantisOrderId: ' . $this->pagantisOrder->getId() . ' ' .
356
-                'pagantisOrderStatus: '. $this->pagantisOrder->getStatus() .
357
-                $this->amountMismatchError .
355
+                'pagantisOrderId: '.$this->pagantisOrder->getId().' '.
356
+                'pagantisOrderStatus: '.$this->pagantisOrder->getStatus().
357
+                $this->amountMismatchError.
358 358
                 $metadataInfo,
359 359
                 array('transaction_id' => $this->pagantisOrderId),
360 360
                 null,
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
             Db::getInstance()->update(
369 369
                 'pagantis_order',
370 370
                 array('ps_order_id' => $this->module->currentOrder),
371
-                'id = \''. $this->merchantOrderId . '\' and order_id = \'' . $this->pagantisOrderId . '\''
371
+                'id = \''.$this->merchantOrderId.'\' and order_id = \''.$this->pagantisOrderId.'\''
372 372
             );
373 373
         } catch (\Exception $exception) {
374 374
             // Do nothing
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
             $this->orderClient->confirmOrder($this->pagantisOrderId);
387 387
             try {
388 388
                 $mode = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'NOTIFICATION' : 'REDIRECTION';
389
-                $message = 'Order CONFIRMED. The order was confirmed by a ' . $mode .
390
-                    '. Pagantis OrderId=' . $this->pagantisOrderId .
391
-                    '. Prestashop OrderId=' . $this->module->currentOrder;
389
+                $message = 'Order CONFIRMED. The order was confirmed by a '.$mode.
390
+                    '. Pagantis OrderId='.$this->pagantisOrderId.
391
+                    '. Prestashop OrderId='.$this->module->currentOrder;
392 392
                 $this->saveLog(array('message' => $message));
393 393
             } catch (\Exception $exception) {
394 394
                 // Do nothing
@@ -406,15 +406,15 @@  discard block
 block discarded – undo
406 406
     public function rollbackMerchantOrder()
407 407
     {
408 408
         try {
409
-            $message = 'Roolback method: ' .
410
-                '. Pagantis OrderId=' . $this->pagantisOrderId .
411
-                '. Prestashop CartId=' . $this->merchantOrderId;
409
+            $message = 'Roolback method: '.
410
+                '. Pagantis OrderId='.$this->pagantisOrderId.
411
+                '. Prestashop CartId='.$this->merchantOrderId;
412 412
             if ($this->module->currentOrder) {
413 413
                 $objOrder = new Order($this->module->currentOrder);
414 414
                 $history = new OrderHistory();
415
-                $history->id_order = (int)$objOrder->id;
416
-                $history->changeIdOrderState(8, (int)($objOrder->id));
417
-                $message .= ' Prestashop OrderId=' . $this->merchantOrderId;
415
+                $history->id_order = (int) $objOrder->id;
416
+                $history->changeIdOrderState(8, (int) ($objOrder->id));
417
+                $message .= ' Prestashop OrderId='.$this->merchantOrderId;
418 418
             }
419 419
             $this->saveLog(array('message' => $message));
420 420
         } catch (\Exception $exception) {
@@ -447,10 +447,10 @@  discard block
 block discarded – undo
447 447
                 );
448 448
                 $resultSeconds = Db::getInstance()->getValue($query);
449 449
                 $restSeconds = isset($resultSeconds) ? ($resultSeconds) : 0;
450
-                $secondsToExpire = ($restSeconds>self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds;
450
+                $secondsToExpire = ($restSeconds > self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds;
451 451
 
452 452
                 $logMessage = sprintf(
453
-                    "Redirect concurrency, User have to wait %s seconds, default seconds %s. CartId=" . $orderId,
453
+                    "Redirect concurrency, User have to wait %s seconds, default seconds %s. CartId=".$orderId,
454 454
                     $secondsToExpire,
455 455
                     self::CONCURRENCY_TIMEOUT,
456 456
                     $restSeconds
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
                 $this->saveLog(array(
460 460
                     'message' => $logMessage
461 461
                 ));
462
-                sleep($secondsToExpire+1);
462
+                sleep($secondsToExpire + 1);
463 463
                 // After waiting...user continue the confirmation, hoping that previous call have finished.
464 464
                 return true;
465 465
             }
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
             if (is_null($orderId)) {
480 480
                 Db::getInstance()->delete(
481 481
                     'pagantis_cart_process',
482
-                    'timestamp < ' . (time() - self::CONCURRENCY_TIMEOUT)
482
+                    'timestamp < '.(time() - self::CONCURRENCY_TIMEOUT)
483 483
                 );
484 484
                 return;
485 485
             }
486
-            Db::getInstance()->delete('pagantis_cart_process', 'id = \'' . $orderId . '\'');
486
+            Db::getInstance()->delete('pagantis_cart_process', 'id = \''.$orderId.'\'');
487 487
         } catch (\Exception $exception) {
488 488
             throw new ConcurrencyException();
489 489
         }
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
         $data = array(
506 506
             'merchantOrderId' => $this->merchantOrderId,
507 507
             'pagantisOrderId' => $this->pagantisOrderId,
508
-            'message' => ($exception)? $exception->getMessage() : 'Unable to get Exception message',
509
-            'statusCode' => ($exception)? $exception->getCode() : 'Unable to get Exception statusCode',
508
+            'message' => ($exception) ? $exception->getMessage() : 'Unable to get Exception message',
509
+            'statusCode' => ($exception) ? $exception->getCode() : 'Unable to get Exception statusCode',
510 510
             'method' => $method,
511 511
             'file' => __FILE__,
512 512
             'line' => $line,
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
             'id_cart' => $this->merchantOrderId,
532 532
             'key' => $this->config['secureKey'],
533 533
             'id_module' => $this->module->id,
534
-            'id_order' => ($this->pagantisOrder)?$this->pagantisOrder->getId(): null,
534
+            'id_order' => ($this->pagantisOrder) ? $this->pagantisOrder->getId() : null,
535 535
         );
536
-        $url = ($error)? $this->config['urlKO'] : $this->config['urlOK'];
536
+        $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK'];
537 537
         return $this->redirect($url, $parameters);
538 538
     }
539 539
 }
Please login to merge, or discard this patch.