Passed
Pull Request — master (#4)
by Raúl
02:04
created
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/header_tags/ht_pagantis.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         $this->title = MODULE_HEADER_TAGS_PAGANTIS_TITLE;
28 28
         $this->description = MODULE_HEADER_TAGS_PAGANTIS_DESCRIPTION;
29 29
 
30
-        if ( defined('MODULE_HEADER_TAGS_PAGANTIS_STATUS') ) {
30
+        if (defined('MODULE_HEADER_TAGS_PAGANTIS_STATUS')) {
31 31
             $this->sort_order = MODULE_HEADER_TAGS_PAGANTIS_SORT_ORDER;
32 32
             $this->enabled = (MODULE_HEADER_TAGS_PAGANTIS_STATUS == 'True');
33 33
         }
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
         echo '           if (typeof pgSDK != \'undefined\') {';
64 64
         echo '               var price = null;';
65 65
         echo '               var quantity = null;';
66
-        echo '               var positionSelector = ' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'];
67
-        echo '               var priceSelector = ' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'];
68
-        echo '               var quantitySelector = ' . $this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'];
66
+        echo '               var positionSelector = '.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'];
67
+        echo '               var priceSelector = '.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'];
68
+        echo '               var quantitySelector = '.$this->extraConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'];
69 69
 
70 70
         echo '               if (positionSelector === \'default\') {';
71 71
         echo '                   positionSelector = \'.pagantisSimulator\'';
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
         echo '               pgSDK.product_simulator.id = \'product-simulator\';';
87 87
         echo '               pgSDK.product_simulator.publicKey = MODULE_PAYMENT_PAGANTIS_PK;';
88 88
         echo '               pgSDK.product_simulator.selector = positionSelector;';
89
-        echo '               pgSDK.product_simulator.numInstalments = ' . $this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'] . ';';
90
-        echo '               pgSDK.product_simulator.type = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'] . ';';
91
-        echo '               pgSDK.product_simulator.skin = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'] . ';';
92
-        echo '               pgSDK.product_simulator.position = ' . $this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'] . ';';
89
+        echo '               pgSDK.product_simulator.numInstalments = '.$this->extraConfig['PAGANTIS_SIMULATOR_START_INSTALLMENTS'].';';
90
+        echo '               pgSDK.product_simulator.type = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_TYPE'].';';
91
+        echo '               pgSDK.product_simulator.skin = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_SKIN'].';';
92
+        echo '               pgSDK.product_simulator.position = '.$this->extraConfig['PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'].';';
93 93
 
94 94
         echo '               if (priceSelector !== \'default\') {';
95 95
         echo '                   pgSDK.product_simulator.itemAmountSelector = priceSelector;';
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
     }
129 129
 
130 130
     function install() {
131
-        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', 'Do you want to allow product titles to be added to the page title?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
132
-        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_PAGANTIS_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
131
+        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', 'Do you want to allow product titles to be added to the page title?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
132
+        tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_PAGANTIS_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
133 133
     }
134 134
 
135 135
     function remove() {
136
-        tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
136
+        tep_db_query("delete from ".TABLE_CONFIGURATION." where configuration_key in ('".implode("', '", $this->keys())."')");
137 137
     }
138 138
 
139 139
     function keys() {
Please login to merge, or discard this patch.
catalog/includes/modules/payment/pagantis.php 1 patch
Spacing   +25 added lines, -25 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
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
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
     /***************
@@ -286,16 +286,16 @@  discard block
 block discarded – undo
286 286
             if ($pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
287 287
                 $url = $pagantisOrder->getActionUrls()->getForm();
288 288
                 $this->insertRow($this->os_order_reference, $pagantisOrder->getId(), serialize($global_vars));
289
-            } else {
289
+            }else {
290 290
                 throw new OrderNotFoundException();
291 291
             }
292 292
 
293 293
             if ($url == "") {
294 294
                 throw new UnknownException(_("No ha sido posible obtener una respuesta de Pagantis"));
295
-            } else { //if ($this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE'] == '0') {
295
+            }else { //if ($this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE'] == '0') {
296 296
                 $output = "\n";
297
-                $output.= tep_draw_hidden_field("formUrl", $url) . "\n";
298
-                $output.= tep_draw_hidden_field("cancelUrl", $cancelUrl) . "\n";
297
+                $output .= tep_draw_hidden_field("formUrl", $url)."\n";
298
+                $output .= tep_draw_hidden_field("cancelUrl", $cancelUrl)."\n";
299 299
                 return $output;
300 300
 
301 301
             } //TODO IFRAME
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     public function check()
336 336
     {
337 337
         if (!isset($this->_check)) {
338
-            $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'");
338
+            $check_query = tep_db_query("select configuration_value from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'");
339 339
             $this->_check = tep_db_num_rows($check_query);
340 340
         }
341 341
         $this->installPagantisTables();
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
             tep_redirect(tep_href_link(FILENAME_MODULES, 'set=payment&module=pagantis', 'NONSSL'));
354 354
             return 'failed';
355 355
         }
356
-        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_PAYMENT_PAGANTIS_STATUS', 'True', '', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
357
-        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Public Key', 'MODULE_PAYMENT_PAGANTIS_PK', '', 'MANDATORY. You can get in your pagantis profile', '6', '0', now())");
358
-        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Secret Key', 'MODULE_PAYMENT_PAGANTIS_SK', '', 'MANDATORY. You can get in your pagantis profile', '6', '0', now())");
356
+        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_PAYMENT_PAGANTIS_STATUS', 'True', '', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
357
+        tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Public Key', 'MODULE_PAYMENT_PAGANTIS_PK', '', 'MANDATORY. You can get in your pagantis profile', '6', '0', now())");
358
+        tep_db_query("insert into ".TABLE_CONFIGURATION." (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Secret Key', 'MODULE_PAYMENT_PAGANTIS_SK', '', 'MANDATORY. You can get in your pagantis profile', '6', '0', now())");
359 359
 
360 360
         $this->installPagantisTables();
361 361
     }
@@ -365,14 +365,14 @@  discard block
 block discarded – undo
365 365
      */
366 366
     private function installPagantisTables()
367 367
     {
368
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( 
368
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( 
369 369
                           id int NOT NULL AUTO_INCREMENT, 
370 370
                           log text NOT NULL, 
371 371
                           createdAt timestamp DEFAULT CURRENT_TIMESTAMP, 
372 372
                           UNIQUE KEY id (id))";
373 373
         tep_db_query($sql);
374 374
 
375
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " (
375
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." (
376 376
                             id int NOT NULL AUTO_INCREMENT, 
377 377
                             config varchar(60) NOT NULL, 
378 378
                             value varchar(200) NOT NULL, 
@@ -380,15 +380,15 @@  discard block
 block discarded – undo
380 380
         tep_db_query($sql);
381 381
 
382 382
         // check if table has records
383
-        $check_query = tep_db_query("select value from " . TABLE_PAGANTIS_CONFIG);
384
-        if(tep_db_num_rows($check_query) === 0) {
383
+        $check_query = tep_db_query("select value from ".TABLE_PAGANTIS_CONFIG);
384
+        if (tep_db_num_rows($check_query) === 0) {
385 385
             foreach ((array)$this->defaultConfigs as $configKey => $configValue) {
386
-                $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " (config, value) values ('$configKey', '$configValue')";
386
+                $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG." (config, value) values ('$configKey', '$configValue')";
387 387
                 tep_db_query($query);
388 388
             }
389 389
         }
390 390
 
391
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " (
391
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." (
392 392
                             id int NOT NULL AUTO_INCREMENT, 
393 393
                             os_order_id varchar(50), 
394 394
                             os_order_reference varchar(50) NOT NULL,
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                             UNIQUE KEY id(id))";
398 398
         tep_db_query($sql);
399 399
 
400
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " (
400
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." (
401 401
                             id varchar(50) NOT NULL,
402 402
                             `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
403 403
                             UNIQUE KEY id(id))";
@@ -411,22 +411,22 @@  discard block
 block discarded – undo
411 411
     {
412 412
         $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'");
413 413
         if (tep_db_num_rows($checkTable) > 0) {
414
-            tep_db_query("drop table " . TABLE_PAGANTIS_LOG);
414
+            tep_db_query("drop table ".TABLE_PAGANTIS_LOG);
415 415
         }
416 416
 
417 417
         $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'");
418 418
         if (tep_db_num_rows($checkTable) > 0) {
419
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG);
419
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG);
420 420
         }
421 421
 
422 422
         $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'");
423 423
         if (tep_db_num_rows($checkTable) > 0) {
424
-            tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS);
424
+            tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS);
425 425
         }
426 426
 
427 427
         $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'");
428 428
         if (tep_db_num_rows($checkTable) > 0) {
429
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY);
429
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY);
430 430
         }
431 431
 
432 432
         $query = "delete from ".TABLE_ORDERS_STATUS." where orders_status_id='6'";
@@ -479,13 +479,13 @@  discard block
 block discarded – undo
479 479
      */
480 480
     private function insertRow($orderId, $pagantisOrderId, $globalVars)
481 481
     {
482
-        $query = "select * from ". TABLE_PAGANTIS_ORDERS ." where os_order_reference='$orderId'";
482
+        $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'";
483 483
         $resultsSelect = tep_db_query($query);
484 484
         $countResults = tep_db_num_rows($resultsSelect);
485 485
         if ($countResults == 0) {
486
-            $query = "INSERT INTO ". TABLE_PAGANTIS_ORDERS ."(os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')";
487
-        } else {
488
-            $query = "UPDATE " . TABLE_PAGANTIS_ORDERS . " set pagantis_order_id='$pagantisOrderId' where os_order_reference='$orderId'";
486
+            $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS."(os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')";
487
+        }else {
488
+            $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' where os_order_reference='$orderId'";
489 489
         }
490 490
         tep_db_query($query);
491 491
     }
Please login to merge, or discard this patch.