Completed
Branch master (ca3e3b)
by César
02:36
created
paylater.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $this->module_key = '2b9bc901b4d834bb7069e7ea6510438f';
47 47
         $this->ps_versions_compliancy['min'] = '1.5.0';
48 48
         $this->ps_versions_compliancy['max'] = '1.6.9';
49
-        $this->url='https://pmt.pagantis.com/v1/installments';
49
+        $this->url = 'https://pmt.pagantis.com/v1/installments';
50 50
         $this->product_tab = 0;
51 51
         $this->limited_currencies = array('EUR');
52 52
         self::initModuleAccess();
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
         /* Backward compatibility */
60 60
         if (version_compare(_PS_VERSION_, "1.5", "<")) {
61
-            require(_PS_MODULE_DIR_ . $this->name . '/backward_compatibility/backward.php');
61
+            require(_PS_MODULE_DIR_.$this->name.'/backward_compatibility/backward.php');
62 62
         }
63 63
     }
64 64
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
             return;
492 492
         }
493 493
         $currency_id = $params['cart']->id_currency;
494
-        $currency = new Currency((int) $currency_id);
494
+        $currency = new Currency((int)$currency_id);
495 495
         if (in_array($currency->iso_code, $this->limited_currencies) == false) {
496 496
             return false;
497 497
         }
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
         //prevent opening payment method if no credentials introduced
501 501
         if (Configuration::get('PAYLATER_ENVIRONMENT') == 0) {
502 502
             if (trim(Configuration::get('PAYLATER_ACCOUNT_ID_TEST')) == false ||
503
-               trim(Configuration::get('PAYLATER_ACCOUNT_KEY_TEST')) == false ) {
503
+               trim(Configuration::get('PAYLATER_ACCOUNT_KEY_TEST')) == false) {
504 504
                    return false;
505 505
             }
506 506
         } else {
@@ -513,26 +513,26 @@  discard block
 block discarded – undo
513 513
         $cart_products = $this->context->cart->getProducts();
514 514
 
515 515
         $items = array();
516
-        $desciption=array();
516
+        $desciption = array();
517 517
 
518 518
         $discount = Configuration::get('PAYLATER_DISCOUNT');
519
-        $discount_boolean = $discount == 'true' ? 1:0;
519
+        $discount_boolean = $discount == 'true' ? 1 : 0;
520 520
         foreach ($cart_products as $p) {
521 521
             $items[] = array(
522 522
                         'description' => $p['name'],
523 523
                         'quantity' => $p['cart_quantity'],
524 524
                         'amount' => number_format($p['total_wt'], 2, '.', '')
525 525
             );
526
-             $desciption[]=  $p['name']. " (".$p['cart_quantity'].")";
526
+             $desciption[] = $p['name']." (".$p['cart_quantity'].")";
527 527
         }
528 528
 
529 529
         //Shipping address
530 530
         $saddress = new Address($this->context->cart->id_address_delivery);
531
-        $sstreet=$saddress->address1.' '.$saddress->address2;
532
-        $scity=$saddress->city;
531
+        $sstreet = $saddress->address1.' '.$saddress->address2;
532
+        $scity = $saddress->city;
533 533
         $suser_state = new State($saddress->id_state);
534
-        $sprovince=$suser_state->name;
535
-        $szipcode=$saddress->postcode;
534
+        $sprovince = $suser_state->name;
535
+        $szipcode = $saddress->postcode;
536 536
         $sphone = $saddress->phone;
537 537
         $smobile_phone = $saddress->phone_mobile;
538 538
         $shipping_last_updated = Tools::substr($saddress->date_upd, 0, 10);
@@ -541,11 +541,11 @@  discard block
 block discarded – undo
541 541
 
542 542
         //billing address
543 543
         $billing_address = new Address($this->context->cart->id_address_invoice);
544
-        $street=$billing_address->address1.' '.$billing_address->address2;
545
-        $city=$billing_address->city;
544
+        $street = $billing_address->address1.' '.$billing_address->address2;
545
+        $city = $billing_address->city;
546 546
         $user_state2 = new State($billing_address->id_state);
547
-        $province=$user_state2->name;
548
-        $zipcode=$billing_address->postcode;
547
+        $province = $user_state2->name;
548
+        $zipcode = $billing_address->postcode;
549 549
         $phone = $billing_address->phone;
550 550
         $mobile_phone = $billing_address->phone_mobile;
551 551
         $billing_last_updated = Tools::substr($billing_address->date_upd, 0, 10);
@@ -557,14 +557,14 @@  discard block
 block discarded – undo
557 557
         $dob = '';
558 558
         $dni = '';
559 559
         if (property_exists($billing_address, 'dni')) {
560
-            $dni=$billing_address->dni;
560
+            $dni = $billing_address->dni;
561 561
             $billing_dni = $billing_address->dni;
562 562
         }
563 563
 
564 564
         if (property_exists($saddress, 'dni')) {
565 565
             if (trim($dni) == '' && $saddress->firstname == $this->context->cookie->customer_firstname
566 566
               && $saddress->lastname == $this->context->cookie->customer_lastname) {
567
-                $dni=$saddress->dni;
567
+                $dni = $saddress->dni;
568 568
             }
569 569
             $shipping_dni = $saddress->dni;
570 570
         }
@@ -582,13 +582,13 @@  discard block
 block discarded – undo
582 582
         }
583 583
 
584 584
         $link = Context::getContext()->link;
585
-        $callback_url =  $link->getModuleLink('paylater', 'validation', array());
585
+        $callback_url = $link->getModuleLink('paylater', 'validation', array());
586 586
         $confirmationQuery = array(
587 587
             'id_cart' => $this->context->cart->id,
588 588
             'key' => $this->context->cart->secure_key,
589 589
         );
590 590
 
591
-        $url_OK =  $link->getModuleLink('paylater', 'confirmation', $confirmationQuery);
591
+        $url_OK = $link->getModuleLink('paylater', 'confirmation', $confirmationQuery);
592 592
 
593 593
         if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
594 594
             $url_NOK = $link->getPageLink('order-opc');
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                         'quantity' => 1,
605 605
                         'amount' => number_format($shippingCost, 2, '.', '')
606 606
             );
607
-            $desciption[]= $this->l('Shipping cost');
607
+            $desciption[] = $this->l('Shipping cost');
608 608
         }
609 609
         if (Configuration::get('PAYLATER_ENVIRONMENT') == 1) {
610 610
             //mode live
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
                 $gender = '';
635 635
                 break;
636 636
         }
637
-        $discount_boolean = $discount == 'true' ? 1:0;
637
+        $discount_boolean = $discount == 'true' ? 1 : 0;
638 638
 
639 639
         $iframe = Configuration::get('PAYLATER_IFRAME');
640 640
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
             $key_to_use = Configuration::get('PAYLATER_ACCOUNT_KEY_TEST');
669 669
         }
670 670
 
671
-        $widget_type = Configuration::get('PAYLATER_WIDGET') == 'false' ?  '0' : '1';
671
+        $widget_type = Configuration::get('PAYLATER_WIDGET') == 'false' ? '0' : '1';
672 672
 
673 673
         $total_paid = 0;
674 674
         $num_prev_orders = 0;
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
             $db_paid_statuses = Db::getInstance()->executeS($sql);
705 705
             $paid_statuses = array();
706 706
             foreach ($db_paid_statuses as $p) {
707
-                $paid_statuses[]=$p['id_order_state'];
707
+                $paid_statuses[] = $p['id_order_state'];
708 708
             }
709 709
             if ($this->context->cookie->logged) {
710 710
                 $orders = Order::getCustomerOrders($this->context->customer->id);
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         $opc_enabled = Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 ? 1 : 0;
739 739
 
740 740
         //d($key_to_use.$account_id.$order_id.$amount.$this->context->currency->iso_code.$url_OK.$url_NOK);
741
-        $text=$key_to_use.$account_id.$order_id.$amount.$this->context->currency->iso_code.
741
+        $text = $key_to_use.$account_id.$order_id.$amount.$this->context->currency->iso_code.
742 742
         $url_OK.$url_NOK.$callback_url.$discount.$cancelled_url;
743 743
         $signature = hash('sha512', $text);
744 744
         $this->smarty->assign(array(
@@ -754,11 +754,11 @@  discard block
 block discarded – undo
754 754
             'items' => $items,
755 755
             'signature' => $signature,
756 756
             'customer_name' => ($this->context->cookie->logged ? $this->context->cookie->customer_firstname.
757
-            ' '.$this->context->cookie->customer_lastname :   $customer->firstname." ".$customer->lastname),
757
+            ' '.$this->context->cookie->customer_lastname : $customer->firstname." ".$customer->lastname),
758 758
             'customer_email' => ($this->context->cookie->logged ? $this->context->cookie->email : $customer->email),
759 759
             'locale' => $this->context->language->iso_code,
760 760
             'cart_products' => $cart_products,
761
-            'billing_full_name' => $billing_address->firstname. " ".$billing_address->lastname ,
761
+            'billing_full_name' => $billing_address->firstname." ".$billing_address->lastname,
762 762
             'billing_dni' => $billing_dni,
763 763
             'billing_alias' => $billing_address->alias,
764 764
             'billing_company' => $billing_address->company,
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
             'shipping_alias' => $saddress->alias,
778 778
             'shipping_company' => $saddress->company,
779 779
             'shipping_vat' => $saddress->vat_number,
780
-            'shipping_full_name' => $saddress->firstname. " ".$saddress->lastname ,
780
+            'shipping_full_name' => $saddress->firstname." ".$saddress->lastname,
781 781
             'sphone' => $sphone,
782 782
             'smobile_phone' => $smobile_phone,
783 783
             'dni' => $dni,
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
             'customer_gender' => $gender,
803 803
             'opc_enabled' => $opc_enabled,
804 804
             'is_guest' => $this->context->customer->is_guest,
805
-            'platform' => 'prestashop ' . _PS_VERSION_,
805
+            'platform' => 'prestashop '._PS_VERSION_,
806 806
             'version4' => version_compare(_PS_VERSION_, "1.5", "<"),
807 807
             'version3' => version_compare(_PS_VERSION_, "1.4", "<"),
808 808
             'content' => "javascript:$('#paylater_form').submit();",
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
         }
963 963
 
964 964
         $discount = Configuration::get('PAYLATER_DISCOUNT');
965
-        $discount_boolean = $discount == 'true' ? 1:0;
965
+        $discount_boolean = $discount == 'true' ? 1 : 0;
966 966
         $this->smarty->assign(array(
967 967
             'price' => ($params['total_price']),
968 968
             'discount' => $discount_boolean,
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
     {
980 980
         if (isset($params['product'])) {
981 981
             $product = $params['product'];
982
-        } elseif (Tools::getValue('controller')=='product' && Tools::getValue('id_product')) {
982
+        } elseif (Tools::getValue('controller') == 'product' && Tools::getValue('id_product')) {
983 983
             $product = new Product(Tools::getValue('id_product'));
984 984
         } else {
985 985
             if (method_exists($this->context->controller, 'getProduct')) {
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
         }
1047 1047
 
1048 1048
         $discount = Configuration::get('PAYLATER_DISCOUNT');
1049
-        $discount_boolean = $discount == 'true' ? 1:0;
1049
+        $discount_boolean = $discount == 'true' ? 1 : 0;
1050 1050
         $this->smarty->assign(array(
1051 1051
             'price' => ($price),
1052 1052
             'discount' => $discount_boolean,
Please login to merge, or discard this patch.
controllers/front/validation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             $currency_id = (int)Context::getContext()->currency->id;
36 36
 
37 37
             //$json = file_get_contents('php://input');
38
-            $json =  Tools::file_get_contents('php://input');
38
+            $json = Tools::file_get_contents('php://input');
39 39
             //$data = json_decode($json, true);
40 40
             $data = Tools::jsonDecode($json);
41 41
 
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
                   $key_to_use = Configuration::get('PAYLATER_ACCOUNT_KEY_TEST');
47 47
             }
48 48
             $signature_check = sha1(
49
-                $key_to_use .
50
-                $data->account_id .
51
-                $data->api_version .
52
-                $data->event .
49
+                $key_to_use.
50
+                $data->account_id.
51
+                $data->api_version.
52
+                $data->event.
53 53
                 $data->data->id
54 54
             );
55 55
             if ($signature_check != $data->signature) {
Please login to merge, or discard this patch.
backward_compatibility/Context.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 */
26 26
 
27 27
 if ((bool)Configuration::get('PS_MOBILE_DEVICE'))
28
-    require_once(_PS_MODULE_DIR_ . '/mobile_theme/Mobile_Detect.php');
28
+    require_once(_PS_MODULE_DIR_.'/mobile_theme/Mobile_Detect.php');
29 29
 
30 30
 // Retro 1.3, 'class_exists' cause problem with autoload...
31 31
 if (version_compare(_PS_VERSION_, '1.4', '<'))
Please login to merge, or discard this patch.