Passed
Pull Request — master (#4)
by
unknown
02:28
created
catalog/includes/modules/payment/pagantis.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -31,25 +31,25 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 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
             } //TODO IFRAME
301 301
         } catch (\Exception $exception) {
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     public function check()
335 335
     {
336 336
         if (!isset($this->_check)) {
337
-            $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'");
337
+            $check_query = tep_db_query("select configuration_value from ".TABLE_CONFIGURATION." where configuration_key = 'MODULE_PAYMENT_PAGANTIS_STATUS'");
338 338
             $this->_check = tep_db_num_rows($check_query);
339 339
         }
340 340
         $this->installPagantisTables();
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
             tep_redirect(tep_href_link(FILENAME_MODULES, 'set=payment&module=pagantis', 'NONSSL'));
353 353
             return 'failed';
354 354
         }
355
-        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())");
356
-        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())");
357
-        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())");
355
+        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())");
356
+        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())");
357
+        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())");
358 358
 
359 359
         $this->installPagantisTables();
360 360
     }
@@ -364,25 +364,25 @@  discard block
 block discarded – undo
364 364
      */
365 365
     private function installPagantisTables()
366 366
     {
367
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_LOG . " ( 
367
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_LOG." ( 
368 368
                           id int NOT NULL AUTO_INCREMENT, 
369 369
                           log text NOT NULL, 
370 370
                           createdAt timestamp DEFAULT CURRENT_TIMESTAMP, 
371 371
                           UNIQUE KEY id (id))";
372 372
         tep_db_query($sql);
373 373
 
374
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONFIG . " (
374
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONFIG." (
375 375
                             id int NOT NULL AUTO_INCREMENT, 
376 376
                             config varchar(60) NOT NULL, 
377 377
                             value varchar(200) NOT NULL, 
378 378
                             UNIQUE KEY id(id))";
379 379
         tep_db_query($sql);
380 380
         foreach ((array)$this->defaultConfigs as $configKey => $configValue) {
381
-            $query = "INSERT INTO " . TABLE_PAGANTIS_CONFIG . " (config, value) values ('$configKey', '$configValue')";
381
+            $query = "INSERT INTO ".TABLE_PAGANTIS_CONFIG." (config, value) values ('$configKey', '$configValue')";
382 382
             tep_db_query($query);
383 383
         }
384 384
 
385
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_ORDERS . " (
385
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_ORDERS." (
386 386
                             id int NOT NULL AUTO_INCREMENT, 
387 387
                             os_order_id varchar(50), 
388 388
                             os_order_reference varchar(50) NOT NULL,
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
                             UNIQUE KEY id(id))";
392 392
         tep_db_query($sql);
393 393
 
394
-        $sql = "CREATE TABLE IF NOT EXISTS " . TABLE_PAGANTIS_CONCURRENCY . " (
394
+        $sql = "CREATE TABLE IF NOT EXISTS ".TABLE_PAGANTIS_CONCURRENCY." (
395 395
                             id varchar(50) NOT NULL,
396 396
                             `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
397 397
                             UNIQUE KEY id(id))";
@@ -405,22 +405,22 @@  discard block
 block discarded – undo
405 405
     {
406 406
         $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_LOG."'");
407 407
         if (tep_db_num_rows($checkTable) > 0) {
408
-            tep_db_query("drop table " . TABLE_PAGANTIS_LOG);
408
+            tep_db_query("drop table ".TABLE_PAGANTIS_LOG);
409 409
         }
410 410
 
411 411
         $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONFIG."'");
412 412
         if (tep_db_num_rows($checkTable) > 0) {
413
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONFIG);
413
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONFIG);
414 414
         }
415 415
 
416 416
         $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_ORDERS."'");
417 417
         if (tep_db_num_rows($checkTable) > 0) {
418
-            tep_db_query("drop table " . TABLE_PAGANTIS_ORDERS);
418
+            tep_db_query("drop table ".TABLE_PAGANTIS_ORDERS);
419 419
         }
420 420
 
421 421
         $checkTable = tep_db_query("SHOW TABLES LIKE '".TABLE_PAGANTIS_CONCURRENCY."'");
422 422
         if (tep_db_num_rows($checkTable) > 0) {
423
-            tep_db_query("drop table " . TABLE_PAGANTIS_CONCURRENCY);
423
+            tep_db_query("drop table ".TABLE_PAGANTIS_CONCURRENCY);
424 424
         }
425 425
 
426 426
         $query = "delete from ".TABLE_ORDERS_STATUS." where orders_status_id='6'";
@@ -473,13 +473,13 @@  discard block
 block discarded – undo
473 473
      */
474 474
     private function insertRow($orderId, $pagantisOrderId, $globalVars)
475 475
     {
476
-        $query = "select * from ". TABLE_PAGANTIS_ORDERS ." where os_order_reference='$orderId'";
476
+        $query = "select * from ".TABLE_PAGANTIS_ORDERS." where os_order_reference='$orderId'";
477 477
         $resultsSelect = tep_db_query($query);
478 478
         $countResults = tep_db_num_rows($resultsSelect);
479 479
         if ($countResults == 0) {
480
-            $query = "INSERT INTO ". TABLE_PAGANTIS_ORDERS ."(os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')";
481
-        } else {
482
-            $query = "UPDATE " . TABLE_PAGANTIS_ORDERS . " set pagantis_order_id='$pagantisOrderId' where os_order_reference='$orderId'";
480
+            $query = "INSERT INTO ".TABLE_PAGANTIS_ORDERS."(os_order_reference, pagantis_order_id, globals) values ('$orderId', '$pagantisOrderId','$globalVars')";
481
+        }else {
482
+            $query = "UPDATE ".TABLE_PAGANTIS_ORDERS." set pagantis_order_id='$pagantisOrderId' where os_order_reference='$orderId'";
483 483
         }
484 484
         tep_db_query($query);
485 485
     }
Please login to merge, or discard this patch.
catalog/ext/modules/payment/pagantis/callback.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
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.