Passed
Pull Request — master (#4)
by Raúl
04:22
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
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
         if (strpos($_SERVER[REQUEST_URI], "checkout_payment.php") <= 0) {
61 61
             $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_ADMIN_TITLE; // Payment module title in Admin
62
-        } else {
62
+        }else {
63 63
             $this->title = MODULE_PAYMENT_PAGANTIS_TEXT_CATALOG_TITLE; // Payment module title in Catalog
64 64
         }
65 65
 
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
                 "%s://%s%s%s",
73 73
                 isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
74 74
                 $_SERVER['SERVER_NAME'],
75
-                isset($_SERVER['SERVER_PORT']) ? ":" . $_SERVER['SERVER_PORT'] : '',
75
+                isset($_SERVER['SERVER_PORT']) ? ":".$_SERVER['SERVER_PORT'] : '',
76 76
                 $_SERVER['REQUEST_URI']
77 77
             )
78 78
         );
79 79
 
80
-        $this->form_action_url = $this->base_url . '/ext/modules/payment/pagantis/bypass.php';
80
+        $this->form_action_url = $this->base_url.'/ext/modules/payment/pagantis/bypass.php';
81 81
     }
82 82
 
83 83
     /***************
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
                 throw new UnknownException("Order not found");
177 177
             }
178 178
 
179
-            $id_hash = time() . serialize($order->products) . '' . serialize($order->customer) . '' . serialize($order->delivery);
179
+            $id_hash = time().serialize($order->products).''.serialize($order->customer).''.serialize($order->delivery);
180 180
             $this->os_order_reference = md5($id_hash);
181 181
             $_SESSION['order_id'] = $this->os_order_reference;
182 182
 
183 183
             $userAddress = new Address();
184 184
             $userAddress
185 185
                 ->setZipCode($order->billing['postcode'])
186
-                ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname'])
186
+                ->setFullName($order->billing['firstname'].' '.$order->billing['lastname'])
187 187
                 ->setCountryCode('ES')
188 188
                 ->setCity($order->billing['city'])
189 189
                 ->setAddress($order->billing['street_address'])
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $orderShippingAddress = new Address();
196 196
             $orderShippingAddress
197 197
                 ->setZipCode($order->delivery['postcode'])
198
-                ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname'])
198
+                ->setFullName($order->billing['firstname'].' '.$order->billing['lastname'])
199 199
                 ->setCountryCode('ES')
200 200
                 ->setCity($order->delivery['city'])
201 201
                 ->setAddress($order->delivery['street_address'])
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             $orderUser = new \Pagantis\OrdersApiClient\Model\Order\User();
206 206
             $orderUser
207 207
                 ->setAddress($userAddress)
208
-                ->setFullName($order->billing['firstname'] . ' ' . $order->billing['lastname'])
208
+                ->setFullName($order->billing['firstname'].' '.$order->billing['lastname'])
209 209
                 ->setBillingAddress($orderBillingAddress)
210 210
                 ->setEmail($order->customer['email_address'])
211 211
                 ->setFixPhone($order->customer['telephone'])
@@ -240,9 +240,8 @@  discard block
 block discarded – undo
240 240
                 ->setPromotedAmount(0)
241 241
                 ->setTotalAmount(intval($order->info['total'] * 100));
242 242
 
243
-            $callback_url = $this->base_url . '/ext/modules/payment/pagantis/notify.php';
244
-            $checkoutProcessUrl = htmlspecialchars_decode
245
-            (
243
+            $callback_url = $this->base_url.'/ext/modules/payment/pagantis/notify.php';
244
+            $checkoutProcessUrl = htmlspecialchars_decode(
246 245
                 tep_href_link(
247 246
                     FILENAME_CHECKOUT_PROCESS,
248 247
                     "order_id=$this->os_order_reference&from=order",
@@ -293,16 +292,16 @@  discard block
 block discarded – undo
293 292
             if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
294 293
                 $url = $pagantisOrder->getActionUrls()->getForm();
295 294
                 $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars));
296
-            } else {
295
+            }else {
297 296
                 throw new OrderNotFoundException();
298 297
             }
299 298
 
300 299
             if ($url == "") {
301 300
                 throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis"));
302
-            } else { //if ($this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE'] == '0') {
301
+            }else { //if ($this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE'] == '0') {
303 302
                 $output = "\n";
304
-                $output .= tep_draw_hidden_field("formUrl", $url) . "\n";
305
-                $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n";
303
+                $output .= tep_draw_hidden_field("formUrl", $url)."\n";
304
+                $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n";
306 305
                 return $output;
307 306
 
308 307
             } //TODO IFRAME
@@ -342,7 +341,7 @@  discard block
 block discarded – undo
342 341
     public function check()
343 342
     {
344 343
         if (!isset($this->_check)) {
345
-            $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " 
344
+            $check_query = tep_db_query("select configuration_value from ".TABLE_CONFIGURATION." 
346 345
                                          where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'");
347 346
             $this->_check = tep_db_num_rows($check_query);
348 347
         }
@@ -361,7 +360,7 @@  discard block
 block discarded – undo
361 360
             tep_redirect(tep_href_link(FILENAME_MODULES, 'set=payment&module=pagantis', 'NONSSL'));
362 361
             return 'failed';
363 362
         }
364
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
363
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
365 364
         (
366 365
             configuration_title,
367 366
             configuration_key,
@@ -384,7 +383,7 @@  discard block
 block discarded – undo
384 383
             ',
385 384
             now()
386 385
         )");
387
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
386
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
388 387
         (
389 388
             configuration_title,
390 389
             configuration_key,
@@ -404,7 +403,7 @@  discard block
 block discarded – undo
404 403
             '0',
405 404
             now()
406 405
         )");
407
-        tep_db_query("insert into " . TABLE_CONFIGURATION . "
406
+        tep_db_query("insert into ".TABLE_CONFIGURATION."
408 407
         (
409 408
             configuration_title,
410 409
             configuration_key,
@@ -435,14 +434,14 @@  discard block
 block discarded – undo
435 434
      */
436 435
     private function installPagantisTables()
437 436
     {
438
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( 
437
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( 
439 438
                           id int NOT NULL AUTO_INCREMENT, 
440 439
                           log text NOT NULL, 
441 440
                           createdAt timestamp DEFAULT CURRENT_TIMESTAMP, 
442 441
                           UNIQUE KEY id (id))";
443 442
         tep_db_query($sql);
444 443
 
445
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " (
444
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." (
446 445
                             id int NOT NULL AUTO_INCREMENT, 
447 446
                             config varchar(60) NOT NULL, 
448 447
                             value varchar(200) NOT NULL, 
@@ -450,10 +449,10 @@  discard block
 block discarded – undo
450 449
         tep_db_query($sql);
451 450
 
452 451
         // check if table has records
453
-        $check_query = tep_db_query("select value from " . TABLE_PAGANTIS_CONFIG);
452
+        $check_query = tep_db_query("select value from ".TABLE_PAGANTIS_CONFIG);
454 453
         if (tep_db_num_rows($check_query) === 0) {
455 454
             foreach ((array)$this->defaultConfigs as $configKey => $configValue) {
456
-                $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . "
455
+                $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG."
457 456
                 (
458 457
                     config,
459 458
                     value
@@ -467,7 +466,7 @@  discard block
 block discarded – undo
467 466
             }
468 467
         }
469 468
 
470
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " (
469
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." (
471 470
                             id int NOT NULL AUTO_INCREMENT, 
472 471
                             os_order_id varchar(50), 
473 472
                             os_order_reference varchar(50) NOT NULL,
@@ -476,7 +475,7 @@  discard block
 block discarded – undo
476 475
                             UNIQUE KEY id(id))";
477 476
         tep_db_query($sql);
478 477
 
479
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " (
478
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." (
480 479
                             id varchar(50) NOT NULL,
481 480
                             `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
482 481
                             UNIQUE KEY id(id))";
@@ -488,30 +487,30 @@  discard block
 block discarded – undo
488 487
      */
489 488
     public function remove()
490 489
     {
491
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_LOG . "'");
490
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'");
492 491
         if (tep_db_num_rows($checkTable) > 0) {
493
-            tep_db_query("drop table " . TABLE_PAGANTIS_LOG);
492
+            tep_db_query("drop table ".TABLE_PAGANTIS_LOG);
494 493
         }
495 494
 
496
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'");
495
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'");
497 496
         if (tep_db_num_rows($checkTable) > 0) {
498
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG);
497
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG);
499 498
         }
500 499
 
501
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_ORDERS . "'");
500
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'");
502 501
         if (tep_db_num_rows($checkTable) > 0) {
503
-            tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS);
502
+            tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS);
504 503
         }
505 504
 
506
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONCURRENCY . "'");
505
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'");
507 506
         if (tep_db_num_rows($checkTable) > 0) {
508
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY);
507
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY);
509 508
         }
510 509
 
511
-        $query = "delete from " . TABLE_ORDERS_STATUS . " where orders_status_id='6'";
510
+        $query = "delete from ".TABLE_ORDERS_STATUS." where orders_status_id='6'";
512 511
         tep_db_query($query);
513 512
 
514
-        $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key like '%_PAGANTIS_%'";
513
+        $query = "delete from ".TABLE_CONFIGURATION." where configuration_key like '%_PAGANTIS_%'";
515 514
         tep_db_query($query);
516 515
 
517 516
         $this->uninstallSimulator();
@@ -564,14 +563,14 @@  discard block
 block discarded – undo
564 563
      */
565 564
     private function insertRow($orderId, $pagantisOrderId, $globalVars)
566 565
     {
567
-        $query = "select * from " . TABLE_PAGANTIS_ORDERS . " where os_order_reference='$orderId'";
566
+        $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'";
568 567
         $resultsSelect = tep_db_query($query);
569 568
         $countResults = tep_db_num_rows($resultsSelect);
570 569
         if ($countResults == 0) {
571
-            $query = "INSERT INTO " . TABLE_PAGANTIS_ORDERS . " 
570
+            $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS." 
572 571
                 (os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')";
573
-        } else {
574
-            $query = "UPDATE " . TABLE_PAGANTIS_ORDERS . " set pagantis_order_id='$pagantisOrderId' 
572
+        }else {
573
+            $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' 
575 574
                         where os_order_reference='$orderId'";
576 575
         }
577 576
         tep_db_query($query);
@@ -582,10 +581,10 @@  discard block
 block discarded – undo
582 581
      */
583 582
     private function getExtraConfig()
584 583
     {
585
-        $checkTable = tep_db_query("SHOW TABLES LIKE '" . TABLE_PAGANTIS_CONFIG . "'");
584
+        $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'");
586 585
         $response = array();
587 586
         if (tep_db_num_rows($checkTable) > 0) {
588
-            $query = "select * from " . TABLE_PAGANTIS_CONFIG;
587
+            $query = "select * from ".TABLE_PAGANTIS_CONFIG;
589 588
             $result = tep_db_query($query);
590 589
             $resultArray = tep_db_fetch_array($result);
591 590
             $response = array();
@@ -599,34 +598,34 @@  discard block
 block discarded – undo
599 598
 
600 599
     private function installSimulator()
601 600
     {
602
-        $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." 
601
+        $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." 
603 602
                                     where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'
604 603
                                     and configuration_value like '%ht_pagantis.php%';");
605 604
         if (tep_db_num_rows($checkSimulator) > 0) {
606 605
             return true;
607 606
         }
608 607
 
609
-        $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = concat(configuration_value, ';ht_pagantis.php')
608
+        $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = concat(configuration_value, ';ht_pagantis.php')
610 609
                         where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'";
611 610
         tep_db_query($query);
612 611
 
613
-        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())");
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())");
614 613
     }
615 614
 
616 615
     private function uninstallSimulator()
617 616
     {
618
-        $checkSimulator = tep_db_query("select configuration_key, configuration_value from " .TABLE_CONFIGURATION ." 
617
+        $checkSimulator = tep_db_query("select configuration_key, configuration_value from ".TABLE_CONFIGURATION." 
619 618
                                     where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'
620 619
                                     and configuration_value like '%ht_pagantis.php%';");
621 620
         if (tep_db_num_rows($checkSimulator) == 0) {
622 621
             return true;
623 622
         }
624 623
 
625
-        $query = "UPDATE " . TABLE_CONFIGURATION . " set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '')
624
+        $query = "UPDATE ".TABLE_CONFIGURATION." set configuration_value = REPLACE(configuration_value, ';ht_pagantis.php', '')
626 625
                         where configuration_key like 'MODULE_HEADER_TAGS_INSTALLED'";
627 626
         tep_db_query($query);
628 627
 
629
-        $query = "delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'";
628
+        $query = "delete from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_HEADER_TAGS_PAGANTIS_STATUS'";
630 629
         tep_db_query($query);
631 630
     }
632 631
 }
633 632
\ 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.