@@ -75,7 +75,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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')"; |
@@ -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 | /** |
@@ -64,12 +64,12 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -139,7 +139,7 @@ discard block |
||
| 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 |
||
| 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, |
@@ -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 | } |
@@ -181,9 +181,9 @@ discard block |
||
| 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 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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() { |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Constructor |
|
| 53 | - */ |
|
| 52 | + * Constructor |
|
| 53 | + */ |
|
| 54 | 54 | public function __construct() |
| 55 | 55 | { |
| 56 | 56 | $this->version = '8.0.0'; |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | **************/ |
| 88 | 88 | /** |
| 89 | - * Here you can implement using payment zones (refer to standard PayPal module as reference) |
|
| 90 | - */ |
|
| 89 | + * Here you can implement using payment zones (refer to standard PayPal module as reference) |
|
| 90 | + */ |
|
| 91 | 91 | public function update_status() |
| 92 | 92 | { |
| 93 | 93 | |
@@ -318,10 +318,10 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | - * Post-processing activities |
|
| 322 | - * |
|
| 323 | - * @return boolean |
|
| 324 | - */ |
|
| 321 | + * Post-processing activities |
|
| 322 | + * |
|
| 323 | + * @return boolean |
|
| 324 | + */ |
|
| 325 | 325 | public function after_process() |
| 326 | 326 | { |
| 327 | 327 | $this->pgNotify->confirmInformation(); |
@@ -434,16 +434,16 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
| 437 | - * Internal list of configuration keys used for configuration of the module |
|
| 438 | - * |
|
| 439 | - * @return array |
|
| 440 | - */ |
|
| 437 | + * Internal list of configuration keys used for configuration of the module |
|
| 438 | + * |
|
| 439 | + * @return array |
|
| 440 | + */ |
|
| 441 | 441 | public function keys() |
| 442 | 442 | { |
| 443 | 443 | return array('MODULE_PAYMENT_PAGANTIS_STATUS', |
| 444 | - 'MODULE_PAYMENT_PAGANTIS_PK', |
|
| 445 | - 'MODULE_PAYMENT_PAGANTIS_SK' |
|
| 446 | - ); |
|
| 444 | + 'MODULE_PAYMENT_PAGANTIS_PK', |
|
| 445 | + 'MODULE_PAYMENT_PAGANTIS_SK' |
|
| 446 | + ); |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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,14 +365,14 @@ 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, |
@@ -380,15 +380,15 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |