Passed
Pull Request — master (#4)
by Raúl
03:58
created
catalog/ext/modules/payment/pagantis/notifyController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
             if ($this->origin == 'notify') {
77 77
                 $jsonResponse->printResponse();
78
-            } else {
78
+            }else {
79 79
                 if ($exception->getMessage() == AlreadyProcessedException::ERROR_MESSAGE) {
80 80
                     return;
81 81
                 }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
         if ($this->origin == 'notify') {
110 110
             $jsonResponse->printResponse();
111
-        } else {
111
+        }else {
112 112
             return $jsonResponse;
113 113
         }
114 114
     }
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
         try {
181 181
             $this->checkPagantisStatus(array('AUTHORIZED'));
182 182
         } catch (\Exception $e) {
183
-            if ($this->findOscommerceOrderId()!='') {
183
+            if ($this->findOscommerceOrderId() != '') {
184 184
                 throw new AlreadyProcessedException();
185
-            } else {
185
+            }else {
186 186
                 if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
187 187
                     $status = $this->pagantisOrder->getStatus();
188
-                } else {
188
+                }else {
189 189
                     $status = '-';
190 190
                 }
191 191
                 throw new WrongStatusException($status);
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     {
201 201
         global $order;
202 202
 
203
-        if ($order->info['order_status']!=='1') {
203
+        if ($order->info['order_status'] !== '1') {
204 204
             throw new AlreadyProcessedException();
205 205
         }
206 206
     }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             if ($orderId == null) {
278 278
                 $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where  timestamp<".(time() - 5);
279 279
                 tep_db_query($query);
280
-            } elseif ($orderId!='') {
280
+            } elseif ($orderId != '') {
281 281
                 $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where id='$orderId'";
282 282
                 tep_db_query($query);
283 283
             }
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
             if (!$payed) {
330 330
                 if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
331 331
                     $status = $this->pagantisOrder->getStatus();
332
-                } else {
332
+                }else {
333 333
                     $status = '-';
334 334
                 }
335 335
                 throw new WrongStatusException($status);
336 336
             }
337
-        } else {
337
+        }else {
338 338
             throw new OrderNotFoundException();
339 339
         }
340 340
     }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         tep_db_query($query);
368 368
 
369 369
         $comment = "Pagantis id=$this->pagantisOrderId/Via=".ucfirst($this->origin);
370
-        $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY ."(comments, orders_id, orders_status_id, customer_notified, date_added) values
370
+        $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY."(comments, orders_id, orders_status_id, customer_notified, date_added) values
371 371
             ('$comment', ".$insert_id.", '2', -1, now() )";
372 372
         tep_db_query($query);
373 373
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     private function insertLog($exception)
393 393
     {
394 394
         if ($exception instanceof \Exception) {
395
-            $logEntry= new LogEntry();
395
+            $logEntry = new LogEntry();
396 396
             $logEntryJson = $logEntry->error($exception)->toJson();
397 397
 
398 398
             $query = "insert into ".TABLE_PAGANTIS_LOG."(log) values ('$logEntryJson')";
Please login to merge, or discard this patch.
test/Buy/CancelBuyRegisteredTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $checkoutStepShippingMethodSearch = WebDriverBy::id('checkout-shipping-method-load');
40 40
         $condition = WebDriverExpectedCondition::visibilityOfElementLocated($checkoutStepShippingMethodSearch);
41 41
         $this->webDriver->wait()->until($condition);
42
-        $this->assertTrue((bool) $condition);
42
+        $this->assertTrue((bool)$condition);
43 43
     }
44 44
 
45 45
     /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $billingAddressSelector = WebDriverBy::id('billing-address-select');
55 55
         $condition = WebDriverExpectedCondition::visibilityOfElementLocated($billingAddressSelector);
56 56
         $this->webDriver->wait()->until($condition);
57
-        $this->assertTrue((bool) $condition);
57
+        $this->assertTrue((bool)$condition);
58 58
     }
59 59
 
60 60
     /**
Please login to merge, or discard this patch.
test/PagantisOscommerceTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
         $faker = Factory::create();
65 65
         $this->configuration['dni'] = $this->getDNI();
66 66
         $this->configuration['firstname'] = $faker->firstName;
67
-        $this->configuration['lastname'] = $faker->lastName . ' ' . $faker->lastName;
67
+        $this->configuration['lastname'] = $faker->lastName.' '.$faker->lastName;
68 68
         $this->configuration['company'] = $faker->company;
69 69
         $this->configuration['zip'] = '28'.$faker->randomNumber(3, true);
70 70
         $this->configuration['address'] = $faker->streetAddress;
71
-        $this->configuration['phone'] = '6' . $faker->randomNumber(8);
72
-        $this->configuration['email'] = date('ymd') . '@pagantis.com';
71
+        $this->configuration['phone'] = '6'.$faker->randomNumber(8);
72
+        $this->configuration['email'] = date('ymd').'@pagantis.com';
73 73
         parent::__construct($name, $data, $dataName);
74 74
     }
75 75
     /**
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
      */
78 78
     protected function getDNI()
79 79
     {
80
-        $dni = '0000' . rand(pow(10, 4-1), pow(10, 4)-1);
81
-        $value = (int) ($dni / 23);
80
+        $dni = '0000'.rand(pow(10, 4 - 1), pow(10, 4) - 1);
81
+        $value = (int)($dni / 23);
82 82
         $value *= 23;
83
-        $value= $dni - $value;
84
-        $letter= "TRWAGMYFPDXBNJZSQVHLCKEO";
85
-        $dniLetter= substr($letter, $value, 1);
83
+        $value = $dni - $value;
84
+        $letter = "TRWAGMYFPDXBNJZSQVHLCKEO";
85
+        $dniLetter = substr($letter, $value, 1);
86 86
         return $dni.$dniLetter;
87 87
     }
88 88
 
Please login to merge, or discard this patch.
test/Buy/BuyRegisteredTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     protected function checkPagantisOrderId()
141 141
     {
142
-        $orderId=0;
142
+        $orderId = 0;
143 143
         $notifyUrl = self::OSCURL.self::NOTIFICATION_FOLDER.'?order='.$orderId;
144 144
         $this->assertNotEmpty($notifyUrl, $notifyUrl);
145 145
         $response = Request::post($notifyUrl)->expects('json')->send();
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $this->assertEquals(
150 150
             $response->body->merchant_order_id,
151 151
             $orderId,
152
-            $response->body->merchant_order_id.'!='. $orderId
152
+            $response->body->merchant_order_id.'!='.$orderId
153 153
         );
154 154
         $this->assertContains(
155 155
             NoIdentificationException::ERROR_MESSAGE,
Please login to merge, or discard this patch.
test/Buy/AbstractBuy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         sleep(3);
97 97
         $productLinkElement->click();
98 98
         $this->assertSame(
99
-            self::PRODUCT_NAME . ', ' . self::TITLE,
99
+            self::PRODUCT_NAME.', '.self::TITLE,
100 100
             $this->webDriver->getTitle()
101 101
         );
102 102
     }
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
         $paymentFormElement = WebDriverBy::className('FieldsPreview-desc');
182 182
         $condition = WebDriverExpectedCondition::visibilityOfElementLocated($paymentFormElement);
183 183
         $this->webDriver->wait()->until($condition);
184
-        $this->assertTrue((bool) $condition);
184
+        $this->assertTrue((bool)$condition);
185 185
         $this->assertSame(
186
-            $this->configuration['firstname'] . ' ' . $this->configuration['lastname'],
186
+            $this->configuration['firstname'].' '.$this->configuration['lastname'],
187 187
             $this->findByClass('FieldsPreview-desc')->getText()
188 188
         );
189 189
     }
Please login to merge, or discard this patch.
catalog/includes/modules/payment/pagantis.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
         try {
157 157
             include_once('./ext/modules/payment/pagantis/vendor/autoload.php');
158 158
             global $order, $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping,
159
-                   $payment, $comments, $customer_default_address_id, $cartID;
159
+                    $payment, $comments, $customer_default_address_id, $cartID;
160 160
             $global_vars = array();
161 161
             $global_vars['customer_id'] = serialize($customer_id);
162 162
             $global_vars['sendTo'] = serialize($sendto);
Please login to merge, or discard this patch.
Spacing   +45 added lines, -46 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
         if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) {
60 60
             $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_ADMIN_TITLE; // Payment module title in Admin
61
-        } else {
61
+        }else {
62 62
             $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CATALOG_TITLE; // Payment module title in Catalog
63 63
         }
64 64
 
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
                 "%s://%s%s%s",
72 72
                 isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
73 73
                 $_SERVER['SERVER_NAME'],
74
-                isset($_SERVER['SERVER_PORT']) ? ":" . $_SERVER['SERVER_PORT'] : '',
74
+                isset($_SERVER['SERVER_PORT']) ? ":".$_SERVER['SERVER_PORT'] : '',
75 75
                 $_SERVER['REQUEST_URI']
76 76
             )
77 77
         );
78 78
 
79
-        $this->form_action_url = $this->base_url . '/ext/modules/payment/pagantis/bypass.php';
79
+        $this->form_action_url = $this->base_url.'/ext/modules/payment/pagantis/bypass.php';
80 80
     }
81 81
 
82 82
     /***************
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
                 throw new UnknownException("Order not found");
176 176
             }
177 177
 
178
-            $id_hash = time() . serialize($order->products) . '' . serialize($order->customer) . '' . serialize($order->delivery);
178
+            $id_hash = time().serialize($order->products).''.serialize($order->customer).''.serialize($order->delivery);
179 179
             $this->os_order_reference = md5($id_hash);
180 180
             $_SESSION['order_id'] = $this->os_order_reference;
181 181
 
182 182
             $userAddress = new Address();
183 183
             $userAddress
184 184
                 ->setZipCode($order->billing['postcode'])
185
-                ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname'])
185
+                ->setFullName($order->billing['firstname'].' '.$order->billing['lastname'])
186 186
                 ->setCountryCode('ES')
187 187
                 ->setCity($order->billing['city'])
188 188
                 ->setAddress($order->billing['street_address'])
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             $orderShippingAddress = new Address();
195 195
             $orderShippingAddress
196 196
                 ->setZipCode($order->delivery['postcode'])
197
-                ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname'])
197
+                ->setFullName($order->billing['firstname'].' '.$order->billing['lastname'])
198 198
                 ->setCountryCode('ES')
199 199
                 ->setCity($order->delivery['city'])
200 200
                 ->setAddress($order->delivery['street_address'])
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User();
205 205
             $orderUser
206 206
                 ->setAddress($userAddress)
207
-                ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname'])
207
+                ->setFullName($order->billing['firstname'].' '.$order->billing['lastname'])
208 208
                 ->setBillingAddress($orderBillingAddress)
209 209
                 ->setEmail($order->customer['email_address'])
210 210
                 ->setFixPhone($order->customer['telephone'])
@@ -239,9 +239,8 @@  discard block
 block discarded – undo
239 239
                 ->setPromotedAmount(0)
240 240
                 ->setTotalAmount(intval($order->info['total'] * 100));
241 241
 
242
-            $callback_url = $this->base_url . '/ext/modules/payment/pagantis/notify.php';
243
-            $checkoutProcessUrl = htmlspecialchars_decode
244
-            (
242
+            $callback_url = $this->base_url.'/ext/modules/payment/pagantis/notify.php';
243
+            $checkoutProcessUrl = htmlspecialchars_decode(
245 244
                 tep_href_link(
246 245
                     FILENAME_CHECKOUT_PROCESS,
247 246
                     "order_id=$this->os_order_reference&from=order",
@@ -292,16 +291,16 @@  discard block
 block discarded – undo
292 291
             if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
293 292
                 $url = $pagantisOrder->getActionUrls()->getForm();
294 293
                 $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars));
295
-            } else {
294
+            }else {
296 295
                 throw new OrderNotFoundException();
297 296
             }
298 297
 
299 298
             if ($url == "") {
300 299
                 throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis"));
301
-            } else {
300
+            }else {
302 301
                 $output = "\n";
303
-                $output .= tep_draw_hidden_field("formUrl", $url) . "\n";
304
-                $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n";
302
+                $output .= tep_draw_hidden_field("formUrl", $url)."\n";
303
+                $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n";
305 304
                 return $output;
306 305
 
307 306
             } //TODO IFRAME
@@ -341,7 +340,7 @@  discard block
 block discarded – undo
341 340
     public function check()
342 341
     {
343 342
         if (!isset($this->_check)) {
344
-            $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " 
343
+            $check_query = tep_db_query("select configuration_value from ".TABLE_CONFIGURATION." 
345 344
                                          where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'");
346 345
             $this->_check = tep_db_num_rows($check_query);
347 346
         }
@@ -360,7 +359,7 @@  discard block
 block discarded – undo
360 359
             tep_redirect(tep_href_link(FILENAME_MODULES, 'set=payment&module=pagantis', 'NONSSL'));
361 360
             return 'failed';
362 361
         }
363
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
362
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
364 363
         (
365 364
             configuration_title,
366 365
             configuration_key,
@@ -383,7 +382,7 @@  discard block
 block discarded – undo
383 382
             ',
384 383
             now()
385 384
         )");
386
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
385
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
387 386
         (
388 387
             configuration_title,
389 388
             configuration_key,
@@ -403,7 +402,7 @@  discard block
 block discarded – undo
403 402
             '0',
404 403
             now()
405 404
         )");
406
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
405
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
407 406
         (
408 407
             configuration_title,
409 408
             configuration_key,
@@ -434,14 +433,14 @@  discard block
 block discarded – undo
434 433
      */
435 434
     private function installPagantisTables()
436 435
     {
437
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( 
436
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( 
438 437
                           id int NOT NULL AUTO_INCREMENT, 
439 438
                           log text NOT NULL, 
440 439
                           createdAt timestamp DEFAULT CURRENT_TIMESTAMP, 
441 440
                           UNIQUE KEY id (id))";
442 441
         tep_db_query($sql);
443 442
 
444
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " (
443
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." (
445 444
                             id int NOT NULL AUTO_INCREMENT, 
446 445
                             config varchar(60) NOT NULL, 
447 446
                             value varchar(200) NOT NULL, 
@@ -449,10 +448,10 @@  discard block
 block discarded – undo
449 448
         tep_db_query($sql);
450 449
 
451 450
         // check if table has records
452
-        $check_query = tep_db_query("select value from " . TABLE_PAGANTIS_CONFIG);
451
+        $check_query = tep_db_query("select value from ".TABLE_PAGANTIS_CONFIG);
453 452
         if (tep_db_num_rows($check_query) === 0) {
454 453
             foreach ((array)$this->defaultConfigs as $configKey => $configValue) {
455
-                $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . "
454
+                $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG."
456 455
                 (
457 456
                     config,
458 457
                     value
@@ -466,7 +465,7 @@  discard block
 block discarded – undo
466 465
             }
467 466
         }
468 467
 
469
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " (
468
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." (
470 469
                             id int NOT NULL AUTO_INCREMENT, 
471 470
                             os_order_id varchar(50), 
472 471
                             os_order_reference varchar(50) NOT NULL,
@@ -475,7 +474,7 @@  discard block
 block discarded – undo
475 474
                             UNIQUE KEY id(id))";
476 475
         tep_db_query($sql);
477 476
 
478
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " (
477
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." (
479 478
                             id varchar(50) NOT NULL,
480 479
                             `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
481 480
                             UNIQUE KEY id(id))";
@@ -487,30 +486,30 @@  discard block
 block discarded – undo
487 486
      */
488 487
     public function remove()
489 488
     {
490
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_LOG . "'");
489
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'");
491 490
         if (tep_db_num_rows($checkTable) > 0) {
492
-            tep_db_query("drop table " . TABLE_PAGANTIS_LOG);
491
+            tep_db_query("drop table ".TABLE_PAGANTIS_LOG);
493 492
         }
494 493
 
495
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'");
494
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'");
496 495
         if (tep_db_num_rows($checkTable) > 0) {
497
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG);
496
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG);
498 497
         }
499 498
 
500
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_ORDERS . "'");
499
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'");
501 500
         if (tep_db_num_rows($checkTable) > 0) {
502
-            tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS);
501
+            tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS);
503 502
         }
504 503
 
505
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONCURRENCY . "'");
504
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'");
506 505
         if (tep_db_num_rows($checkTable) > 0) {
507
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY);
506
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY);
508 507
         }
509 508
 
510
-        $query = "delete from " . TABLE_ORDERS_STATUS . " where orders_status_id='6'";
509
+        $query = "delete from ".TABLE_ORDERS_STATUS." where orders_status_id='6'";
511 510
         tep_db_query($query);
512 511
 
513
-        $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key like '%_PAGANTIS_%'";
512
+        $query = "delete from ".TABLE_CONFIGURATION." where configuration_key like '%_PAGANTIS_%'";
514 513
         tep_db_query($query);
515 514
 
516 515
         $this->uninstallSimulator();
@@ -563,14 +562,14 @@  discard block
 block discarded – undo
563 562
      */
564 563
     private function insertRow($orderId, $pagantisOrderId, $globalVars)
565 564
     {
566
-        $query = "select * from " . TABLE_PAGANTIS_ORDERS . " where os_order_reference='$orderId'";
565
+        $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'";
567 566
         $resultsSelect = tep_db_query($query);
568 567
         $countResults = tep_db_num_rows($resultsSelect);
569 568
         if ($countResults == 0) {
570
-            $query = "INSERT INTO " . TABLE_PAGANTIS_ORDERS . " 
569
+            $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS." 
571 570
                 (os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')";
572
-        } else {
573
-            $query = "UPDATE " . TABLE_PAGANTIS_ORDERS . " set pagantis_order_id='$pagantisOrderId' 
571
+        }else {
572
+            $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' 
574 573
                         where os_order_reference='$orderId'";
575 574
         }
576 575
         tep_db_query($query);
@@ -581,10 +580,10 @@  discard block
 block discarded – undo
581 580
      */
582 581
     private function getExtraConfig()
583 582
     {
584
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'");
583
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'");
585 584
         $response = array();
586 585
         if (tep_db_num_rows($checkTable) > 0) {
587
-            $query = "select * from " . TABLE_PAGANTIS_CONFIG;
586
+            $query = "select * from ".TABLE_PAGANTIS_CONFIG;
588 587
             $result = tep_db_query($query);
589 588
             $resultArray = tep_db_fetch_array($result);
590 589
             $response = array();
@@ -598,34 +597,34 @@  discard block
 block discarded – undo
598 597
 
599 598
     private function installSimulator()
600 599
     {
601
-        $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." 
600
+        $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." 
602 601
                                     where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'
603 602
                                     and configuration_value like '%ht_pagantis.php%';");
604 603
         if (tep_db_num_rows($checkSimulator) > 0) {
605 604
             return true;
606 605
         }
607 606
 
608
-        $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = concat(configuration_value, ';ht_pagantis.php')
607
+        $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = concat(configuration_value, ';ht_pagantis.php')
609 608
                         where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'";
610 609
         tep_db_query($query);
611 610
 
612
-        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
611
+        tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
613 612
     }
614 613
 
615 614
     private function uninstallSimulator()
616 615
     {
617
-        $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." 
616
+        $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." 
618 617
                                     where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'
619 618
                                     and configuration_value like '%ht_pagantis.php%';");
620 619
         if (tep_db_num_rows($checkSimulator) == 0) {
621 620
             return true;
622 621
         }
623 622
 
624
-        $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '')
623
+        $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '')
625 624
                         where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'";
626 625
         tep_db_query($query);
627 626
 
628
-        $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'";
627
+        $query = "delete from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'";
629 628
         tep_db_query($query);
630 629
     }
631 630
 }
632 631
\ No newline at end of file
Please login to merge, or discard this patch.
catalog/includes/modules/header_tags/ht_pagantis.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $this->description = MODULE_HEADER_TAGS_PAGANTIS_DESCRIPTION;
26 26
         $this->sort_order = 0;
27 27
 
28
-        if ( defined('MODULE_HEADER_TAGS_PAGANTIS_STATUS') ) {
28
+        if (defined('MODULE_HEADER_TAGS_PAGANTIS_STATUS')) {
29 29
             $this->enabled = (MODULE_HEADER_TAGS_PAGANTIS_STATUS == 'True');
30 30
         }
31 31
         $this->extraConfig = $this->getExtraConfig();
@@ -56,51 +56,51 @@  discard block
 block discarded – undo
56 56
      */
57 57
     private function getConfig($config = '')
58 58
     {
59
-            $query       = "select configuration_value from ".TABLE_CONFIGURATION . " where configuration_key = '" . $config . "'";
59
+            $query       = "select configuration_value from ".TABLE_CONFIGURATION." where configuration_key = '".$config."'";
60 60
             $result      = tep_db_query($query);
61 61
             $resultArray = tep_db_fetch_array($result);
62 62
             return $resultArray['configuration_value'];
63 63
     }
64 64
 
65 65
     function execute() {
66
-        echo "<script src='https://cdn.pagantis.com/js/pg-v2/sdk.js'></script>". PHP_EOL;
67
-        echo '<script>'. PHP_EOL;
68
-
69
-        echo '        function loadSimulator()'. PHP_EOL;
70
-        echo '        {'. PHP_EOL;
71
-        echo '           if (typeof pgSDK != \'undefined\') {'. PHP_EOL;
72
-        echo '               var positionSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR']. '\';'. PHP_EOL;
73
-        echo '               var priceSelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']. '\';'. PHP_EOL;
74
-        echo '               var quantitySelector = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']. '\';'. PHP_EOL;
75
-
76
-        echo '               if (positionSelector === \'default\') {'. PHP_EOL;
77
-        echo '                   positionSelector = \'.buttonSet\''. PHP_EOL;
78
-        echo '               }'. PHP_EOL;
79
-
80
-        echo '               if (priceSelector === \'default\') {'. PHP_EOL;
81
-        echo '                   priceSelector = \'#bodyContent>form>div>h1\''. PHP_EOL;
82
-        echo '               }'. PHP_EOL;
83
-
84
-        echo '               pgSDK.product_simulator = {};'. PHP_EOL;
85
-        echo '               pgSDK.product_simulator.id = \'product-simulator\';'. PHP_EOL;
86
-        echo '               pgSDK.product_simulator.publicKey = \'' . $this->pk . '\';'. PHP_EOL;
87
-        echo '               pgSDK.product_simulator.selector = positionSelector;'. PHP_EOL;
88
-        echo '               pgSDK.product_simulator.numInstalments = \'' . $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] . '\';'. PHP_EOL;
89
-        echo '               pgSDK.product_simulator.type = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'] . ';'. PHP_EOL;
90
-        echo '               pgSDK.product_simulator.skin = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] . ';'. PHP_EOL;
91
-        echo '               pgSDK.product_simulator.position = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'] . ';'. PHP_EOL;
92
-        echo '               pgSDK.product_simulator.itemAmountSelector = priceSelector;'. PHP_EOL;
93
-
94
-        echo '               pgSDK.simulator.init(pgSDK.product_simulator);'. PHP_EOL;
95
-        echo '               clearInterval(window.PSSimulatorId);'. PHP_EOL;
96
-        echo '               return true;'. PHP_EOL;
97
-        echo '           }'. PHP_EOL;
98
-        echo '           return false;'. PHP_EOL;
99
-        echo '       }'. PHP_EOL;
100
-        echo '       window.PSSimulatorId = setInterval(function () {'. PHP_EOL;
101
-        echo '          loadSimulator();'. PHP_EOL;
102
-        echo '       }, 2000);'. PHP_EOL;
103
-        echo '</script>'. PHP_EOL;
66
+        echo "<script src='https://cdn.pagantis.com/js/pg-v2/sdk.js'></script>".PHP_EOL;
67
+        echo '<script>'.PHP_EOL;
68
+
69
+        echo '        function loadSimulator()'.PHP_EOL;
70
+        echo '        {'.PHP_EOL;
71
+        echo '           if (typeof pgSDK != \'undefined\') {'.PHP_EOL;
72
+        echo '               var positionSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'].'\';'.PHP_EOL;
73
+        echo '               var priceSelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'].'\';'.PHP_EOL;
74
+        echo '               var quantitySelector = \''.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'].'\';'.PHP_EOL;
75
+
76
+        echo '               if (positionSelector === \'default\') {'.PHP_EOL;
77
+        echo '                   positionSelector = \'.buttonSet\''.PHP_EOL;
78
+        echo '               }'.PHP_EOL;
79
+
80
+        echo '               if (priceSelector === \'default\') {'.PHP_EOL;
81
+        echo '                   priceSelector = \'#bodyContent>form>div>h1\''.PHP_EOL;
82
+        echo '               }'.PHP_EOL;
83
+
84
+        echo '               pgSDK.product_simulator = {};'.PHP_EOL;
85
+        echo '               pgSDK.product_simulator.id = \'product-simulator\';'.PHP_EOL;
86
+        echo '               pgSDK.product_simulator.publicKey = \''.$this->pk.'\';'.PHP_EOL;
87
+        echo '               pgSDK.product_simulator.selector = positionSelector;'.PHP_EOL;
88
+        echo '               pgSDK.product_simulator.numInstalments = \''.$this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'].'\';'.PHP_EOL;
89
+        echo '               pgSDK.product_simulator.type = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'].';'.PHP_EOL;
90
+        echo '               pgSDK.product_simulator.skin = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'].';'.PHP_EOL;
91
+        echo '               pgSDK.product_simulator.position = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'].';'.PHP_EOL;
92
+        echo '               pgSDK.product_simulator.itemAmountSelector = priceSelector;'.PHP_EOL;
93
+
94
+        echo '               pgSDK.simulator.init(pgSDK.product_simulator);'.PHP_EOL;
95
+        echo '               clearInterval(window.PSSimulatorId);'.PHP_EOL;
96
+        echo '               return true;'.PHP_EOL;
97
+        echo '           }'.PHP_EOL;
98
+        echo '           return false;'.PHP_EOL;
99
+        echo '       }'.PHP_EOL;
100
+        echo '       window.PSSimulatorId = setInterval(function () {'.PHP_EOL;
101
+        echo '          loadSimulator();'.PHP_EOL;
102
+        echo '       }, 2000);'.PHP_EOL;
103
+        echo '</script>'.PHP_EOL;
104 104
     }
105 105
 
106 106
     function isEnabled() {
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
     }
113 113
 
114 114
     function install() {
115
-        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
115
+        tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Pagantis Module', 'MODULE_HEADER_TAGS_PAGANTIS_STATUS', 'True', '', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
116 116
 
117 117
     }
118 118
 
119 119
     function remove() {
120
-        tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
120
+        tep_db_query("delete from ".TABLE_CONFIGURATION." where configuration_key in ('".implode("', '", $this->keys())."')");
121 121
     }
122 122
 
123 123
     function keys() {
Please login to merge, or discard this patch.