@@ -31,25 +31,25 @@ discard block |
||
| 31 | 31 | public $pgNotify; |
| 32 | 32 | |
| 33 | 33 | public $defaultConfigs = array('PAGANTIS_TITLE'=>'Instant Financing', |
| 34 | - 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
| 35 | - 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
| 36 | - 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 37 | - 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 38 | - 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 39 | - 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 40 | - 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
| 41 | - 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 42 | - 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 43 | - 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
| 44 | - 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
| 45 | - 'PAGANTIS_URL_OK'=>'', |
|
| 46 | - 'PAGANTIS_URL_KO'=>'', |
|
| 47 | - 'PAGANTIS_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente online y sin papeleos,¡y la respuesta es inmediata!' |
|
| 34 | + 'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE', |
|
| 35 | + 'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE', |
|
| 36 | + 'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons', |
|
| 37 | + 'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3, |
|
| 38 | + 'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12, |
|
| 39 | + 'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default', |
|
| 40 | + 'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER', |
|
| 41 | + 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default', |
|
| 42 | + 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default', |
|
| 43 | + 'PAGANTIS_FORM_DISPLAY_TYPE'=>0, |
|
| 44 | + 'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1, |
|
| 45 | + 'PAGANTIS_URL_OK'=>'', |
|
| 46 | + 'PAGANTIS_URL_KO'=>'', |
|
| 47 | + 'PAGANTIS_TITLE_EXTRA' => 'Paga hasta en 12 cómodas cuotas con Paga+Tarde. Solicitud totalmente online y sin papeleos,¡y la respuesta es inmediata!' |
|
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * Constructor |
|
| 52 | - */ |
|
| 51 | + * Constructor |
|
| 52 | + */ |
|
| 53 | 53 | public function __construct() |
| 54 | 54 | { |
| 55 | 55 | $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 | |
@@ -323,10 +323,10 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
| 326 | - * Post-processing activities |
|
| 327 | - * |
|
| 328 | - * @return boolean |
|
| 329 | - */ |
|
| 326 | + * Post-processing activities |
|
| 327 | + * |
|
| 328 | + * @return boolean |
|
| 329 | + */ |
|
| 330 | 330 | public function after_process() |
| 331 | 331 | { |
| 332 | 332 | $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 | /** |
@@ -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->order_id, $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 | } /*else { |
| 301 | 301 | $template_fields = array( |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | public function check() |
| 341 | 341 | { |
| 342 | 342 | if (!isset($this->_check)) { |
| 343 | - $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'"); |
|
| 343 | + $check_query = tep_db_query("select configuration_value from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'"); |
|
| 344 | 344 | $this->_check = tep_db_num_rows($check_query); |
| 345 | 345 | } |
| 346 | 346 | $this->installPagantisTables(); |
@@ -358,9 +358,9 @@ discard block |
||
| 358 | 358 | tep_redirect(tep_href_link(FILENAME_MODULES, 'set=payment&module=pagantis', 'NONSSL')); |
| 359 | 359 | return 'failed'; |
| 360 | 360 | } |
| 361 | - 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())"); |
|
| 362 | - 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())"); |
|
| 363 | - 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())"); |
|
| 361 | + 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())"); |
|
| 362 | + 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())"); |
|
| 363 | + 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())"); |
|
| 364 | 364 | |
| 365 | 365 | $this->installPagantisTables(); |
| 366 | 366 | } |
@@ -370,25 +370,25 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | private function installPagantisTables() |
| 372 | 372 | { |
| 373 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( |
|
| 373 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( |
|
| 374 | 374 | id int NOT NULL AUTO_INCREMENT, |
| 375 | 375 | log text NOT NULL, |
| 376 | 376 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, |
| 377 | 377 | UNIQUE KEY id (id))"; |
| 378 | 378 | tep_db_query($sql); |
| 379 | 379 | |
| 380 | - $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " ( |
|
| 380 | + $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." ( |
|
| 381 | 381 | id int NOT NULL AUTO_INCREMENT, |
| 382 | 382 | config varchar(60) NOT NULL, |
| 383 | 383 | value varchar(200) NOT NULL, |
| 384 | 384 | UNIQUE KEY id(id))"; |
| 385 | 385 | tep_db_query($sql); |
| 386 | 386 | foreach ((array)$this->defaultConfigs as $configKey => $configValue) { |
| 387 | - $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " (config, value) values ('$configKey', '$configValue')"; |
|
| 387 | + $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG." (config, value) values ('$configKey', '$configValue')"; |
|
| 388 | 388 | tep_db_query($query); |
| 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 int 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 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | if ($this->origin == 'notify') { |
| 76 | 76 | $jsonResponse->printResponse(); |
| 77 | - } else { |
|
| 77 | + }else { |
|
| 78 | 78 | header("Location: $shippingUrl"); |
| 79 | 79 | exit; |
| 80 | 80 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
| 103 | 103 | $jsonResponse->printResponse(); |
| 104 | - } else { |
|
| 104 | + }else { |
|
| 105 | 105 | return $jsonResponse; |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -173,12 +173,12 @@ discard block |
||
| 173 | 173 | try { |
| 174 | 174 | $this->checkPagantisStatus(array('AUTHORIZED')); |
| 175 | 175 | } catch (\Exception $e) { |
| 176 | - if ($this->findOscommerceOrderId()!=='') { |
|
| 176 | + if ($this->findOscommerceOrderId() !== '') { |
|
| 177 | 177 | return; |
| 178 | - } else { |
|
| 178 | + }else { |
|
| 179 | 179 | if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
| 180 | 180 | $status = $this->pagantisOrder->getStatus(); |
| 181 | - } else { |
|
| 181 | + }else { |
|
| 182 | 182 | $status = '-'; |
| 183 | 183 | } |
| 184 | 184 | throw new WrongStatusException($status); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | { |
| 194 | 194 | global $order; |
| 195 | 195 | |
| 196 | - if ($order->info['order_status']!=='1') { |
|
| 196 | + if ($order->info['order_status'] !== '1') { |
|
| 197 | 197 | throw new AlreadyProcessedException(); |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | if ($orderId == null) { |
| 271 | 271 | $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where timestamp<".(time() - 5); |
| 272 | 272 | tep_db_query($query); |
| 273 | - } elseif ($this->$orderId!='') { |
|
| 273 | + } elseif ($this->$orderId != '') { |
|
| 274 | 274 | $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where id='$orderId'"; |
| 275 | 275 | tep_db_query($query); |
| 276 | 276 | } |
@@ -313,12 +313,12 @@ discard block |
||
| 313 | 313 | if (!$payed) { |
| 314 | 314 | if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) { |
| 315 | 315 | $status = $this->pagantisOrder->getStatus(); |
| 316 | - } else { |
|
| 316 | + }else { |
|
| 317 | 317 | $status = '-'; |
| 318 | 318 | } |
| 319 | 319 | throw new WrongStatusException($status); |
| 320 | 320 | } |
| 321 | - } else { |
|
| 321 | + }else { |
|
| 322 | 322 | throw new OrderNotFoundException(); |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | tep_db_query($query); |
| 350 | 350 | |
| 351 | 351 | $comment = "Pagantis id=$this->pagantisOrderId/Via=".$this->origin; |
| 352 | - $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY ."(comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
| 352 | + $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY."(comments, orders_id, orders_status_id, customer_notified, date_added) values |
|
| 353 | 353 | ('$comment', ".$insert_id.", '2', -1, now() )"; |
| 354 | 354 | tep_db_query($query); |
| 355 | 355 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | private function insertLog($exception) |
| 372 | 372 | { |
| 373 | 373 | if ($exception instanceof \Exception) { |
| 374 | - $logEntry= new LogEntry(); |
|
| 374 | + $logEntry = new LogEntry(); |
|
| 375 | 375 | $logEntryJson = $logEntry->error($exception)->toJson(); |
| 376 | 376 | |
| 377 | 377 | $query = "insert into ".TABLE_PAGANTIS_LOG."(log) values ('$logEntryJson')"; |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | tep_session_register($var); |
| 17 | 17 | } |
| 18 | 18 | $destUrl = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', true, false); |
| 19 | - $destUrl.="?order_id=$_GET[order_id]&from=notify"; |
|
| 20 | -} else { |
|
| 19 | + $destUrl .= "?order_id=$_GET[order_id]&from=notify"; |
|
| 20 | +}else { |
|
| 21 | 21 | $destUrl = tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', true, false); |
| 22 | 22 | } |
| 23 | 23 | |