@@ -292,7 +292,7 @@ |
||
| 292 | 292 | class ControllerBackwardModule |
| 293 | 293 | { |
| 294 | 294 | /** |
| 295 | - * @param $js_uri |
|
| 295 | + * @param string $js_uri |
|
| 296 | 296 | * @return void |
| 297 | 297 | */ |
| 298 | 298 | public function addJS($js_uri) |
@@ -299,7 +299,7 @@ |
||
| 299 | 299 | { |
| 300 | 300 | //1.3 compatibility |
| 301 | 301 | if (_PS_VERSION_ >= '1.4') { |
| 302 | - Tools::addJS($js_uri); |
|
| 302 | + Tools::addJS($js_uri); |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
@@ -25,7 +25,7 @@ |
||
| 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', '<')) |
@@ -24,8 +24,9 @@ discard block |
||
| 24 | 24 | * International Registered Trademark & Property of PrestaShop SA |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -if ((bool)Configuration::get('PS_MOBILE_DEVICE')) |
|
| 27 | +if ((bool)Configuration::get('PS_MOBILE_DEVICE')) { |
|
| 28 | 28 | require_once(_PS_MODULE_DIR_ . '/mobile_theme/Mobile_Detect.php'); |
| 29 | +} |
|
| 29 | 30 | |
| 30 | 31 | // Retro 1.3, 'class_exists' cause problem with autoload... |
| 31 | 32 | if (version_compare(_PS_VERSION_, '1.4', '<')) |
@@ -163,8 +164,7 @@ discard block |
||
| 163 | 164 | $this->country = new Country((int)$cookie->id_country); |
| 164 | 165 | $this->customer = new CustomerBackwardModule((int)$cookie->id_customer); |
| 165 | 166 | $this->employee = new Employee((int)$cookie->id_employee); |
| 166 | - } |
|
| 167 | - else |
|
| 167 | + } else |
|
| 168 | 168 | { |
| 169 | 169 | $this->currency = null; |
| 170 | 170 | $this->language = null; |
@@ -175,8 +175,9 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $this->shop = new ShopBackwardModule(); |
| 177 | 177 | |
| 178 | - if ((bool)Configuration::get('PS_MOBILE_DEVICE')) |
|
| 179 | - $this->mobile_detect = new Mobile_Detect(); |
|
| 178 | + if ((bool)Configuration::get('PS_MOBILE_DEVICE')) { |
|
| 179 | + $this->mobile_detect = new Mobile_Detect(); |
|
| 180 | + } |
|
| 180 | 181 | } |
| 181 | 182 | |
| 182 | 183 | public function getMobileDevice() |
@@ -189,16 +190,19 @@ discard block |
||
| 189 | 190 | switch ((int)Configuration::get('PS_MOBILE_DEVICE')) |
| 190 | 191 | { |
| 191 | 192 | case 0: // Only for mobile device |
| 192 | - if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet()) |
|
| 193 | - $this->mobile_device = true; |
|
| 193 | + if ($this->mobile_detect->isMobile() && !$this->mobile_detect->isTablet()) { |
|
| 194 | + $this->mobile_device = true; |
|
| 195 | + } |
|
| 194 | 196 | break; |
| 195 | 197 | case 1: // Only for touchpads |
| 196 | - if ($this->mobile_detect->isTablet() && !$this->mobile_detect->isMobile()) |
|
| 197 | - $this->mobile_device = true; |
|
| 198 | + if ($this->mobile_detect->isTablet() && !$this->mobile_detect->isMobile()) { |
|
| 199 | + $this->mobile_device = true; |
|
| 200 | + } |
|
| 198 | 201 | break; |
| 199 | 202 | case 2: // For touchpad or mobile devices |
| 200 | - if ($this->mobile_detect->isMobile() || $this->mobile_detect->isTablet()) |
|
| 201 | - $this->mobile_device = true; |
|
| 203 | + if ($this->mobile_detect->isMobile() || $this->mobile_detect->isTablet()) { |
|
| 204 | + $this->mobile_device = true; |
|
| 205 | + } |
|
| 202 | 206 | break; |
| 203 | 207 | } |
| 204 | 208 | } |
@@ -221,8 +225,9 @@ discard block |
||
| 221 | 225 | */ |
| 222 | 226 | public static function getContext() |
| 223 | 227 | { |
| 224 | - if (!isset(self::$instance)) |
|
| 225 | - self::$instance = new Context(); |
|
| 228 | + if (!isset(self::$instance)) { |
|
| 229 | + self::$instance = new Context(); |
|
| 230 | + } |
|
| 226 | 231 | return self::$instance; |
| 227 | 232 | } |
| 228 | 233 | |
@@ -241,8 +246,9 @@ discard block |
||
| 241 | 246 | */ |
| 242 | 247 | public static function shop() |
| 243 | 248 | { |
| 244 | - if (!self::$instance->shop->getContextType()) |
|
| 245 | - return ShopBackwardModule::CONTEXT_ALL; |
|
| 249 | + if (!self::$instance->shop->getContextType()) { |
|
| 250 | + return ShopBackwardModule::CONTEXT_ALL; |
|
| 251 | + } |
|
| 246 | 252 | return self::$instance->shop->getContextType(); |
| 247 | 253 | } |
| 248 | 254 | } |
@@ -315,10 +321,11 @@ discard block |
||
| 315 | 321 | |
| 316 | 322 | public function addJquery() |
| 317 | 323 | { |
| 318 | - if (_PS_VERSION_ < '1.5') |
|
| 319 | - $this->addJS(_PS_JS_DIR_.'jquery/jquery-1.4.4.min.js'); |
|
| 320 | - elseif (_PS_VERSION_ >= '1.5') |
|
| 321 | - $this->addJS(_PS_JS_DIR_.'jquery/jquery-1.7.2.min.js'); |
|
| 324 | + if (_PS_VERSION_ < '1.5') { |
|
| 325 | + $this->addJS(_PS_JS_DIR_.'jquery/jquery-1.4.4.min.js'); |
|
| 326 | + } elseif (_PS_VERSION_ >= '1.5') { |
|
| 327 | + $this->addJS(_PS_JS_DIR_.'jquery/jquery-1.7.2.min.js'); |
|
| 328 | + } |
|
| 322 | 329 | } |
| 323 | 330 | |
| 324 | 331 | } |
@@ -339,12 +346,14 @@ discard block |
||
| 339 | 346 | */ |
| 340 | 347 | public function isLogged($with_guest = false) |
| 341 | 348 | { |
| 342 | - if (!$with_guest && $this->is_guest == 1) |
|
| 343 | - return false; |
|
| 349 | + if (!$with_guest && $this->is_guest == 1) { |
|
| 350 | + return false; |
|
| 351 | + } |
|
| 344 | 352 | |
| 345 | 353 | /* Customer is valid only if it can be load and if object password is the same as database one */ |
| 346 | - if ($this->logged == 1 && $this->id && Validate::isUnsignedId($this->id) && Customer::checkPassword($this->id, $this->passwd)) |
|
| 347 | - return true; |
|
| 354 | + if ($this->logged == 1 && $this->id && Validate::isUnsignedId($this->id) && Customer::checkPassword($this->id, $this->passwd)) { |
|
| 355 | + return true; |
|
| 356 | + } |
|
| 348 | 357 | return false; |
| 349 | 358 | } |
| 350 | 359 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - return true; |
|
| 118 | + return true; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function postProcess() |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | 'id' => 'id_type', |
| 296 | 296 | 'name' => 'name' |
| 297 | 297 | ) |
| 298 | - ), |
|
| 298 | + ), |
|
| 299 | 299 | array( |
| 300 | 300 | 'type' => 'text', |
| 301 | 301 | 'label' => $this->l('Minimum amount'), |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | 'id' => 'id_type', |
| 393 | 393 | 'name' => 'name' |
| 394 | 394 | ) |
| 395 | - ), |
|
| 395 | + ), |
|
| 396 | 396 | array( |
| 397 | 397 | 'type' => 'select', |
| 398 | 398 | 'name' => 'PAYLATER_CART_WIDGET', |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | 'id' => 'id_type', |
| 414 | 414 | 'name' => 'name' |
| 415 | 415 | ) |
| 416 | - ), |
|
| 416 | + ), |
|
| 417 | 417 | ), |
| 418 | 418 | 'submit' => array( |
| 419 | 419 | 'name' => 'submitPaylaterSettings', |
@@ -501,12 +501,12 @@ discard block |
||
| 501 | 501 | if (Configuration::get('PAYLATER_ENVIRONMENT') == 0) { |
| 502 | 502 | if (trim(Configuration::get('PAYLATER_ACCOUNT_ID_TEST')) == false || |
| 503 | 503 | trim(Configuration::get('PAYLATER_ACCOUNT_KEY_TEST')) == false ) { |
| 504 | - return false; |
|
| 504 | + return false; |
|
| 505 | 505 | } |
| 506 | 506 | } else { |
| 507 | 507 | if (trim(Configuration::get('PAYLATER_ACCOUNT_ID_LIVE')) == false || |
| 508 | 508 | trim(Configuration::get('PAYLATER_ACCOUNT_KEY_LIVE')) == false) { |
| 509 | - return false; |
|
| 509 | + return false; |
|
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
@@ -523,7 +523,7 @@ discard block |
||
| 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 |
@@ -46,7 +46,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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, |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | //validate the callback |
| 43 | 43 | if (Configuration::get('PAYLATER_ENVIRONMENT') == 1) { |
| 44 | - $key_to_use = Configuration::get('PAYLATER_ACCOUNT_KEY_LIVE'); |
|
| 44 | + $key_to_use = Configuration::get('PAYLATER_ACCOUNT_KEY_LIVE'); |
|
| 45 | 45 | } else { |
| 46 | - $key_to_use = Configuration::get('PAYLATER_ACCOUNT_KEY_TEST'); |
|
| 46 | + $key_to_use = Configuration::get('PAYLATER_ACCOUNT_KEY_TEST'); |
|
| 47 | 47 | } |
| 48 | 48 | $signature_check = sha1( |
| 49 | 49 | $key_to_use . |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | //nothing happen |
| 88 | 88 | } |
| 89 | 89 | } else { |
| 90 | - //nothing happen |
|
| 90 | + //nothing happen |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 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 |
||
| 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) { |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | |
| 27 | 27 | class PaylaterRedirectModuleFrontController extends ModuleFrontController |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * Do whatever you have to before redirecting the customer on the website of your payment processor. |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * Do whatever you have to before redirecting the customer on the website of your payment processor. |
|
| 31 | + */ |
|
| 32 | 32 | public function postProcess() |
| 33 | 33 | { |
| 34 | 34 | /** |
@@ -46,8 +46,8 @@ |
||
| 46 | 46 | $link = Context::getContext()->link; |
| 47 | 47 | $history_link = $link->getPageLink('history'); |
| 48 | 48 | $this->context->smarty->assign(array( |
| 49 | - 'total' => $order->total_paid, |
|
| 50 | - 'history_link' => $history_link |
|
| 49 | + 'total' => $order->total_paid, |
|
| 50 | + 'history_link' => $history_link |
|
| 51 | 51 | )); |
| 52 | 52 | return $this->setTemplate('confirmation.tpl'); |
| 53 | 53 | } |
@@ -32,10 +32,11 @@ |
||
| 32 | 32 | // Assign template, on 1.4 create it else assign for 1.5 |
| 33 | 33 | public function setTemplate($template) |
| 34 | 34 | { |
| 35 | - if (_PS_VERSION_ >= '1.5') |
|
| 36 | - parent::setTemplate($template); |
|
| 37 | - else |
|
| 38 | - $this->template = $template; |
|
| 35 | + if (_PS_VERSION_ >= '1.5') { |
|
| 36 | + parent::setTemplate($template); |
|
| 37 | + } else { |
|
| 38 | + $this->template = $template; |
|
| 39 | + } |
|
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | // Overload displayContent for 1.4 |
@@ -35,9 +35,9 @@ |
||
| 35 | 35 | |
| 36 | 36 | //1.3 compatibility |
| 37 | 37 | if (_PS_VERSION_ >= '1.4') { |
| 38 | - // Get out if the Display (BWDisplay to avoid any conflict)) is already defined |
|
| 39 | - if (!in_array('BWDisplay', get_declared_classes())) |
|
| 40 | - require_once(dirname(__FILE__).'/Display.php'); |
|
| 38 | + // Get out if the Display (BWDisplay to avoid any conflict)) is already defined |
|
| 39 | + if (!in_array('BWDisplay', get_declared_classes())) |
|
| 40 | + require_once(dirname(__FILE__).'/Display.php'); |
|
| 41 | 41 | } |
| 42 | 42 | // If not under an object we don't have to set the context |
| 43 | 43 | if (!isset($this)) |
@@ -30,19 +30,21 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | 32 | // Get out if the context is already defined |
| 33 | -if (!in_array('Context', get_declared_classes())) |
|
| 33 | +if (!in_array('Context', get_declared_classes())) { |
|
| 34 | 34 | require_once(dirname(__FILE__).'/Context.php'); |
| 35 | +} |
|
| 35 | 36 | |
| 36 | 37 | //1.3 compatibility |
| 37 | 38 | if (_PS_VERSION_ >= '1.4') { |
| 38 | 39 | // Get out if the Display (BWDisplay to avoid any conflict)) is already defined |
| 39 | - if (!in_array('BWDisplay', get_declared_classes())) |
|
| 40 | - require_once(dirname(__FILE__).'/Display.php'); |
|
| 41 | -} |
|
| 40 | + if (!in_array('BWDisplay', get_declared_classes())) { |
|
| 41 | + require_once(dirname(__FILE__).'/Display.php'); |
|
| 42 | + } |
|
| 43 | + } |
|
| 42 | 44 | // If not under an object we don't have to set the context |
| 43 | -if (!isset($this)) |
|
| 45 | +if (!isset($this)) { |
|
| 44 | 46 | return; |
| 45 | -else if (isset($this->context)) |
|
| 47 | +} else if (isset($this->context)) |
|
| 46 | 48 | { |
| 47 | 49 | // If we are under an 1.5 version and backoffice, we have to set some backward variable |
| 48 | 50 | if (_PS_VERSION_ >= '1.5' && isset($this->context->employee->id) && $this->context->employee->id && isset(AdminController::$currentIndex) && !empty(AdminController::$currentIndex)) |