@@ -58,7 +58,7 @@ discard block |
||
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 | |
@@ -76,7 +76,7 @@ discard block |
||
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 | /*************** |
@@ -286,16 +286,16 @@ discard block |
||
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 |
||
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 |
||
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,25 +365,25 @@ discard block |
||
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, |
379 | 379 | UNIQUE KEY id(id))"; |
380 | 380 | tep_db_query($sql); |
381 | 381 | foreach ((array)$this->defaultConfigs as $configKey => $configValue) { |
382 | - $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " (config, value) values ('$configKey', '$configValue')"; |
|
382 | + $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG." (config, value) values ('$configKey', '$configValue')"; |
|
383 | 383 | tep_db_query($query); |
384 | 384 | } |
385 | 385 | |
386 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " ( |
|
386 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." ( |
|
387 | 387 | id int NOT NULL AUTO_INCREMENT, |
388 | 388 | os_order_id varchar(50), |
389 | 389 | os_order_reference varchar(50) NOT NULL, |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | UNIQUE KEY id(id))"; |
393 | 393 | tep_db_query($sql); |
394 | 394 | |
395 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " ( |
|
395 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." ( |
|
396 | 396 | id varchar(50) NOT NULL, |
397 | 397 | `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
398 | 398 | UNIQUE KEY id(id))"; |
@@ -406,22 +406,22 @@ discard block |
||
406 | 406 | { |
407 | 407 | $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'"); |
408 | 408 | if (tep_db_num_rows($checkTable) > 0) { |
409 | - tep_db_query("drop table " . TABLE_PAGANTIS_LOG); |
|
409 | + tep_db_query("drop table ".TABLE_PAGANTIS_LOG); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'"); |
413 | 413 | if (tep_db_num_rows($checkTable) > 0) { |
414 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG); |
|
414 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'"); |
418 | 418 | if (tep_db_num_rows($checkTable) > 0) { |
419 | - tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS); |
|
419 | + tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'"); |
423 | 423 | if (tep_db_num_rows($checkTable) > 0) { |
424 | - tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY); |
|
424 | + tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | $query = "delete from ".TABLE_ORDERS_STATUS." where orders_status_id='6'"; |
@@ -474,13 +474,13 @@ discard block |
||
474 | 474 | */ |
475 | 475 | private function insertRow($orderId, $pagantisOrderId, $globalVars) |
476 | 476 | { |
477 | - $query = "select * from ". TABLE_PAGANTIS_ORDERS ." where os_order_reference='$orderId'"; |
|
477 | + $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'"; |
|
478 | 478 | $resultsSelect = tep_db_query($query); |
479 | 479 | $countResults = tep_db_num_rows($resultsSelect); |
480 | 480 | if ($countResults == 0) { |
481 | - $query = "INSERT INTO ". TABLE_PAGANTIS_ORDERS ."(os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')"; |
|
482 | - } else { |
|
483 | - $query = "UPDATE " . TABLE_PAGANTIS_ORDERS . " set pagantis_order_id='$pagantisOrderId' where os_order_reference='$orderId'"; |
|
481 | + $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS."(os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')"; |
|
482 | + }else { |
|
483 | + $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' where os_order_reference='$orderId'"; |
|
484 | 484 | } |
485 | 485 | tep_db_query($query); |
486 | 486 | } |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | // $faker->numberBetween(1, 12). '/1975' |
80 | 80 | // ; |
81 | 81 | $this->configuration['firstname'] = $faker->firstName; |
82 | - $this->configuration['lastname'] = $faker->lastName . ' ' . $faker->lastName; |
|
82 | + $this->configuration['lastname'] = $faker->lastName.' '.$faker->lastName; |
|
83 | 83 | $this->configuration['company'] = $faker->company; |
84 | 84 | $this->configuration['zip'] = '28'.$faker->randomNumber(3, true); |
85 | 85 | $this->configuration['street'] = $faker->streetAddress; |
86 | - $this->configuration['phone'] = '6' . $faker->randomNumber(8); |
|
87 | - $this->configuration['email'] = date('ymd') . '@pagantis.com'; |
|
86 | + $this->configuration['phone'] = '6'.$faker->randomNumber(8); |
|
87 | + $this->configuration['email'] = date('ymd').'@pagantis.com'; |
|
88 | 88 | parent::__construct($name, $data, $dataName); |
89 | 89 | } |
90 | 90 | /** |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function getDNI() |
94 | 94 | { |
95 | - $dni = '0000' . rand(pow(10, 4-1), pow(10, 4)-1); |
|
96 | - $value = (int) ($dni / 23); |
|
95 | + $dni = '0000'.rand(pow(10, 4 - 1), pow(10, 4) - 1); |
|
96 | + $value = (int)($dni / 23); |
|
97 | 97 | $value *= 23; |
98 | - $value= $dni - $value; |
|
99 | - $letter= "TRWAGMYFPDXBNJZSQVHLCKEO"; |
|
100 | - $dniLetter= substr($letter, $value, 1); |
|
98 | + $value = $dni - $value; |
|
99 | + $letter = "TRWAGMYFPDXBNJZSQVHLCKEO"; |
|
100 | + $dniLetter = substr($letter, $value, 1); |
|
101 | 101 | return $dni.$dniLetter; |
102 | 102 | } |
103 | 103 |
@@ -96,7 +96,7 @@ discard block |
||
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 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | ); |
122 | 122 | |
123 | 123 | $this->assertTrue( |
124 | - (bool) WebDriverExpectedCondition::visibilityOfElementLocated($reviewStepSearch) |
|
124 | + (bool)WebDriverExpectedCondition::visibilityOfElementLocated($reviewStepSearch) |
|
125 | 125 | ); |
126 | 126 | } |
127 | 127 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | WebDriverExpectedCondition::visibilityOfElementLocated($checkoutStepPaymentMethodSearch) |
141 | 141 | ); |
142 | 142 | $this->assertTrue( |
143 | - (bool) WebDriverExpectedCondition::visibilityOfElementLocated($checkoutStepPaymentMethodSearch) |
|
143 | + (bool)WebDriverExpectedCondition::visibilityOfElementLocated($checkoutStepPaymentMethodSearch) |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | $paymentFormElement = WebDriverBy::className('FieldsPreview-desc'); |
191 | 191 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($paymentFormElement); |
192 | 192 | $this->webDriver->wait()->until($condition); |
193 | - $this->assertTrue((bool) $condition); |
|
193 | + $this->assertTrue((bool)$condition); |
|
194 | 194 | $this->assertSame( |
195 | - $this->configuration['firstname'] . ' ' . $this->configuration['lastname'], |
|
195 | + $this->configuration['firstname'].' '.$this->configuration['lastname'], |
|
196 | 196 | $this->findByClass('FieldsPreview-desc')->getText() |
197 | 197 | ); |
198 | 198 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $checkoutStepShippingMethodSearch = WebDriverBy::id('checkout-shipping-method-load'); |
76 | 76 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($checkoutStepShippingMethodSearch); |
77 | 77 | $this->webDriver->wait()->until($condition); |
78 | - $this->assertTrue((bool) $condition); |
|
78 | + $this->assertTrue((bool)$condition); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $billingAddressSelector = WebDriverBy::id('billing-address-select'); |
91 | 91 | $condition = WebDriverExpectedCondition::visibilityOfElementLocated($billingAddressSelector); |
92 | 92 | $this->webDriver->wait()->until($condition); |
93 | - $this->assertTrue((bool) $condition); |
|
93 | + $this->assertTrue((bool)$condition); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function checkPagantisOrderId() |
154 | 154 | { |
155 | - $orderId=0; |
|
155 | + $orderId = 0; |
|
156 | 156 | $notifyUrl = self::OSCURL.self::NOTIFICATION_FOLDER.'?order='.$orderId; |
157 | 157 | $this->assertNotEmpty($notifyUrl, $notifyUrl); |
158 | 158 | $response = Request::post($notifyUrl)->expects('json')->send(); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->assertEquals( |
163 | 163 | $response->body->merchant_order_id, |
164 | 164 | $orderId, |
165 | - $response->body->merchant_order_id.'!='. $orderId |
|
165 | + $response->body->merchant_order_id.'!='.$orderId |
|
166 | 166 | ); |
167 | 167 | $this->assertContains( |
168 | 168 | NoIdentificationException::ERROR_MESSAGE, |
@@ -39,7 +39,7 @@ discard block |
||
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 |
||
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 | /** |