Passed
Pull Request — master (#104)
by Raúl
05:17
created
controllers/front/AbstractController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 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
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
                     $response = $exception->getMessage();
77 77
                 } else {
78 78
                     $response = 'Unable to serialize log.'.
79
-                        'data: '. json_encode($data).
80
-                        'exception: '. json_encode($exception);
79
+                        'data: '.json_encode($data).
80
+                        'exception: '.json_encode($exception);
81 81
                 }
82 82
             }
83 83
 
Please login to merge, or discard this patch.
pagantis.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -473,7 +473,7 @@
 block discarded – undo
473 473
      * Get the form for editing the BackOffice options of the module
474 474
      *
475 475
      * @return array
476
-            */
476
+     */
477 477
     private function getConfigForm()
478 478
     {
479 479
         $products = explode(',', Pagantis::getExtraConfig('PRODUCTS', null));
Please login to merge, or discard this patch.
Spacing   +119 added lines, -119 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
 
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
         foreach ($products as $product) {
163 163
             $code = Tools::strtolower(Pagantis::getExtraConfig('CODE', $product));
164 164
             if ($code === 'p4x') {
165
-                Configuration::updateValue($code . '_simulator_is_enabled', 1);
165
+                Configuration::updateValue($code.'_simulator_is_enabled', 1);
166 166
             }
167
-            Configuration::updateValue($code . '_is_enabled', 0);
168
-            Configuration::updateValue($code . '_public_key', '');
169
-            Configuration::updateValue($code . '_private_key', '');
167
+            Configuration::updateValue($code.'_is_enabled', 0);
168
+            Configuration::updateValue($code.'_public_key', '');
169
+            Configuration::updateValue($code.'_private_key', '');
170 170
         }
171 171
 
172
-        $return =  (parent::install()
172
+        $return = (parent::install()
173 173
             && $this->registerHook('displayShoppingCart')
174 174
             && $this->registerHook('paymentOptions')
175 175
             && $this->registerHook('displayProductButtons')
@@ -219,34 +219,34 @@  discard block
 block discarded – undo
219 219
     public function checkHooks()
220 220
     {
221 221
         try {
222
-            $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where 
223
-            id_module = \'' . Module::getModuleIdByName($this->name) . '\' and 
224
-            id_shop = \'' . Shop::getContextShopID() . '\' and 
225
-            id_hook = \'' . Hook::getIdByName('header') . '\'';
222
+            $sql_content = 'select * from '._DB_PREFIX_.'hook_module where 
223
+            id_module = \'' . Module::getModuleIdByName($this->name).'\' and 
224
+            id_shop = \'' . Shop::getContextShopID().'\' and 
225
+            id_hook = \'' . Hook::getIdByName('header').'\'';
226 226
             $hook_exists = Db::getInstance()->ExecuteS($sql_content);
227 227
             if (empty($hook_exists)) {
228
-                $sql_insert = 'insert into ' . _DB_PREFIX_.  'hook_module 
228
+                $sql_insert = 'insert into '._DB_PREFIX_.'hook_module 
229 229
             (id_module, id_shop, id_hook, position)
230 230
             values
231
-            (\''. Module::getModuleIdByName($this->name) . '\',
232
-            \''. Shop::getContextShopID() . '\',
233
-            \''. Hook::getIdByName('header') . '\',
231
+            (\''. Module::getModuleIdByName($this->name).'\',
232
+            \''. Shop::getContextShopID().'\',
233
+            \''. Hook::getIdByName('header').'\',
234 234
             150)';
235 235
                 Db::getInstance()->execute($sql_insert);
236 236
             }
237 237
 
238
-            $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where 
239
-            id_module = \'' . Module::getModuleIdByName($this->name) . '\' and 
240
-            id_shop = \'' . Shop::getContextShopID() . '\' and 
241
-            id_hook = \'' . Hook::getIdByName('displayProductPriceBlock') . '\'';
238
+            $sql_content = 'select * from '._DB_PREFIX_.'hook_module where 
239
+            id_module = \'' . Module::getModuleIdByName($this->name).'\' and 
240
+            id_shop = \'' . Shop::getContextShopID().'\' and 
241
+            id_hook = \'' . Hook::getIdByName('displayProductPriceBlock').'\'';
242 242
             $hook_exists = Db::getInstance()->ExecuteS($sql_content);
243 243
             if (empty($hook_exists)) {
244
-                $sql_insert = 'insert into ' . _DB_PREFIX_.  'hook_module 
244
+                $sql_insert = 'insert into '._DB_PREFIX_.'hook_module 
245 245
             (id_module, id_shop, id_hook, position)
246 246
             values
247
-            (\''. Module::getModuleIdByName($this->name) . '\',
248
-            \''. Shop::getContextShopID() . '\',
249
-            \''. Hook::getIdByName('displayProductPriceBlock') . '\',
247
+            (\''. Module::getModuleIdByName($this->name).'\',
248
+            \''. Shop::getContextShopID().'\',
249
+            \''. Hook::getIdByName('displayProductPriceBlock').'\',
250 250
             160)';
251 251
                 Db::getInstance()->execute($sql_insert);
252 252
             }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function checkEnvVariables()
262 262
     {
263
-        $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config';
263
+        $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config';
264 264
         $dbConfigs = Db::getInstance()->executeS($sql_content);
265 265
 
266 266
         // Convert a multimple dimension array for SQL insert statements into a simple key/value
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
     {
309 309
         try {
310 310
             $tableName = _DB_PREFIX_.'pagantis_order';
311
-            $sql = "show tables like '"   . $tableName . "'";
311
+            $sql = "show tables like '".$tableName."'";
312 312
             $data = Db::getInstance()->ExecuteS($sql);
313 313
             if (count($data) > 0) {
314
-                $sql = "desc " . $tableName;
314
+                $sql = "desc ".$tableName;
315 315
                 $data = Db::getInstance()->ExecuteS($sql);
316 316
                 if (count($data) == 2) {
317 317
                     $sql = "ALTER TABLE $tableName ADD COLUMN ps_order_id VARCHAR(60) AFTER order_id";
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
                 $this->loadSQLFile($sql_file);
329 329
             }
330 330
             $tableName = _DB_PREFIX_.'pagantis_config';
331
-            $sql = "show tables like '"   . $tableName . "'";
331
+            $sql = "show tables like '".$tableName."'";
332 332
             $data = Db::getInstance()->ExecuteS($sql);
333 333
             if (count($data) > 0) {
334
-                $sql = "desc "   . $tableName;
334
+                $sql = "desc ".$tableName;
335 335
                 $data = Db::getInstance()->ExecuteS($sql);
336 336
                 if (count($data) === 3 && $data[2]['Type'] !== 'varchar(5000)') {
337 337
                     $sql = "ALTER TABLE $tableName MODIFY `value` VARCHAR(5000)";
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
         $availableCurrencies       = array('EUR');
361 361
         $pagantisDisplayMinAmount  = $configs['DISPLAY_MIN_AMOUNT'];
362 362
         $pagantisDisplayMaxAmount  = $configs['DISPLAY_MAX_AMOUNT'];
363
-        $pagantisPublicKey         = Configuration::get(Tools::strtolower($configs['CODE']) . '_public_key');
364
-        $pagantisPrivateKey        = Configuration::get(Tools::strtolower($configs['CODE']) . '_private_key');
363
+        $pagantisPublicKey         = Configuration::get(Tools::strtolower($configs['CODE']).'_public_key');
364
+        $pagantisPrivateKey        = Configuration::get(Tools::strtolower($configs['CODE']).'_private_key');
365 365
         $this->allowedCountries    = unserialize(Pagantis::getExtraConfig('ALLOWED_COUNTRIES', null));
366 366
         $this->getUserLanguage();
367 367
         return (
@@ -440,42 +440,42 @@  discard block
 block discarded – undo
440 440
             if ($this->isPaymentMethodAvailable($product)) {
441 441
                 $productConfigs = Pagantis::getExtraConfig($product, null);
442 442
                 $productConfigs = json_decode($productConfigs, true);
443
-                $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_public_key');
444
-                $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_simulator_is_enabled');
445
-                $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_is_enabled');
443
+                $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_public_key');
444
+                $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_simulator_is_enabled');
445
+                $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_is_enabled');
446 446
 
447
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_TITLE'] = $this->l($productConfigs['TITLE']);
447
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_TITLE'] = $this->l($productConfigs['TITLE']);
448 448
                 unset($productConfigs['TITLE']);
449
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_AMOUNT'] = $orderTotal;
450
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PROMOTED_AMOUNT'] = $promotedAmount;
451
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOCALE'] = $this->language;
452
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_COUNTRY'] = $this->language;
453
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PUBLIC_KEY'] = $publicKey;
454
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled;
455
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_IS_ENABLED'] = $isEnabled;
456
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png';
457
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PAYMENT_URL'] = $link->getModuleLink('pagantis', 'payment') . '&product=' . $productConfigs['CODE'];
458
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3));
449
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_AMOUNT'] = $orderTotal;
450
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PROMOTED_AMOUNT'] = $promotedAmount;
451
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOCALE'] = $this->language;
452
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_COUNTRY'] = $this->language;
453
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PUBLIC_KEY'] = $publicKey;
454
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled;
455
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_IS_ENABLED'] = $isEnabled;
456
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png';
457
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PAYMENT_URL'] = $link->getModuleLink('pagantis', 'payment').'&product='.$productConfigs['CODE'];
458
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3));
459 459
 
460 460
                 foreach ($productConfigs as $productConfigKey => $productConfigValue) {
461
-                    $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . "_" . $productConfigKey] = $productConfigValue;
461
+                    $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE']))."_".$productConfigKey] = $productConfigValue;
462 462
                 }
463 463
                 $this->context->smarty->assign($templateConfigs);
464 464
 
465 465
                 $paymentOption = new PrestaShop\PrestaShop\Core\Payment\PaymentOption();
466 466
                 $uri = $link->getModuleLink('pagantis', 'payment');
467 467
                 if (strpos($uri, '?') !== false) {
468
-                    $uri .= '&product=' . $productConfigs['CODE'];
468
+                    $uri .= '&product='.$productConfigs['CODE'];
469 469
                 } else {
470
-                    $uri .= '?product=' . $productConfigs['CODE'];
470
+                    $uri .= '?product='.$productConfigs['CODE'];
471 471
                 }
472 472
                 $paymentOption
473
-                    ->setCallToActionText($templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_TITLE'])
473
+                    ->setCallToActionText($templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_TITLE'])
474 474
                     ->setAction($uri)
475
-                    ->setLogo($templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOGO'])
475
+                    ->setLogo($templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOGO'])
476 476
                     ->setModuleName(__CLASS__)
477 477
                     ->setAdditionalInformation(
478
-                        $this->fetch('module:pagantis/views/templates/hook/checkout-' . Tools::strtolower($productConfigs['CODE']) . '.tpl')
478
+                        $this->fetch('module:pagantis/views/templates/hook/checkout-'.Tools::strtolower($productConfigs['CODE']).'.tpl')
479 479
                     )
480 480
                 ;
481 481
                 $return[] = $paymentOption;
@@ -499,61 +499,61 @@  discard block
 block discarded – undo
499 499
         foreach ($products as $product) {
500 500
             $code = Tools::strtolower(Pagantis::getExtraConfig('CODE', $product));
501 501
             $inputs[] = array(
502
-                'name' => $code .'_is_enabled',
503
-                'type' =>  (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
504
-                'label' => $this->l('Module is enabled ' . $code),
502
+                'name' => $code.'_is_enabled',
503
+                'type' =>  (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
504
+                'label' => $this->l('Module is enabled '.$code),
505 505
                 'prefix' => '<i class="icon icon-key"></i>',
506 506
                 'class' => 't',
507 507
                 'required' => true,
508 508
                 'values'=> array(
509 509
                     array(
510
-                        'id' => $code .'_is_enabled_true',
510
+                        'id' => $code.'_is_enabled_true',
511 511
                         'value' => 1,
512 512
                         'label' => $this->l('Yes', get_class($this), null, false),
513 513
                     ),
514 514
                     array(
515
-                        'id' => $code . '_is_enabled_false',
515
+                        'id' => $code.'_is_enabled_false',
516 516
                         'value' => 0,
517 517
                         'label' => $this->l('No', get_class($this), null, false),
518 518
                     ),
519 519
                 )
520 520
             );
521 521
             $inputs[] = array(
522
-                'name' => $code . '_public_key',
522
+                'name' => $code.'_public_key',
523 523
                 'suffix' => $this->l('ex: pk_fd53cd467ba49022e4gf215e'),
524 524
                 'type' => 'text',
525 525
                 'size' => 60,
526
-                'label' => $this->l('Public Key ' . $code),
526
+                'label' => $this->l('Public Key '.$code),
527 527
                 'prefix' => '<i class="icon icon-key"></i>',
528 528
                 'col' => 6,
529 529
                 'required' => true,
530 530
             );
531 531
             $inputs[] = array(
532
-                'name' => $code . '_private_key',
532
+                'name' => $code.'_private_key',
533 533
                 'suffix' => $this->l('ex: 21e5723a97459f6a'),
534 534
                 'type' => 'text',
535 535
                 'size' => 60,
536
-                'label' => $this->l('Private Key ' . $code),
536
+                'label' => $this->l('Private Key '.$code),
537 537
                 'prefix' => '<i class="icon icon-key"></i>',
538 538
                 'col' => 6,
539 539
                 'required' => true,
540 540
             );
541 541
             if ($code !== "p4x") {
542 542
                 $inputs[] = array(
543
-                    'name' => $code . '_simulator_is_enabled',
544
-                    'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch',
545
-                    'label' => $this->l('Simulator is enabled ' . $code),
543
+                    'name' => $code.'_simulator_is_enabled',
544
+                    'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch',
545
+                    'label' => $this->l('Simulator is enabled '.$code),
546 546
                     'prefix' => '<i class="icon icon-key"></i>',
547 547
                     'class' => 't',
548 548
                     'required' => true,
549 549
                     'values'=> array(
550 550
                         array(
551
-                            'id' => $code . '_simulator_is_enabled_on',
551
+                            'id' => $code.'_simulator_is_enabled_on',
552 552
                             'value' => 1,
553 553
                             'label' => $this->l('Yes'),
554 554
                         ),
555 555
                         array(
556
-                            'id' => $code . '_simulator_is_enabled_off',
556
+                            'id' => $code.'_simulator_is_enabled_off',
557 557
                             'value' => 0,
558 558
                             'label' => $this->l('No'),
559 559
                         ),
@@ -621,17 +621,17 @@  discard block
 block discarded – undo
621 621
         $products = explode(',', Pagantis::getExtraConfig('PRODUCTS', null));
622 622
         foreach ($products as $product) {
623 623
             $code = Tools::strtolower(Pagantis::getExtraConfig('CODE', $product));
624
-            $settings[$code . '_public_key'] = Configuration::get($code . '_public_key');
625
-            $settings[$code . '_private_key'] = Configuration::get($code . '_private_key');
626
-            $settings[$code . '_is_enabled'] = Configuration::get($code . '_is_enabled');
624
+            $settings[$code.'_public_key'] = Configuration::get($code.'_public_key');
625
+            $settings[$code.'_private_key'] = Configuration::get($code.'_private_key');
626
+            $settings[$code.'_is_enabled'] = Configuration::get($code.'_is_enabled');
627 627
             if ($code !== 'p4x') {
628
-                $settings[$code . '_simulator_is_enabled'] = Configuration::get($code . '_simulator_is_enabled');
628
+                $settings[$code.'_simulator_is_enabled'] = Configuration::get($code.'_simulator_is_enabled');
629 629
             }
630
-            $settingsKeys[] = $code . '_is_enabled';
631
-            $settingsKeys[] = $code . '_public_key';
632
-            $settingsKeys[] = $code . '_private_key';
630
+            $settingsKeys[] = $code.'_is_enabled';
631
+            $settingsKeys[] = $code.'_public_key';
632
+            $settingsKeys[] = $code.'_private_key';
633 633
             if ($code !== 'p4x') {
634
-                $settingsKeys[] = $code . '_simulator_is_enabled';
634
+                $settingsKeys[] = $code.'_simulator_is_enabled';
635 635
             }
636 636
         }
637 637
 
@@ -702,43 +702,43 @@  discard block
 block discarded – undo
702 702
             if ($this->isPaymentMethodAvailable($product)) {
703 703
                 $productConfigs = Pagantis::getExtraConfig($product, null);
704 704
                 $productConfigs = json_decode($productConfigs, true);
705
-                $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_public_key');
706
-                $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_simulator_is_enabled');
707
-                $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_is_enabled');
705
+                $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_public_key');
706
+                $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_simulator_is_enabled');
707
+                $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_is_enabled');
708 708
 
709
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_TITLE'] = $this->l($productConfigs['TITLE']);
709
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_TITLE'] = $this->l($productConfigs['TITLE']);
710 710
                 unset($productConfigs['TITLE']);
711
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_AMOUNT'] = $orderTotal;
712
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PROMOTED_AMOUNT'] = $promotedAmount;
713
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOCALE'] = $this->language;
714
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_COUNTRY'] = $this->language;
715
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PUBLIC_KEY'] = $publicKey;
716
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled;
717
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_IS_ENABLED'] = $isEnabled;
718
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png';
711
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_AMOUNT'] = $orderTotal;
712
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PROMOTED_AMOUNT'] = $promotedAmount;
713
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOCALE'] = $this->language;
714
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_COUNTRY'] = $this->language;
715
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PUBLIC_KEY'] = $publicKey;
716
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled;
717
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_IS_ENABLED'] = $isEnabled;
718
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png';
719 719
                 $uri = $link->getModuleLink('pagantis', 'payment');
720 720
                 if (strpos($uri, '?') !== false) {
721
-                    $uri .= '&product=' . $productConfigs['CODE'];
721
+                    $uri .= '&product='.$productConfigs['CODE'];
722 722
                 } else {
723
-                    $uri .= '?product=' . $productConfigs['CODE'];
723
+                    $uri .= '?product='.$productConfigs['CODE'];
724 724
                 }
725
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PAYMENT_URL'] = $uri;
726
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3));
725
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PAYMENT_URL'] = $uri;
726
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3));
727 727
 
728 728
                 foreach ($productConfigs as $productConfigKey => $productConfigValue) {
729
-                    $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . "_" . $productConfigKey] = $productConfigValue;
729
+                    $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE']))."_".$productConfigKey] = $productConfigValue;
730 730
                 }
731 731
                 $this->context->smarty->assign($templateConfigs);
732 732
                 if ($supercheckout_enabled || $onepagecheckout_enabled || $onepagecheckoutps_enabled) {
733 733
                     $this->checkLogoExists();
734 734
                     $return .= $this->display(
735 735
                         __FILE__,
736
-                        'views/templates/hook/onepagecheckout-' . Tools::strtolower($productConfigs['CODE']) . '.tpl'
736
+                        'views/templates/hook/onepagecheckout-'.Tools::strtolower($productConfigs['CODE']).'.tpl'
737 737
                     );
738 738
                 } elseif (_PS_VERSION_ < 1.7) {
739 739
                     $return .= $this->display(
740 740
                         __FILE__,
741
-                        'views/templates/hook/checkout-' . Tools::strtolower($productConfigs['CODE']) . '.tpl'
741
+                        'views/templates/hook/checkout-'.Tools::strtolower($productConfigs['CODE']).'.tpl'
742 742
                     );
743 743
                 }
744 744
             }
@@ -771,12 +771,12 @@  discard block
 block discarded – undo
771 771
             $productConfigs = Pagantis::getExtraConfig($product, null);
772 772
             $productConfigs = json_decode($productConfigs, true);
773 773
 
774
-            $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_public_key');
775
-            $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_simulator_is_enabled');
774
+            $publicKey = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_public_key');
775
+            $simulatorIsEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_simulator_is_enabled');
776 776
             if (Tools::strtolower($productConfigs['CODE']) === 'p4x') {
777 777
                 $simulatorIsEnabled = true;
778 778
             }
779
-            $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']) . '_is_enabled');
779
+            $isEnabled = Configuration::get(Tools::strtolower($productConfigs['CODE']).'_is_enabled');
780 780
             $availableSimulators = array(
781 781
                 'hookDisplayProductButtons' => array(
782 782
                     'sdk.simulator.types.SIMPLE',
@@ -799,30 +799,30 @@  discard block
 block discarded – undo
799 799
                 in_array(Tools::strtolower($this->language), $allowedCountries) &&
800 800
                 (in_array($productConfigs['SIMULATOR_DISPLAY_TYPE'], $availableSimulators[$hookName]) || _PS_VERSION_ < 1.6)
801 801
             ) {
802
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_TITLE'] = $this->l($productConfigs['TITLE']);
803
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_TITLE'] = $this->l($productConfigs['SIMULATOR_TITLE']);
804
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_SUBTITLE'] = $this->l($productConfigs['SIMULATOR_SUBTITLE']);
802
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_TITLE'] = $this->l($productConfigs['TITLE']);
803
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_TITLE'] = $this->l($productConfigs['SIMULATOR_TITLE']);
804
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_SUBTITLE'] = $this->l($productConfigs['SIMULATOR_SUBTITLE']);
805 805
                 unset($productConfigs['TITLE']);
806 806
                 unset($productConfigs['SIMULATOR_TITLE']);
807 807
                 unset($productConfigs['SIMULATOR_SUBTITLE']);
808
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_AMOUNT'] = $amount;
809
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_AMOUNT4X'] = number_format(($amount / 4), 2, '.', '');
810
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_IS_PROMOTED_PRODUCT'] = $isPromotedProduct;
811
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOCALE'] = $this->language;
812
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_COUNTRY'] = $this->language;
813
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PUBLIC_KEY'] = $publicKey;
814
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled;
815
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_IS_ENABLED'] = $isEnabled;
816
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png';
817
-                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . '_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3));
808
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_AMOUNT'] = $amount;
809
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_AMOUNT4X'] = number_format(($amount / 4), 2, '.', '');
810
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_IS_PROMOTED_PRODUCT'] = $isPromotedProduct;
811
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOCALE'] = $this->language;
812
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_COUNTRY'] = $this->language;
813
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PUBLIC_KEY'] = $publicKey;
814
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_SIMULATOR_IS_ENABLED'] = $simulatorIsEnabled;
815
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_IS_ENABLED'] = $isEnabled;
816
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_LOGO'] = 'https://cdn.digitalorigin.com/assets/master/logos/pg-favicon.png';
817
+                $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])).'_PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3));
818 818
                 foreach ($productConfigs as $productConfigKey => $productConfigValue) {
819
-                    $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE'])) . "_" . $productConfigKey] = $productConfigValue;
819
+                    $templateConfigs[Tools::strtoupper(Tools::strtolower($productConfigs['CODE']))."_".$productConfigKey] = $productConfigValue;
820 820
                 }
821 821
 
822 822
                 $this->context->smarty->assign($templateConfigs);
823 823
                 $return .= $this->display(
824 824
                     __FILE__,
825
-                    'views/templates/hook/product-simulator-' . Tools::strtolower($productConfigs['CODE']) . '.tpl'
825
+                    'views/templates/hook/product-simulator-'.Tools::strtolower($productConfigs['CODE']).'.tpl'
826 826
                 );
827 827
             }
828 828
         }
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
         // $params['type'] = weight | price | after_price
852 852
         if (isset($params['type']) && $params['type'] === 'price' &&
853 853
             isset($params['smarty']) && isset($params['smarty']->template_resource) &&
854
-            (strpos($params['smarty']->template_resource, 'product.tpl') !== false  ||
854
+            (strpos($params['smarty']->template_resource, 'product.tpl') !== false ||
855 855
             strpos($params['smarty']->template_resource, 'product-prices.tpl') !== false)
856 856
         ) {
857 857
             return $this->productPageSimulatorDisplay("hookDisplayProductPriceBlock");
@@ -884,16 +884,16 @@  discard block
 block discarded – undo
884 884
         if (!in_array(PROMOTIONS_CATEGORY_NAME, $categories)) {
885 885
             /** @var CategoryCore $category */
886 886
             $category = new Category();
887
-            $categoryArray = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY );
887
+            $categoryArray = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY);
888 888
             $category->is_root_category = false;
889 889
             $category->link_rewrite = $categoryArray;
890 890
             $category->meta_description = $categoryArray;
891 891
             $category->meta_keywords = $categoryArray;
892 892
             $category->meta_title = $categoryArray;
893
-            $category->name = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME);
893
+            $category->name = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME);
894 894
             $category->id_parent = Configuration::get('PS_HOME_CATEGORY');
895
-            $category->active=0;
896
-            $description = 'Pagantis: Products with this category have free financing assumed by the merchant. ' .
895
+            $category->active = 0;
896
+            $description = 'Pagantis: Products with this category have free financing assumed by the merchant. '.
897 897
                 'Use it to promote your products or brands.';
898 898
             $category->description = $this->l($description);
899 899
             $category->save();
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
         }
914 914
 
915 915
         if (is_null($product)) {
916
-            $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \'' . pSQL($config) . '\' limit 1';
916
+            $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \''.pSQL($config).'\' limit 1';
917 917
             if ($results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql)) {
918 918
                 if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) {
919 919
                     return $results[0]['value'];
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
             }
922 922
         }
923 923
 
924
-        $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \'' . pSQL($product) . '\' limit 1';
924
+        $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \''.pSQL($product).'\' limit 1';
925 925
         if ($results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql)) {
926 926
             if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) {
927 927
                 $configs = json_decode($results[0]['value'], true);
@@ -941,10 +941,10 @@  discard block
 block discarded – undo
941 941
      */
942 942
     public function checkLogoExists()
943 943
     {
944
-        $logoPg = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/pagantis.png';
945
-        if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) {
944
+        $logoPg = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/pagantis.png';
945
+        if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) {
946 946
             copy(
947
-                _PS_PAGANTIS_DIR . '/logo.png',
947
+                _PS_PAGANTIS_DIR.'/logo.png',
948 948
                 $logoPg
949 949
             );
950 950
         }
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
         if (count($langArray) != 2 && isset($lang['locale'])) {
961 961
             $langArray = explode("-", $lang['locale']);
962 962
         }
963
-        $this->language = Tools::strtoupper($langArray[count($langArray)-1]);
963
+        $this->language = Tools::strtoupper($langArray[count($langArray) - 1]);
964 964
         // Prevent null language detection
965 965
         if (in_array(Tools::strtolower($this->language), $this->allowedCountries)) {
966 966
             return;
Please login to merge, or discard this patch.
controllers/front/api.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         header('HTTP/1.1 200 Ok', true, 200);
72 72
         header('Content-Type: application/json', true);
73
-        header('Content-Length: ' . Tools::strlen($result));
73
+        header('Content-Length: '.Tools::strlen($result));
74 74
 
75 75
         echo $result;
76 76
         exit();
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $productCode = Tools::getValue('product', false);
85 85
         $products = explode(',', Pagantis::getExtraConfig('PRODUCTS', null));
86
-        $privateKey = Configuration::get(Tools::strtolower($productCode) . '_private_key');
86
+        $privateKey = Configuration::get(Tools::strtolower($productCode).'_private_key');
87 87
         $privateKeyGet = Tools::getValue('secret', false);
88 88
         if (!empty($privateKeyGet) && $privateKeyGet === $privateKey && in_array(Tools::strtoupper($productCode), $products)) {
89 89
             return true;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
         header('HTTP/1.1 403 Forbidden', true, 403);
98 98
         header('Content-Type: application/json', true);
99
-        header('Content-Length: ' . Tools::strlen($result));
99
+        header('Content-Length: '.Tools::strlen($result));
100 100
 
101 101
         echo $result;
102 102
         exit();
Please login to merge, or discard this patch.
controllers/front/log.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
             $limit = Tools::getValue('limit');
37 37
         }
38 38
         if (Tools::getValue('from', false)) {
39
-            $where = 'WHERE createdAt >= \'' . Tools::getValue('from') . '\'';
39
+            $where = 'WHERE createdAt >= \''.Tools::getValue('from').'\'';
40 40
         }
41
-        $sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'pagantis_log ' . $where . ' ORDER BY id desc LIMIT ' . $limit;
41
+        $sql = 'SELECT * FROM '._DB_PREFIX_.'pagantis_log '.$where.' ORDER BY id desc LIMIT '.$limit;
42 42
         if ($results = Db::getInstance()->ExecuteS($sql)) {
43 43
             foreach ($results as $row) {
44 44
                 $data = (is_null(json_decode($row['log']))) ? $row['log'] : json_decode($row['log']);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
         header('HTTP/1.1 200 Ok', true, 200);
67 67
         header('Content-Type: application/json', true);
68
-        header('Content-Length: ' . Tools::strlen($result));
68
+        header('Content-Length: '.Tools::strlen($result));
69 69
 
70 70
         echo $result;
71 71
         exit();
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $productCode = Tools::getValue('product', false);
80 80
         $products = explode(',', Pagantis::getExtraConfig('PRODUCTS', null));
81
-        $privateKey = Configuration::get(Tools::strtolower($productCode) . '_private_key');
81
+        $privateKey = Configuration::get(Tools::strtolower($productCode).'_private_key');
82 82
         $privateKeyGet = Tools::getValue('secret', false);
83 83
         if (!empty($privateKeyGet) && $privateKeyGet === $privateKey && in_array(Tools::strtoupper($productCode), $products)) {
84 84
             return true;
Please login to merge, or discard this patch.
controllers/front/config.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  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
         $params = (_PS_VERSION_ < 1.6) ? $_POST + $_GET : Tools::getAllValues();
23 23
         if (method_exists($this, $method)) {
24 24
             header('HTTP/1.1 200 Ok', true, 200);
25 25
             header('Content-Type: application/json', true);
26 26
             $result = json_encode($this->{$method}($params['product']));
27
-            header('Content-Length: ' . Tools::strlen($result));
27
+            header('Content-Length: '.Tools::strlen($result));
28 28
             echo $result;
29 29
             exit();
30 30
         }
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function getExtraConfigs($product = null)
42 42
     {
43
-        $availableProductsSQL = 'select * from ' . _DB_PREFIX_. 'pagantis_config where config = \'PRODUCTS\'';
43
+        $availableProductsSQL = 'select * from '._DB_PREFIX_.'pagantis_config where config = \'PRODUCTS\'';
44 44
         $dbProducts = Db::getInstance()->executeS($availableProductsSQL);
45 45
         $availableProductsArray = explode(',', $dbProducts[0]['value']);
46 46
         $unrequestedProducts = array_diff($availableProductsArray, array($product));
47 47
         $unrequestedProductSQL = '';
48 48
         foreach ($unrequestedProducts as $unrequestedProduct) {
49
-            $unrequestedProductSQL .= "'". $unrequestedProduct . "',";
49
+            $unrequestedProductSQL .= "'".$unrequestedProduct."',";
50 50
         }
51 51
         $unrequestedProductSQL = rtrim($unrequestedProductSQL, ",");
52
-        $sql_content = 'select * from ' . _DB_PREFIX_.
53
-            'pagantis_config where config not in (' . $unrequestedProductSQL . ') 
52
+        $sql_content = 'select * from '._DB_PREFIX_.
53
+            'pagantis_config where config not in ('.$unrequestedProductSQL.') 
54 54
              and config not like (\'PAGANTIS_%\')  and config not like (\'PMT_%\') ';
55 55
 
56 56
         $dbConfigs = Db::getInstance()->executeS($sql_content);
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
         unset($params['secret']);
82 82
         $product = $params['product'];
83 83
         unset($params['product']);
84
-        $productConfigsSQL = 'select * from ' . _DB_PREFIX_.
85
-            'pagantis_config where config = \''. pSQL($product) . '\'';
84
+        $productConfigsSQL = 'select * from '._DB_PREFIX_.
85
+            'pagantis_config where config = \''.pSQL($product).'\'';
86 86
         $productConfigs = Db::getInstance()->executeS($productConfigsSQL);
87 87
         $availableProductsArray = json_decode($productConfigs[0]['value'], true);
88 88
         if (count($params) > 0) {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                             Db::getInstance()->update(
97 97
                                 'pagantis_config',
98 98
                                 array('value' => pSQL($value)),
99
-                                'config = \''. pSQL($config) .'\''
99
+                                'config = \''.pSQL($config).'\''
100 100
                             );
101 101
                         }
102 102
                     } else {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 Db::getInstance()->update(
107 107
                     'pagantis_config',
108 108
                     array('value' => json_encode($availableProductsArray)),
109
-                    'config = \''. pSQL($product) .'\''
109
+                    'config = \''.pSQL($product).'\''
110 110
                 );
111 111
             }
112 112
         } else {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     {
139 139
         $productCode = Tools::getValue('product', false);
140 140
         $products = explode(',', Pagantis::getExtraConfig('PRODUCTS', null));
141
-        $privateKey = Configuration::get(Tools::strtolower($productCode) . '_private_key');
141
+        $privateKey = Configuration::get(Tools::strtolower($productCode).'_private_key');
142 142
         $privateKeyGet = Tools::getValue('secret', false);
143 143
         if (!empty($privateKeyGet) && $privateKeyGet === $privateKey && in_array(Tools::strtoupper($productCode), $products)) {
144 144
             return true;
Please login to merge, or discard this patch.
controllers/front/payment.php 1 patch
Spacing   +29 added lines, -29 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(),
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
         $configs = json_decode(Pagantis::getExtraConfig($product, null), true);
89 89
         $iframe = Pagantis::getExtraConfig('FORM_DISPLAY_TYPE', $product);
90 90
 
91
-        $pagantisPublicKey = Configuration::get(Tools::strtolower($configs['CODE']) . '_public_key');
92
-        $pagantisPrivateKey = Configuration::get(Tools::strtolower($configs['CODE']) . '_private_key');
91
+        $pagantisPublicKey = Configuration::get(Tools::strtolower($configs['CODE']).'_public_key');
92
+        $pagantisPrivateKey = Configuration::get(Tools::strtolower($configs['CODE']).'_private_key');
93 93
 
94 94
         $okUrl = _PS_BASE_URL_SSL_.__PS_BASE_URI__
95
-            .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&token='.$urlToken.'&origin=redirect&product=' . Tools::strtolower($configs['CODE']) . '&'
95
+            .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&token='.$urlToken.'&origin=redirect&product='.Tools::strtolower($configs['CODE']).'&'
96 96
             .http_build_query($query)
97 97
         ;
98 98
         $notificationOkUrl = _PS_BASE_URL_SSL_.__PS_BASE_URI__
99
-            .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&token='.$urlToken.'&origin=notification&product=' . Tools::strtolower($configs['CODE']) . '&'
99
+            .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&token='.$urlToken.'&origin=notification&product='.Tools::strtolower($configs['CODE']).'&'
100 100
             .http_build_query($query)
101 101
         ;
102 102
 
@@ -111,27 +111,27 @@  discard block
 block discarded – undo
111 111
 
112 112
         try {
113 113
             $shippingCountry = Country::getIsoById($shippingAddress->id_country);
114
-            $userAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
114
+            $userAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
115 115
             $userAddress
116 116
                 ->setZipCode($shippingAddress->postcode)
117
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
117
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
118 118
                 ->setCountryCode($shippingCountry)
119 119
                 ->setCity($shippingAddress->city)
120
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
120
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
121 121
                 ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress))
122 122
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
123 123
                 ->setDni($this->getNationalId($customer, $shippingAddress, $billingAddress))
124 124
             ;
125 125
 
126
-            $orderShippingAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
126
+            $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
127 127
             $shippingPhone = (empty($shippingAddress->phone_mobile)) ?
128 128
                 $shippingAddress->phone : $shippingAddress->phone_mobile;
129 129
             $orderShippingAddress
130 130
                 ->setZipCode($shippingAddress->postcode)
131
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
131
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
132 132
                 ->setCountryCode($shippingCountry)
133 133
                 ->setCity($shippingAddress->city)
134
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
134
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
135 135
                 ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress))
136 136
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
137 137
                 ->setDni($this->getNationalId($customer, $shippingAddress, $billingAddress))
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
                 $billingAddress->phone : $billingAddress->phone_mobile;
146 146
             $orderBillingAddress
147 147
                 ->setZipCode($billingAddress->postcode)
148
-                ->setFullName($billingAddress->firstname . ' ' . $billingAddress->lastname)
148
+                ->setFullName($billingAddress->firstname.' '.$billingAddress->lastname)
149 149
                 ->setCountryCode($billingCountry)
150 150
                 ->setCity($billingAddress->city)
151
-                ->setAddress($billingAddress->address1 . ' ' . $billingAddress->address2)
151
+                ->setAddress($billingAddress->address1.' '.$billingAddress->address2)
152 152
                 ->setTaxId($this->getTaxId($customer, $billingAddress, $shippingAddress))
153 153
                 ->setNationalId($this->getNationalId($customer, $billingAddress, $shippingAddress))
154 154
                 ->setDni($this->getNationalId($customer, $shippingAddress, $billingAddress))
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                 ->setDni($this->getNationalId($customer, $shippingAddress, $billingAddress))
172 172
             ;
173 173
 
174
-            if ($customer->birthday!='0000-00-00') {
174
+            if ($customer->birthday != '0000-00-00') {
175 175
                 $orderUser->setDateOfBirth($customer->birthday);
176 176
             }
177 177
 
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
                     ->setQuantity($item['quantity'])
206 206
                     ->setDescription($item['name']);
207 207
                 if ($promotedProduct) {
208
-                    $promotedAmount+=$product->getAmount();
208
+                    $promotedAmount += $product->getAmount();
209 209
                     $productId = $item['id_product'];
210 210
                     $finalPrice = Product::getPriceStatic($productId);
211
-                    $promotedMessage = 'Promoted Item: ' . $product->getDescription() .
212
-                        ' Price: ' . $finalPrice .
213
-                        ' Qty: ' . $product->getQuantity() .
214
-                        ' Item ID: ' . $item['id_product'];
211
+                    $promotedMessage = 'Promoted Item: '.$product->getDescription().
212
+                        ' Price: '.$finalPrice.
213
+                        ' Qty: '.$product->getQuantity().
214
+                        ' Item ID: '.$item['id_product'];
215 215
                     $metadataOrder->addMetadata('promotedProduct', $promotedMessage);
216 216
                 }
217 217
                 $details->addProduct($product);
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             Tools::redirect($cancelUrl);
263 263
         }
264 264
 
265
-        $url ='';
265
+        $url = '';
266 266
         try {
267 267
             $orderClient = new \Pagantis\OrdersApiClient\Client(
268 268
                 trim($pagantisPublicKey),
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
                 $url = $order->getActionUrls()->getForm();
275 275
                 /** @var string $orderId MD5 value */
276 276
                 $orderId = $order->getId();
277
-                $sql = "INSERT INTO `" . _DB_PREFIX_ . "pagantis_order` (`id`, `order_id`, `token`)
277
+                $sql = "INSERT INTO `"._DB_PREFIX_."pagantis_order` (`id`, `order_id`, `token`)
278 278
                      VALUES ('$cart->id','$orderId', '$urlToken')";
279 279
                 $result = Db::getInstance()->execute($sql);
280 280
                 if (!$result) {
281
-                    throw new UnknownException('Unable to save pagantis-order-id in database: '. $sql);
281
+                    throw new UnknownException('Unable to save pagantis-order-id in database: '.$sql);
282 282
                 }
283 283
             } else {
284 284
                 throw new OrderNotFoundException();
@@ -410,13 +410,13 @@  discard block
 block discarded – undo
410 410
      */
411 411
     private function getUserLanguage($shippingAddress = null, $billingAddress = null)
412 412
     {
413
-        $allowedCountries    = unserialize(Pagantis::getExtraConfig('ALLOWED_COUNTRIES', null));
413
+        $allowedCountries = unserialize(Pagantis::getExtraConfig('ALLOWED_COUNTRIES', null));
414 414
         $lang = Language::getLanguage($this->context->language->id);
415 415
         $langArray = explode("-", $lang['language_code']);
416 416
         if (count($langArray) != 2 && isset($lang['locale'])) {
417 417
             $langArray = explode("-", $lang['locale']);
418 418
         }
419
-        $language = Tools::strtoupper($langArray[count($langArray)-1]);
419
+        $language = Tools::strtoupper($langArray[count($langArray) - 1]);
420 420
         // Prevent null language detection
421 421
         if (in_array(Tools::strtolower($language), $allowedCountries)) {
422 422
             return $language;
Please login to merge, or discard this patch.
controllers/front/notify.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         } catch (\Exception $exception) {
150 150
             $thrownException = true;
151 151
             $this->getMerchantOrderId();
152
-            $theId = ($this->merchantOrderId)? $this->merchantOrderId : $this->merchantCartId;
152
+            $theId = ($this->merchantOrderId) ? $this->merchantOrderId : $this->merchantCartId;
153 153
             if ($this->isPost()) {
154 154
                 $this->jsonResponse = new JsonExceptionResponse();
155 155
                 $this->jsonResponse->setMerchantOrderId($theId);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             if (!$thrownException) {
165 165
                 $this->jsonResponse = new JsonSuccessResponse();
166 166
                 $this->getMerchantOrderId();
167
-                $theId = ($this->merchantOrderId)? $this->merchantOrderId : $this->merchantCartId;
167
+                $theId = ($this->merchantOrderId) ? $this->merchantOrderId : $this->merchantCartId;
168 168
                 $this->jsonResponse->setMerchantOrderId($theId);
169 169
                 $this->jsonResponse->setPagantisOrderId($this->pagantisOrderId);
170 170
                 $this->confirmPagantisOrder();
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             $this->rollbackMerchantOrder();
174 174
             if ($this->isNotification()) {
175 175
                 $this->getMerchantOrderId();
176
-                $theId = ($this->merchantOrderId)? $this->merchantOrderId : $this->merchantCartId;
176
+                $theId = ($this->merchantOrderId) ? $this->merchantOrderId : $this->merchantCartId;
177 177
                 $this->jsonResponse = new JsonExceptionResponse();
178 178
                 $this->jsonResponse->setMerchantOrderId($theId);
179 179
                 $this->jsonResponse->setPagantisOrderId($this->pagantisOrderId);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         } catch (\Exception $exception) {
191 191
             $thrownException = true;
192 192
             $this->getMerchantOrderId();
193
-            $theId = ($this->merchantOrderId)? $this->merchantOrderId : $this->merchantCartId;
193
+            $theId = ($this->merchantOrderId) ? $this->merchantOrderId : $this->merchantCartId;
194 194
             if ($this->isPost()) {
195 195
                 $this->jsonResponse = new JsonExceptionResponse();
196 196
                 $this->jsonResponse->setMerchantOrderId($theId);
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
         $products = explode(',', Pagantis::getExtraConfig('PRODUCTS', null));
260 260
         if (!in_array(Tools::strtoupper($productCode), $products)) {
261 261
             throw new UnknownException(
262
-                'No valid Pagantis product provided in the url: ' . Tools::getValue('product')
262
+                'No valid Pagantis product provided in the url: '.Tools::getValue('product')
263 263
             );
264 264
         }
265
-        $this->productName = "Pagantis " . Tools::strtolower($productCode);
265
+        $this->productName = "Pagantis ".Tools::strtolower($productCode);
266 266
 
267
-        $this->config['publicKey'] = trim(Configuration::get(Tools::strtolower($productCode) . '_public_key'));
268
-        $this->config['privateKey'] = trim(Configuration::get(Tools::strtolower($productCode) . '_private_key'));
267
+        $this->config['publicKey'] = trim(Configuration::get(Tools::strtolower($productCode).'_public_key'));
268
+        $this->config['privateKey'] = trim(Configuration::get(Tools::strtolower($productCode).'_private_key'));
269 269
 
270 270
         $this->merchantCartId = Tools::getValue('id_cart');
271 271
 
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
     public function getMerchantOrderId()
286 286
     {
287 287
         try {
288
-            $sql = 'select ps_order_id from ' . _DB_PREFIX_ .self::ORDERS_TABLE .' where id = '
289
-                .(int)$this->merchantCartId . ' and token = \'' . $this->token . '\'';
288
+            $sql = 'select ps_order_id from '._DB_PREFIX_.self::ORDERS_TABLE.' where id = '
289
+                .(int) $this->merchantCartId.' and token = \''.$this->token.'\'';
290 290
             $this->merchantOrderId = Db::getInstance()->getValue($sql);
291 291
         } catch (\Exception $exception) {
292 292
             $exceptionMessage = sprintf(
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
     private function getPagantisOrderId()
331 331
     {
332 332
         try {
333
-            $sql = 'select order_id from ' . _DB_PREFIX_.self::ORDERS_TABLE .' where id = '
334
-                .(int)$this->merchantCartId . ' and token = \'' . $this->token . '\'';
335
-            $this->pagantisOrderId= Db::getInstance()->getValue($sql);
333
+            $sql = 'select order_id from '._DB_PREFIX_.self::ORDERS_TABLE.' where id = '
334
+                .(int) $this->merchantCartId.' and token = \''.$this->token.'\'';
335
+            $this->pagantisOrderId = Db::getInstance()->getValue($sql);
336 336
 
337 337
             if (is_null($this->pagantisOrderId)) {
338 338
                 throw new NoIdentificationException();
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     {
366 366
         if ($this->pagantisOrder->getStatus() === PagantisModelOrder::STATUS_CONFIRMED) {
367 367
             $this->getMerchantOrderId();
368
-            $theId = ($this->merchantOrderId)? $this->merchantOrderId : $this->merchantCartId;
368
+            $theId = ($this->merchantOrderId) ? $this->merchantOrderId : $this->merchantCartId;
369 369
             $this->jsonResponse = new JsonSuccessResponse();
370 370
             $this->jsonResponse->setMerchantOrderId($theId);
371 371
             $this->jsonResponse->setPagantisOrderId($this->pagantisOrderId);
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
             $psTotalAmount = substr_replace(
397 397
                 $merchantAmount,
398 398
                 '.',
399
-                (Tools::strlen($merchantAmount) -2),
399
+                (Tools::strlen($merchantAmount) - 2),
400 400
                 0
401 401
             );
402 402
 
@@ -404,14 +404,14 @@  discard block
 block discarded – undo
404 404
             $pgTotalAmount = substr_replace(
405 405
                 $pgTotalAmountInCents,
406 406
                 '.',
407
-                (Tools::strlen($pgTotalAmountInCents) -2),
407
+                (Tools::strlen($pgTotalAmountInCents) - 2),
408 408
                 0
409 409
             );
410 410
 
411
-            $this->amountMismatchError = '. Amount mismatch in PrestaShop Cart #'. $this->merchantCartId .
412
-                ' compared with Pagantis Order: ' . $this->pagantisOrderId .
413
-                '. The Cart in PrestaShop has an amount of ' . $psTotalAmount . ' and in Pagantis ' .
414
-                $pgTotalAmount . ' PLEASE REVIEW THE ORDER';
411
+            $this->amountMismatchError = '. Amount mismatch in PrestaShop Cart #'.$this->merchantCartId.
412
+                ' compared with Pagantis Order: '.$this->pagantisOrderId.
413
+                '. The Cart in PrestaShop has an amount of '.$psTotalAmount.' and in Pagantis '.
414
+                $pgTotalAmount.' PLEASE REVIEW THE ORDER';
415 415
 
416 416
             $this->saveLog(array(
417 417
                 'requestId' => $this->requestId,
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
             ));
420 420
             $numberPagantisAmount = (integer) $this->pagantisOrder->getShoppingCart()->getTotalAmount();
421 421
             $numberMerchantAmount = (integer) (100 * $this->merchantCart->getOrderTotal(true));
422
-            $amountDff =  $numberMerchantAmount - $numberPagantisAmount;
422
+            $amountDff = $numberMerchantAmount - $numberPagantisAmount;
423 423
             if (abs($amountDff) > self::MISMATCH_AMOUNT_THRESHOLD) {
424 424
                 throw new AmountMismatchException($totalAmount, $merchantAmount);
425 425
             }
@@ -446,12 +446,12 @@  discard block
 block discarded – undo
446 446
             }
447 447
 
448 448
             // Double check
449
-            $tableName = _DB_PREFIX_ . self::ORDERS_TABLE;
449
+            $tableName = _DB_PREFIX_.self::ORDERS_TABLE;
450 450
             $fieldName = 'ps_order_id';
451
-            $sql = ('select ' . $fieldName . ' from `' . $tableName . '` where `id` = ' . (int)$this->merchantCartId
452
-                . ' and `order_id` = \'' . $this->pagantisOrderId . '\''
453
-                . ' and `token` = \'' . $this->token . '\''
454
-                . ' and `' . $fieldName . '` is not null');
451
+            $sql = ('select '.$fieldName.' from `'.$tableName.'` where `id` = '.(int) $this->merchantCartId
452
+                . ' and `order_id` = \''.$this->pagantisOrderId.'\''
453
+                . ' and `token` = \''.$this->token.'\''
454
+                . ' and `'.$fieldName.'` is not null');
455 455
             $results = Db::getInstance()->ExecuteS($sql);
456 456
             if (is_array($results) && count($results) === 1) {
457 457
                 $this->getMerchantOrderId();
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
                 Configuration::get('PS_OS_PAYMENT'),
492 492
                 $this->merchantCart->getOrderTotal(true),
493 493
                 $this->productName,
494
-                'pagantisOrderId: ' . $this->pagantisOrder->getId() . ' ' .
495
-                'pagantisOrderStatus: '. $this->pagantisOrder->getStatus() .
496
-                $this->amountMismatchError .
494
+                'pagantisOrderId: '.$this->pagantisOrder->getId().' '.
495
+                'pagantisOrderStatus: '.$this->pagantisOrder->getStatus().
496
+                $this->amountMismatchError.
497 497
                 $metadataInfo,
498 498
                 array('transaction_id' => $this->pagantisOrderId),
499 499
                 null,
@@ -507,9 +507,9 @@  discard block
 block discarded – undo
507 507
             Db::getInstance()->update(
508 508
                 self::ORDERS_TABLE,
509 509
                 array('ps_order_id' => $this->module->currentOrder),
510
-                'id = '. (int)$this->merchantCartId
511
-                    . ' and order_id = \'' . $this->pagantisOrderId . '\''
512
-                    . ' and token = \'' . $this->token . '\''
510
+                'id = '.(int) $this->merchantCartId
511
+                    . ' and order_id = \''.$this->pagantisOrderId.'\''
512
+                    . ' and token = \''.$this->token.'\''
513 513
             );
514 514
 
515 515
         } catch (\Exception $exception) {
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
             $this->orderClient->confirmOrder($this->pagantisOrderId);
537 537
             try {
538 538
                 $mode = ($this->isPost()) ? 'NOTIFICATION' : 'REDIRECTION';
539
-                $message = 'Order CONFIRMED. The order was confirmed by a ' . $mode .
540
-                    '. Pagantis OrderId=' . $this->pagantisOrderId .
541
-                    '. Prestashop OrderId=' . $this->module->currentOrder;
539
+                $message = 'Order CONFIRMED. The order was confirmed by a '.$mode.
540
+                    '. Pagantis OrderId='.$this->pagantisOrderId.
541
+                    '. Prestashop OrderId='.$this->module->currentOrder;
542 542
                 $this->saveLog(array('requestId' => $this->requestId, 'message' => $message));
543 543
             } catch (\Exception $exception) {
544 544
                 $exceptionMessage = sprintf(
@@ -565,16 +565,16 @@  discard block
 block discarded – undo
565 565
     {
566 566
         try {
567 567
             $this->getMerchantOrderId();
568
-            $message = 'Roolback method: ' .
569
-                '. Pagantis OrderId=' . $this->pagantisOrderId .
570
-                '. Prestashop CartId=' . $this->merchantCartId .
571
-                '. Prestashop OrderId=' . $this->merchantOrderId;
568
+            $message = 'Roolback method: '.
569
+                '. Pagantis OrderId='.$this->pagantisOrderId.
570
+                '. Prestashop CartId='.$this->merchantCartId.
571
+                '. Prestashop OrderId='.$this->merchantOrderId;
572 572
             if ($this->module->currentOrder) {
573 573
                 $objOrder = new Order($this->module->currentOrder);
574 574
                 $history = new OrderHistory();
575
-                $history->id_order = (int)$objOrder->id;
576
-                $history->changeIdOrderState(8, (int)($objOrder->id));
577
-                $message .= ' Prestashop OrderId=' . $this->merchantCartId;
575
+                $history->id_order = (int) $objOrder->id;
576
+                $history->changeIdOrderState(8, (int) ($objOrder->id));
577
+                $message .= ' Prestashop OrderId='.$this->merchantCartId;
578 578
             }
579 579
             $this->saveLog(array(
580 580
                 'requestId' => $this->requestId,
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
     {
600 600
         try {
601 601
             $table = self::CART_TABLE;
602
-            $insertBlock = Db::getInstance()->insert($table, array('id' =>(int)$orderId, 'timestamp' =>(time())));
602
+            $insertBlock = Db::getInstance()->insert($table, array('id' =>(int) $orderId, 'timestamp' =>(time())));
603 603
             if ($insertBlock === false) {
604 604
                 if ($this->isNotification()) {
605 605
                     throw new ConcurrencyException();
@@ -609,11 +609,11 @@  discard block
 block discarded – undo
609 609
                               as rest FROM %s WHERE %s",
610 610
                         self::CONCURRENCY_TIMEOUT,
611 611
                         _DB_PREFIX_.$table,
612
-                        'id='.(int)$orderId
612
+                        'id='.(int) $orderId
613 613
                     );
614 614
                     $resultSeconds = Db::getInstance()->getValue($query);
615 615
                     $restSeconds = isset($resultSeconds) ? ($resultSeconds) : 0;
616
-                    $secondsToExpire = ($restSeconds>self::CONCURRENCY_TIMEOUT) ?
616
+                    $secondsToExpire = ($restSeconds > self::CONCURRENCY_TIMEOUT) ?
617 617
                         self::CONCURRENCY_TIMEOUT : $restSeconds;
618 618
                     if ($secondsToExpire > 0) {
619 619
                         sleep($secondsToExpire + 1);
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
                     $this->getMerchantOrderId();
623 623
                     $this->getPagantisOrderId();
624 624
 
625
-                    $logMessage  = sprintf(
625
+                    $logMessage = sprintf(
626 626
                         "User has waited %s seconds, default %s, bd time to expire %s [cartId=%s][origin=%s]",
627 627
                         $secondsToExpire,
628 628
                         self::CONCURRENCY_TIMEOUT,
@@ -651,10 +651,10 @@  discard block
 block discarded – undo
651 651
     {
652 652
         try {
653 653
             if (is_null($orderId)) {
654
-                Db::getInstance()->delete(self::CART_TABLE, 'timestamp < ' . (time() - self::CONCURRENCY_TIMEOUT));
654
+                Db::getInstance()->delete(self::CART_TABLE, 'timestamp < '.(time() - self::CONCURRENCY_TIMEOUT));
655 655
                 return;
656 656
             }
657
-            Db::getInstance()->delete(self::CART_TABLE, 'id = ' . (int)$orderId);
657
+            Db::getInstance()->delete(self::CART_TABLE, 'id = '.(int) $orderId);
658 658
         } catch (\Exception $exception) {
659 659
             throw new ConcurrencyException();
660 660
         }
@@ -679,8 +679,8 @@  discard block
 block discarded – undo
679 679
             'merchantCartId' => $this->merchantCartId,
680 680
             'merchantOrderId' => $this->merchantOrderId,
681 681
             'pagantisOrderId' => $this->pagantisOrderId,
682
-            'message' => ($exception)? $exception->getMessage() : 'Unable to get Exception message',
683
-            'statusCode' => ($exception)? $exception->getCode() : 'Unable to get Exception statusCode',
682
+            'message' => ($exception) ? $exception->getMessage() : 'Unable to get Exception message',
683
+            'statusCode' => ($exception) ? $exception->getCode() : 'Unable to get Exception statusCode',
684 684
             'method' => $method,
685 685
             'file' => __FILE__,
686 686
             'line' => $line,
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
                 'id_module' => $this->module->id,
717 717
                 'id_order' => ($this->pagantisOrder) ? $this->pagantisOrder->getId() : null,
718 718
             );
719
-            $url = ($error)? $this->config['urlKO'] : $this->config['urlOK'];
719
+            $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK'];
720 720
             $returnMessage = sprintf(
721 721
                 "[origin=%s][cartId=%s][prestashopOrderId=%s][pagantisOrderId=%s][returnUrl=%s]",
722 722
                 $this->getOrigin(),
Please login to merge, or discard this patch.