public function canonicalRedirection()
 {
     // Automatically redirect to the canonical URL if the current in is the right one
     // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
     if (Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
         if (Validate::isLoadedObject($this->cms) and $canonicalURL = self::$link->getCMSLink($this->cms)) {
             if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
                 header('HTTP/1.0 301 Moved');
                 header('Cache-Control: no-cache');
                 if (_PS_MODE_DEV_) {
                     die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
                 }
                 Tools::redirectLink($canonicalURL);
             }
         }
         if (Validate::isLoadedObject($this->cms_category) and $canonicalURL = self::$link->getCMSCategoryLink($this->cms_category)) {
             if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
                 header('HTTP/1.0 301 Moved');
                 header('Cache-Control: no-cache');
                 if (_PS_MODE_DEV_) {
                     die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
                 }
                 Tools::redirectLink($canonicalURL);
             }
         }
     }
 }
 protected function canonicalRedirection()
 {
     global $link, $cookie;
     if (Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
         // Automatically redirect to the canonical URL if needed
         if (isset($this->php_self) && !empty($this->php_self)) {
             // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
             $canonicalURL = $link->getPageLink($this->php_self, $this->ssl, $cookie->id_lang);
             if (!Tools::getValue('ajax') && !preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', ($this->ssl && _PS_SSL_ENABLED_ ? 'https://' : 'http://') . urldecode($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']))) {
                 if ($_SERVER['REQUEST_URI'] == __PS_BASE_URI__) {
                     header('HTTP/1.0 303 See Other');
                     header('Cache-Control: no-cache');
                 } else {
                     header('HTTP/1.0 301 Moved Permanently');
                     header('Cache-Control: no-cache');
                 }
                 $params = '';
                 $excludedKey = array('isolang', 'id_lang');
                 foreach ($_GET as $key => $value) {
                     if (!in_array($key, $excludedKey)) {
                         $params .= ($params == '' ? '?' : '&') . $key . '=' . $value;
                     }
                 }
                 Module::hookExec('frontCanonicalRedirect');
                 if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) {
                     die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . $params . '">' . $canonicalURL . $params . '</a>');
                 }
                 Tools::redirectLink($canonicalURL . $params);
             }
         }
     }
 }
Example #3
0
 public function postProcess()
 {
     if ($this->context->cart->id_customer == 0 || $this->context->cart->id_address_delivery == 0 || $this->context->cart->id_address_invoice == 0 || !$this->module->active) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
     }
     // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
     $authorized = false;
     foreach (Module::getPaymentModules() as $module) {
         if ($module['name'] == 'cashondelivery') {
             $authorized = true;
             break;
         }
     }
     //		if (!$authorized)
     //			die(Tools::displayError('This payment method is not available.'));
     $customer = new Customer($this->context->cart->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
     }
     if (Tools::getValue('confirm')) {
         $customer = new Customer((int) $this->context->cart->id_customer);
         $total = $this->context->cart->getOrderTotal(true, Cart::BOTH);
         $this->module->validateOrder((int) $this->context->cart->id, Configuration::get('PS_OS_PREPARATION'), $total, $this->module->displayName, null, array(), null, false, $customer->secure_key);
         Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $this->context->cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $this->module->currentOrder);
     }
 }
Example #4
0
 public function initContent()
 {
     parent::initContent();
     $ordernumber = Tools::getValue('InvId');
     $this->context->smarty->assign('ordernumber', $ordernumber);
     if (Configuration::get('robokassa_postvalidate')) {
         if (!$ordernumber) {
             robokassa::validateAnsver($this->module->l('Cart number is not set'));
         }
         $cart = new Cart((int) $ordernumber);
         if (!Validate::isLoadedObject($cart)) {
             robokassa::validateAnsver($this->module->l('Cart does not exist'));
         }
         if (!($ordernumber = Order::getOrderByCartId($cart->id))) {
             $this->setTemplate('waitingPayment.tpl');
         }
     }
     if (!$ordernumber) {
         robokassa::validateAnsver($this->module->l('Order number is not set'));
     }
     $order = new Order((int) $ordernumber);
     if (!Validate::isLoadedObject($order)) {
         robokassa::validateAnsver($this->module->l('Order does not exist'));
     }
     $customer = new Customer((int) $order->id_customer);
     if ($customer->id != $this->context->cookie->id_customer) {
         robokassa::validateAnsver($this->module->l('You are not logged in'));
     }
     if ($order->hasBeenPaid()) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $order->id_cart . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $order->id);
     } else {
         $this->setTemplate('waitingPayment.tpl');
     }
 }
 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     $cart = new Cart(Tools::getValue('order_id'));
     $customer = new Customer((int) $cart->id_customer);
     $veritransBinPromo = new VeritransBinPromo();
     Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . Tools::getValue('order_id') . '&id_module=' . $veritransBinPromo->id . '&id_order=' . Tools::getValue('order_id') . '&key=' . $customer->secure_key);
 }
 public function preProcess()
 {
     if ($id_category = (int) Tools::getValue('id_category')) {
         $this->category = new Category($id_category, self::$cookie->id_lang);
     }
     if (!Validate::isLoadedObject($this->category)) {
         header('HTTP/1.1 404 Not Found');
         header('Status: 404 Not Found');
     } else {
         // Automatically redirect to the canonical URL if the current in is the right one
         // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
         $currentURL = self::$link->getCategoryLink($this->category);
         $currentURL = preg_replace('/[?&].*$/', '', $currentURL);
         if (!preg_match('/^' . Tools::pRegexp($currentURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $currentURL . '">' . $currentURL . '</a>');
             }
             Tools::redirectLink($currentURL);
         }
     }
     parent::preProcess();
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         if ($id_category = (int) Tools::getValue('id_category')) {
             $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
             $default_rewrite = array();
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = self::$link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
             }
             self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
         }
     }
 }
Example #7
0
 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     $this->display_column_left = false;
     $this->display_column_center = true;
     $this->display_column_right = false;
     $valid_payments = array();
     if (Configuration::get('PIGMBH_PAYMILL_DEBIT')) {
         $valid_payments[] = 'debit';
     }
     if (Configuration::get('PIGMBH_PAYMILL_CREDITCARD')) {
         $valid_payments[] = 'creditcard';
     }
     if (!in_array(Tools::getValue('payment'), $valid_payments)) {
         Tools::redirectLink($this->context->link->getPageLink('order', true, null, array('step' => '1')));
     }
     $db_data = $this->getPaymillUserData();
     $this->updatePaymillClient($db_data);
     $cart = $this->context->cart;
     foreach ($this->module->getCurrency((int) $cart->id_currency) as $currency) {
         if ($currency['id_currency'] == $cart->id_currency) {
             $iso_currency = $currency['iso_code'];
             break;
         }
     }
     $brands = array();
     foreach (Tools::jsonDecode(Configuration::get('PIGMBH_PAYMILL_ACCEPTED_BRANDS'), true) as $brand_key => $brand_value) {
         $brands[str_replace('-', '', $brand_key)] = $brand_value;
     }
     $data = array('use_backward_compatible_checkout' => _PS_VERSION_ < '1.6', 'nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->module->getCurrency((int) $cart->id_currency), 'currency_iso' => $iso_currency, 'total' => (int) round($cart->getOrderTotal(true, Cart::BOTH) * 100), 'displayTotal' => $cart->getOrderTotal(true, Cart::BOTH), 'this_path' => $this->module->getPathUri(), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/', 'public_key' => Configuration::get('PIGMBH_PAYMILL_PUBLICKEY'), 'payment' => Tools::getValue('payment'), 'paymill_debugging' => (int) Configuration::get('PIGMBH_PAYMILL_DEBUG') == 'on', 'modul_base' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/pigmbhpaymill/', 'customer' => $this->context->customer->firstname . ' ' . $this->context->customer->lastname, 'prefilledFormData' => $this->updatePaymillPayment($db_data), 'acceptedBrands' => Configuration::get('PIGMBH_PAYMILL_ACCEPTED_BRANDS'), 'acceptedBrandsDecoded' => $brands);
     $this->context->smarty->assign($data);
     parent::initContent();
     $this->setTemplate('paymill_checkout.tpl');
 }
 /**
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     if ($this->context->cart->id_customer == 0 || $this->context->cart->id_address_delivery == 0 || $this->context->cart->id_address_invoice == 0 || !$this->module->active) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
     }
     // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
     $authorized = false;
     foreach (Module::getPaymentModules() as $module) {
         if ($module['name'] == 'seurcashondelivery') {
             $authorized = true;
             break;
         }
     }
     if (!$authorized) {
         die(Tools::displayError('This payment method is not available.'));
     }
     $customer = new Customer((int) $this->context->cart->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
     }
     if (Tools::getValue('confirm')) {
         $customer = new Customer((int) $this->context->cart->id_customer);
         $coste = (double) abs($this->context->cart->getOrderTotal(true, Cart::BOTH));
         $cargo = number_format($this->module->getCargo($this->context->cart, false), 2, '.', '');
         $vales = (double) abs($this->context->cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
         $total = $coste - $vales + $cargo;
         if (version_compare(_PS_VERSION_, "1.5", "<")) {
             $this->module->validateOrderFORWEBS_v4((int) $this->context->cart->id, Configuration::get('REEMBOLSO_OS_CARGO'), $total, $this->module->displayName, null, array(), null, false, $customer->secure_key);
         } else {
             $this->module->validateOrderFORWEBS_v5((int) $this->context->cart->id, Configuration::get('REEMBOLSO_OS_CARGO'), $total, $this->module->displayName, null, array(), null, false, $customer->secure_key);
         }
         Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . urlencode($customer->secure_key) . '&id_cart=' . (int) $this->context->cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $this->module->currentOrder);
     }
 }
 public function renderView()
 {
     if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj)) {
         $link = $this->context->link->getPageLink('attachment', true, null, 'id_attachment=' . $obj->id);
         Tools::redirectLink($link);
     }
     return $this->displayWarning($this->trans('File not found', array(), 'Admin.Catalog.Notification'));
 }
 public function renderView()
 {
     if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj)) {
         $link = $this->context->link->getPageLink('attachment', true, NULL, 'id_attachment=' . $obj->id);
         Tools::redirectLink($link);
     }
     return $this->displayWarning($this->l('File not found'));
 }
 public function initContent()
 {
     parent::initContent();
     $log_on = Configuration::get('YA_ORG_LOGGING_ON');
     if (Tools::getValue('label')) {
         $data = explode('_', Tools::getValue('label'));
     } else {
         $data = explode('_', Tools::getValue('customerNumber'));
     }
     if (!empty($data) && isset($data[1])) {
         $ordernumber = $data['1'];
         $this->context->smarty->assign('ordernumber', $ordernumber);
         $this->context->smarty->assign('time', date('Y-m-d H:i:s '));
         if (!$ordernumber) {
             if ($log_on) {
                 $this->module->logSave('yakassa_success: Error ' . $this->module->l('Cart number is not specified'));
             }
             $this->setTemplate('error.tpl');
         } else {
             $cart = new Cart((int) $ordernumber);
             $qty = $cart->nbProducts();
             $this->context->smarty->assign('nbProducts', $qty);
             if (!Validate::isLoadedObject($cart) || $qty < 1) {
                 if ($log_on) {
                     $this->module->logSave('yakassa_success: Error ' . $this->module->l('Shopping cart does not exist'));
                 }
                 $this->setTemplate('error.tpl');
             } else {
                 $ordernumber = (int) $cart->id;
                 if (!$ordernumber) {
                     if ($log_on) {
                         $this->module->logSave('yakassa_success: Error ' . $this->module->l('Order number is not specified'));
                     }
                     $this->setTemplate('error.tpl');
                 } else {
                     $order = new Order((int) Order::getOrderByCartId($cart->id));
                     $customer = new Customer((int) $order->id_customer);
                     if ($order->hasBeenPaid()) {
                         if ($log_on) {
                             $this->module->logSave('yakassa_success: #' . $order->id . ' ' . $this->module->l('Order paid'));
                         }
                         Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $order->id_cart . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $order->id);
                     } else {
                         if ($log_on) {
                             $this->module->logSave('yakassa_success: #' . $order->id . ' ' . $this->module->l('Order wait payment'));
                         }
                         $this->setTemplate('waitingPayment.tpl');
                     }
                 }
             }
         }
     } else {
         if ($log_on) {
             $this->module->logSave('yakassa_success: Error ' . $this->module->l('Cart number is not specified'));
         }
         $this->setTemplate('error.tpl');
     }
 }
 public function initContent()
 {
     parent::initContent();
     if (Tools::getIsset('collection_id') && Tools::getValue('collection_id') != 'null') {
         // payment variables
         $payment_statuses = array();
         $payment_ids = array();
         $payment_types = array();
         $payment_method_ids = array();
         $card_holder_names = array();
         $four_digits_arr = array();
         $statement_descriptors = array();
         $status_details = array();
         $transaction_amounts = 0;
         $collection_ids = split(',', Tools::getValue('collection_id'));
         foreach ($collection_ids as $collection_id) {
             $mercadopago = $this->module;
             $mercadopago_sdk = $mercadopago->mercadopago;
             $result = $mercadopago_sdk->getPayment($collection_id);
             $payment_info = $result['response']['collection'];
             $id_cart = $payment_info['external_reference'];
             $cart = new Cart($id_cart);
             $payment_statuses[] = $payment_info['status'];
             $payment_ids[] = $payment_info['id'];
             $payment_types[] = $payment_info['payment_type'];
             $payment_method_ids[] = $payment_info['payment_method_id'];
             $transaction_amounts += $payment_info['transaction_amount'];
             if ($payment_info['payment_type'] == 'credit_card') {
                 $card_holder_names[] = $payment_info['cardholder']['name'];
                 $four_digits_arr[] = '**** **** **** ' . $payment_info['last_four_digits'];
                 $statement_descriptors[] = $payment_info['statement_descriptor'];
                 $status_details[] = $payment_info['status_detail'];
             }
         }
         if (Validate::isLoadedObject($cart)) {
             $order_id = Order::getOrderByCartId($cart->id);
             $order = new Order($order_id);
             $uri = __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . $order->id_cart . '&id_module=' . $mercadopago->id . '&id_order=' . $order->id . '&key=' . $order->secure_key;
             $uri .= '&payment_status=' . $payment_statuses[0];
             $uri .= '&payment_id=' . join(" / ", $payment_ids);
             $uri .= '&payment_type=' . join(" / ", $payment_types);
             $uri .= '&payment_method_id=' . join(" / ", $payment_method_ids);
             $uri .= '&amount=' . $transaction_amounts;
             if ($payment_info['payment_type'] == 'credit_card') {
                 $uri .= '&card_holder_name=' . join(" / ", $card_holder_names);
                 $uri .= '&four_digits=' . join(" / ", $four_digits_arr);
                 $uri .= '&statement_descriptor=' . $statement_descriptors[0];
                 $uri .= '&status_detail=' . $status_details[0];
             }
             Tools::redirectLink($uri);
         }
     } else {
         error_log('External reference is not set. Order placement has failed.');
     }
 }
 public function canonicalRedirection()
 {
     if (Validate::isLoadedObject($this->manufacturer) && Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
         $canonicalURL = self::$link->getManufacturerLink($this->manufacturer);
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
 }
 /**
  * Executes a request to the PaynetEasy server
  * to start the payment process.
  *
  * If the request is successful, redirects the
  * customer to the PaynetEasy payment form.
  *
  * If the request is made with an error,
  * displays an error message.
  */
 public function display()
 {
     $payment_aggregate = new PaymentAggregate($this->module);
     $prestashop_cart = $this->context->cart;
     $return_url = $this->context->link->getModuleLink('payneteasy', 'finishsale', array('id_cart' => $prestashop_cart->id), true);
     try {
         $paynet_response = $payment_aggregate->startSale($prestashop_cart, $return_url);
         $this->savePaynetPayment($paynet_response, $prestashop_cart);
     } catch (Exception $ex) {
         $this->createOrderWithErrorPayment($prestashop_cart, $ex->getMessage());
         return $this->displayTechnicalError($ex);
     }
     Tools::redirectLink($paynet_response->getRedirectUrl());
 }
 public function initContent()
 {
     $this->be_gateway = new beGateway();
     if ($this->be_gateway->active && isset($_REQUEST['action'])) {
         $action = $_REQUEST['action'];
         if ($action == 'callback') {
             $this->_processWebhook();
         } elseif ($action == 'success') {
             $this->_processReturn();
         } else {
             $this->_processReturn(true);
         }
     }
     Tools::redirectLink(__PS_BASE_URI__ . 'index.php');
 }
 public function canonicalRedirection()
 {
     // Automatically redirect to the canonical URL if the current in is the right one
     // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
     if (Validate::isLoadedObject($this->product) && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
         $canonicalURL = self::$link->getProductLink($this->product);
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
 }
 public function preProcess()
 {
     if ($id_cms = (int) Tools::getValue('id_cms')) {
         $this->cms = new CMS($id_cms, self::$cookie->id_lang);
     } elseif ($id_cms_category = (int) Tools::getValue('id_cms_category')) {
         $this->cms_category = new CMSCategory($id_cms_category, self::$cookie->id_lang);
     }
     // Automatically redirect to the canonical URL if the current in is the right one
     // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
     if ($this->cms and $canonicalURL = self::$link->getCMSLink($this->cms)) {
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (defined(_PS_MODE_DEV_) and _PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
     if ($this->cms_category and $canonicalURL = self::$link->getCMSCategoryLink($this->cms_category)) {
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (_PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
     parent::preProcess();
     /* assignCase (1 = CMS page, 2 = CMS category) */
     if (Validate::isLoadedObject($this->cms) and ($this->cms->active or Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS' . $this->cms->id) and file_exists(dirname(__FILE__) . '/../' . Tools::getValue('ad') . '/ajax.php'))) {
         $this->assignCase = 1;
     } elseif (Validate::isLoadedObject($this->cms_category)) {
         $this->assignCase = 2;
     } else {
         Tools::redirect('404.php');
     }
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         $rewrite_infos = (isset($id_cms) and !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
         $default_rewrite = array();
         foreach ($rewrite_infos as $infos) {
             $arr_link = (isset($id_cms) and !isset($id_cms_category)) ? self::$link->getCMSLink($id_cms, $infos['link_rewrite'], $this->ssl, $infos['id_lang']) : self::$link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
             $default_rewrite[$infos['id_lang']] = $arr_link;
         }
         self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
     }
 }
Example #18
0
 public function postProcess()
 {
     $validate = new PagSeguroValidateOrderPrestashop($this->pagSeguro);
     try {
         $validate->validate();
         if ($this->checkout) {
             die($validate->request($this->checkout));
         }
         try {
             Tools::redirectLink($validate->request($this->checkout));
         } catch (Exception $e) {
             $this->displayErrorPage();
         }
     } catch (PagSeguroServiceException $exc) {
         $this->canceledOrderForError();
         $this->displayErrorPage();
     } catch (Exception $e) {
         $this->displayErrorPage();
     }
 }
Example #19
0
 public function postProcess()
 {
     list($orderId, ) = explode(FondyCls::ORDER_SEPARATOR, $_POST['order_id']);
     $this->_order = new Order(intval($orderId));
     $this->_customer = new Customer($this->_order->id_customer);
     if ($_POST['order_status'] == FondyCls::ORDER_DECLINED) {
         $this->showError(Tools::displayError('Order declined'));
     }
     $settings = array('merchant_id' => $this->getOption('merchant'), 'secret_key' => $this->getOption('secret_key'));
     $isPaymentValid = FondyCls::isPaymentValid($settings, $_POST);
     if ($isPaymentValid !== true) {
         $this->showError(Tools::displayError($isPaymentValid));
     }
     if (!Validate::isLoadedObject($this->_customer)) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
     }
     $history = new OrderHistory();
     $history->id_order = $orderId;
     $id_order_state = _PS_OS_PAYMENT_;
     $history->changeIdOrderState(intval($id_order_state), intval($orderId));
     $history->addWithemail(true, "");
     // redirect to success
     Tools::redirectLink(__PS_BASE_URI__ . 'modules/fondy/result-success.php');
 }
Example #20
0
            $this->context->smarty->assign(array('reference_order' => Order::getUniqReferenceOf($id_order)));
        }
        echo $this->context->smarty->fetch(_PS_MODULE_DIR_ . '/paypal/views/templates/front/order-confirmation.tpl');
    }
}
$id_cart = Tools::getValue('id_cart');
$id_module = Tools::getValue('id_module');
$id_order = Tools::getValue('id_order');
$key = Tools::getValue('key');
if ($id_module && $id_order && $id_cart && $key) {
    if (version_compare(_PS_VERSION_, '1.5', '<')) {
        $integral_evolution_submit = new PayPalIntegralEvolutionSubmit();
        $integral_evolution_submit->run();
    }
} elseif ($id_cart) {
    // Redirection
    $values = array('id_cart' => (int) $id_cart, 'id_module' => (int) Module::getInstanceByName('paypal')->id, 'id_order' => (int) Order::getOrderByCartId((int) $id_cart));
    if (version_compare(_PS_VERSION_, '1.5', '<')) {
        $customer = new Customer(Context::getContext()->cookie->id_customer);
        $values['key'] = $customer->secure_key;
        $url = _MODULE_DIR_ . '/paypal/integral_evolution/submit.php';
        Tools::redirectLink($url . '?' . http_build_query($values, '', '&'));
    } else {
        $values['key'] = Context::getContext()->customer->secure_key;
        $link = Context::getContext()->link->getModuleLink('paypal', 'submit', $values);
        Tools::redirect($link);
    }
} else {
    Tools::redirectLink(__PS_BASE_URI__);
}
exit(0);
require_once _PS_MODULE_DIR_ . "/buyster/classes/BuysterOperation.php";
require_once _PS_MODULE_DIR_ . "/buyster/classes/BuysterWebService.php";
$buyster = new Buyster();
$cartId = substr(htmlentities($_POST['transactionReference']), 30);
//[BuysterRef][YYYYMMDDhhmmss][token][cartId]
$cart = new Cart($cartId);
$post_token = substr($_POST['transactionReference'], 24, 6);
$payment_token = BuysterOperation::getTokenId($cart->id);
if ($post_token != $payment_token || $payment_token == '') {
    die('Invalid Token');
}
$ref = BuysterOperation::getReferenceId($cart->id);
$webService = new BuysterWebService();
$result = $webService->operation("DIAGNOSTIC", $ref);
if ($cart->id_customer == 0 or $cart->id_address_delivery == 0 or $cart->id_address_invoice == 0 or !$buyster->active) {
    Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
}
BuysterOperation::setStatusId($cart->id, htmlentities($_POST['status']));
$operation = BuysterOperation::getOperationId($cart->id);
if (isset($_POST['responseDescription'])) {
    $responseDescription = str_replace('+', ' ', Tools::safeOutput($_POST['responseDescription']));
}
if (htmlentities($_POST['responseCode']) != '00') {
    $buyster->validateOrder($cart->id, Configuration::get('PS_OS_ERROR'), 0, $buyster->name, $responseDescription, array(), NULL, false, $cart->secure_key);
} else {
    if ($operation == 'paymentValidation' && $result['status'] == 'TO_VALIDATE') {
        $buyster->validateOrder($cart->id, Configuration::get('BUYSTER_PAYMENT_STATE_VALIDATION'), (double) ($result['amount'] / 100), $buyster->name, $responseDescription, array(), NULL, false, $cart->secure_key);
    } else {
        if ($result['status'] == 'TO_CAPTURE') {
            $buyster->validateOrder($cart->id, Configuration::get('PS_OS_PAYMENT'), (double) ($result['amount'] / 100), $buyster->name, $responseDescription, array(), NULL, false, $cart->secure_key);
        } else {
Example #22
0
        //echo '取號錯誤'.$res['error'];
        $smarty->assign(array(
            'Error' => $res['error']));
        session_unregister("checkStep");
        session_destroy(); 
        echo "ERROR:".$res['error'];
        //echo Module::display('greenworld','payErrorPage.tpl');
    }else {
        //echo '交易單號: '.$res['tsr'];
        //echo '銀行代碼: '.$res['bankcode'];
        //echo '銀行帳戶: '.$res['vaccno'];
        $finishURL=__PS_BASE_URI__.'order-confirmation.php?key='.$customer->secure_key.'&id_cart='.(int)($cart->id).'&id_module='.(int)$CheckPay->id.'&id_order='.(int)$CheckPay->currentOrder;
        $finishURL.="&tsr=".$res['tsr'];
        $finishURL.="&payno=".$res['payno'];
        session_unregister("checkStep");
        session_destroy();
        Tools::redirectLink($finishURL);
        //echo Module::display('greenworld','thankyouPage.tpl');
    }
    
}else{
    echo Module::display(_iMODULE_NAME_CVS_,'ErrorStep.tpl');
    session_unregister("checkStep");
    session_destroy();
 
}
include(dirname(__FILE__).'/../../footer.php');

?>

Example #23
0
         } else {
             $id_order = (int) $ppec->currentOrder;
             $order = new Order($id_order);
             $history = new OrderHistory();
             $history->id_order = (int) $id_order;
             $history->changeIdOrderState((int) $payment_type, $id_order);
             $history->addWithemail();
             $history->add();
         }
         unset(Context::getContext()->cookie->{PaypalExpressCheckout::$COOKIE_NAME});
         // Update for the Paypal shipping cost
         if ($order) {
             $values = array('key' => $customer->secure_key, 'id_module' => (int) $ppec->id, 'id_cart' => (int) $cart->id, 'id_order' => (int) $ppec->currentOrder);
             $query = http_build_query($values, '', '&');
             if (_PS_VERSION_ < '1.5') {
                 Tools::redirectLink(__PS_BASE_URI__ . '/modules/paypal/express_checkout/submit.php?' . $query);
             } else {
                 $controller = new FrontController();
                 $controller->init();
                 Tools::redirect(Context::getContext()->link->getModuleLink('paypal', 'submit', $values));
             }
         }
     } else {
         // If Cart changed, no need to keep the paypal data
         unset(Context::getContext()->cookie->{PaypalExpressCheckout::$COOKIE_NAME});
         $ppec->logs[] = $ppec->l('Cart changed since the last checkout express, please make a new Paypal checkout payment');
     }
 }
 if (_PS_VERSION_ < '1.5') {
     $display = new BWDisplay();
 } else {
 public function execPayment($cart)
 {
     if (!$this->active) {
         return;
     }
     if (!$this->checkCurrency($cart)) {
         Tools::redirectLink(__PS_BASE_URI__ . 'order.php');
     }
     $link = new Link();
     global $cookie, $smarty;
     $smarty->assign(array('payment_type' => Configuration::get('VT_PAYMENT_TYPE'), 'api_version' => Configuration::get('VT_API_VERSION'), 'error_message' => '', 'link' => $link, 'nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->getCurrency((int) $cart->id_currency), 'total' => $cart->getOrderTotal(true, Cart::BOTH), 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . ((int) Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages()) > 1 && isset($smarty->ps_language) && !empty($smarty->ps_language) ? $smarty->ps_language->iso_code . '/' : '') . 'modules/' . $this->name . '/'));
     return $this->display(__FILE__, 'views/templates/front/payment_execution.tpl');
 }
Example #25
0
 function postProcess()
 {
     global $cookie, $link;
     if (Tools::isSubmit('viewcms') and $id_cms = intval(Tools::getValue('id_cms')) and $cms = new CMS($id_cms, intval($cookie->id_lang)) and Validate::isLoadedObject($cms)) {
         Tools::redirectLink($link->getCMSLink($cms));
     }
     return parent::postProcess();
 }
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/../../init.php';
include dirname(__FILE__) . '/payubiz.php';
include dirname(__FILE__) . '/../../header.php';
include dirname(__FILE__) . '/payubiz_common.inc';
$payu = new payubiz();
$response = $_REQUEST;
$baseUrl = Tools::getShopDomain(true, true) . __PS_BASE_URI__;
if ($response['status'] == 'failure') {
    $order_id = $response['txnid'] - 9410;
    $transactionId = $response['mihpayid'];
    $log = Configuration::get('PAYU_LOGS');
    $smarty->assign('baseUrl', $baseUrl);
    $smarty->assign('orderId', $order_id);
    $smarty->assign('transactionId', $transactionId);
    global $cart, $cookie;
    $total = $amount;
    $currency = new Currency(Tools::getValue('currency_payement', false) ? Tools::getValue('currency_payement') : $cookie->id_currency);
    $customer = new Customer((int) $cart->id_customer);
    $payu->validateOrder((int) $cart->id, _PS_OS_ERROR_, $total, $payu->displayName, NULL, NULL, (int) $currency->id, false, $customer->secure_key);
}
$smarty->display('failure.tpl');
$result = Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'orders WHERE id_cart = ' . (int) $cart->id);
if ($log == 1) {
    pblog('payubiz Data: ' . print_r($response, true));
    $responseValue = str_replace("'", " ", implode(",", $response));
    $successQuery = "update ps_payubiz_order set payment_response='{$responseValue}', payment_method= '" . $response["payment_source"] . "', payment_status= '" . $response["status"] . "', id_order='" . $result["id_order"] . "'  where id_transaction= " . $response['txnid'];
    Db::getInstance()->Execute($successQuery);
}
Tools::redirectLink(__PS_BASE_URI__ . 'order-detail.php?id_order=' . $result['id_order']);
include dirname(__FILE__) . '/../../footer.php';
Example #27
0
 public function payment()
 {
     if (!$this->active) {
         return;
     }
     global $cart;
     $id_currency = (int) $this->getModuleCurrency($cart);
     // If the currency is forced to a different one than the current one, then the cart must be updated
     if ($cart->id_currency != $id_currency) {
         if (Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'cart SET id_currency = ' . (int) $id_currency . ' WHERE id_cart = ' . (int) $cart->id)) {
             $cart->id_currency = $id_currency;
         }
     }
     $currency = new Currency($id_currency);
     $language = new Language($cart->id_lang);
     $customer = new Customer($cart->id_customer);
     require_once dirname(__FILE__) . '/mapi/mapi_package.php';
     $hipayAccount = Configuration::get('HIPAY_ACCOUNT_' . $currency->iso_code);
     $hipayPassword = Configuration::get('HIPAY_PASSWORD_' . $currency->iso_code);
     $hipaySiteId = Configuration::get('HIPAY_SITEID_' . $currency->iso_code);
     $hipaycategory = Configuration::get('HIPAY_CATEGORY_' . $currency->iso_code);
     $paymentParams = new HIPAY_MAPI_PaymentParams();
     $paymentParams->setLogin($hipayAccount, $hipayPassword);
     $paymentParams->setAccounts($hipayAccount, $hipayAccount);
     // EN_us is not a standard format, but that's what Hipay uses
     if (isset($language->language_code)) {
         $paymentParams->setLocale($this->formatLanguageCode($language->language_code));
     } else {
         $paymentParams->setLocale(Tools::strtolower($language->iso_code) . '_' . Tools::strtoupper($language->iso_code));
     }
     $paymentParams->setMedia('WEB');
     $paymentParams->setRating(Configuration::get('HIPAY_RATING'));
     $paymentParams->setPaymentMethod(HIPAY_MAPI_METHOD_SIMPLE);
     $paymentParams->setCaptureDay(HIPAY_MAPI_CAPTURE_IMMEDIATE);
     $paymentParams->setCurrency(Tools::strtoupper($currency->iso_code));
     $paymentParams->setIdForMerchant($cart->id);
     $paymentParams->setMerchantSiteId($hipaySiteId);
     $paymentParams->setIssuerAccountLogin($this->context->customer->email);
     $paymentParams->setUrlCancel(Tools::getShopDomainSsl(true) . __PS_BASE_URI__ . 'order.php?step=3');
     $paymentParams->setUrlNok(Tools::getShopDomainSsl(true) . __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . (int) $cart->id . '&amp;id_module=' . (int) $this->id . '&amp;secure_key=' . $customer->secure_key);
     $paymentParams->setUrlOk(Tools::getShopDomainSsl(true) . __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . (int) $cart->id . '&amp;id_module=' . (int) $this->id . '&amp;secure_key=' . $customer->secure_key);
     $paymentParams->setUrlAck(Tools::getShopDomainSsl(true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/validation.php?token=' . Tools::encrypt($cart->id . $cart->secure_key . Configuration::get('HIPAY_SALT')));
     $paymentParams->setBackgroundColor('#FFFFFF');
     if (!$paymentParams->check()) {
         return $this->l('[Hipay] Error: cannot create PaymentParams');
     }
     $item = new HIPAY_MAPI_Product();
     $item->setName($this->l('Cart'));
     $item->setInfo('');
     $item->setquantity(1);
     $item->setRef($cart->id);
     $item->setCategory($hipaycategory);
     $item->setPrice($cart->getOrderTotal());
     try {
         if (!$item->check()) {
             return $this->l('[Hipay] Error: cannot create "Cart" Product');
         }
     } catch (Exception $e) {
         return $this->l('[Hipay] Error: cannot create "Cart" Product');
     }
     $items = array($item);
     $order = new HIPAY_MAPI_Order();
     $order->setOrderTitle($this->l('Order total'));
     $order->setOrderCategory($hipaycategory);
     if (!$order->check()) {
         return $this->l('[Hipay] Error: cannot create Order');
     }
     try {
         $commande = new HIPAY_MAPI_SimplePayment($paymentParams, $order, $items);
     } catch (Exception $e) {
         return $this->l('[Hipay] Error:') . ' ' . $e->getMessage();
     }
     $xmlTx = $commande->getXML();
     $output = HIPAY_MAPI_SEND_XML::sendXML($xmlTx);
     $reply = HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, $url, $err_msg, $err_keyword, $err_value, $err_code);
     if ($reply === true) {
         Tools::redirectLink($url);
     } else {
         global $smarty;
         include dirname(__FILE__) . '/../../header.php';
         $smarty->assign('errors', array('[Hipay] ' . strval($err_msg) . ' (' . $output . ')'));
         $_SERVER['HTTP_REFERER'] = Tools::getShopDomainSsl(true) . __PS_BASE_URI__ . 'order.php?step=3';
         $smarty->display(_PS_THEME_DIR_ . 'errors.tpl');
         include dirname(__FILE__) . '/../../footer.php';
     }
 }
 public function preProcess()
 {
     if ((int) Tools::getValue('pp') == 1) {
         $intime = time();
         echo 'intime: ' . $intime;
     }
     if ($id_product = (int) Tools::getValue('id_product')) {
         $this->product = new Product($id_product, true, self::$cookie->id_lang);
         //if((int)Tools::getValue('pp') == 1){
         //	print_r($this->product->getPrice(false, null, 2));
         //}
         $id_product = (int) Tools::getValue('id_product');
         $productsViewed = (isset(self::$cookie->viewed) and !empty(self::$cookie->viewed)) ? array_slice(explode(',', self::$cookie->viewed), 0, 12) : array();
         if (sizeof($productsViewed)) {
             if ($id_product and !in_array($id_product, $productsViewed)) {
                 array_unshift($productsViewed, $id_product);
             }
         } else {
             $productsViewed[] = $id_product;
         }
         self::$cookie->viewed = implode(',', $productsViewed);
     }
     if (!Validate::isLoadedObject($this->product)) {
         header('HTTP/1.1 404 Not Found');
         header('Status: 404 Not Found');
     } else {
         // Automatically redirect to the canonical URL if the current in is the right one
         // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
         if (Validate::isLoadedObject($this->product)) {
             $canonicalURL = self::$link->getProductLink($this->product);
             if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) && !Tools::getValue('adtoken')) {
                 header('HTTP/1.0 301 Moved');
                 if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
                     die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
                 }
                 Tools::redirectLink($canonicalURL);
             }
         }
     }
     parent::preProcess();
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         if ($id_product = (int) Tools::getValue('id_product')) {
             $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
             $default_rewrite = array();
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = self::$link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
             }
             self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
         }
     }
     //get categories
     $categories = $this->product->getCategories();
     if (in_array(CAT_SAREE, $categories)) {
         if (in_array(CAT_BOLLYWOOD_SAREE, $categories)) {
             self::$smarty->assign('bollywood', true);
         }
         $this->is_saree = true;
     } else {
         if (in_array(CAT_SKD, $categories)) {
             if (in_array(CAT_BOLLYWOOD_SKD, $categories)) {
                 self::$smarty->assign('bollywood', true);
             }
             if ($this->product->is_rts) {
                 $this->is_skd_rts = true;
                 if (in_array(CAT_PAKISTANI_SKD, $categories)) {
                     $this->is_pakistani_rts = true;
                 }
                 if ($this->product->has_bottom) {
                     $this->has_bottom = true;
                 }
             } else {
                 $this->is_skd = true;
             }
         } else {
             if (in_array(CAT_KURTI, $categories)) {
                 //replace 4 with constant from defines later
                 if ($this->product->is_rts) {
                     $this->is_skd_rts = true;
                 } else {
                     $this->is_skd = true;
                 }
                 if ($this->product->has_bottom) {
                     $this->has_bottom = true;
                 }
             } else {
                 if (in_array(CAT_LEHENGA, $categories)) {
                     if (in_array(CAT_BOLLYWOOD_LEHENGA, $categories)) {
                         self::$smarty->assign('bollywood', true);
                     }
                     $this->is_lehenga = true;
                 } else {
                     if (in_array(CAT_GIFTCARD, $categories)) {
                         $this->is_giftcard = true;
                     } else {
                         if (in_array(CAT_JEWELRY, $categories)) {
                             $this->is_jewelry = true;
                         } else {
                             if (in_array(CAT_KIDS, $categories)) {
                                 $this->is_kids = true;
                             } else {
                                 if (in_array(CAT_MEN, $categories)) {
                                     $this->is_men = true;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (in_array(CAT_ANARKALI, $categories)) {
         $this->is_anarkali = true;
     }
     if (in_array(CAT_BOTTOMS, $categories)) {
         $this->is_bottoms = true;
     }
     if (in_array(CAT_CHOLIS, $categories)) {
         $this->is_cholis = true;
     }
     if (in_array(CAT_ABAYA, $categories)) {
         $this->is_abaya = true;
     }
     if (in_array(CAT_HANDBAG, $categories)) {
         $this->is_handbag = true;
     }
     if (in_array(465, $categories)) {
         $this->is_wristwear = true;
     }
     if ((int) Tools::getValue('pp') == 1) {
         $time1 = time();
         echo 'preprocess end: ' . $time1;
     }
 }
Example #29
0
 protected function canonicalRedirection($canonical_url = '')
 {
     if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit')) {
         return;
     }
     $match_url = rawurldecode(Tools::getCurrentUrlProtocolPrefix() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     if (!preg_match('/^' . Tools::pRegexp(rawurldecode($canonical_url), '/') . '([&?].*)?$/', $match_url)) {
         $params = array();
         $str_params = '';
         $url_details = parse_url($canonical_url);
         if (!empty($url_details['query'])) {
             parse_str($url_details['query'], $query);
             foreach ($query as $key => $value) {
                 $params[Tools::safeOutput($key)] = Tools::safeOutput($value);
             }
         }
         $excluded_key = array('isolang', 'id_lang', 'controller', 'fc', 'id_product', 'id_category', 'id_manufacturer', 'id_supplier', 'id_cms');
         foreach ($_GET as $key => $value) {
             if (!in_array($key, $excluded_key) && Validate::isUrl($key) && Validate::isUrl($value)) {
                 $params[Tools::safeOutput($key)] = Tools::safeOutput($value);
             }
         }
         $str_params = http_build_query($params, '', '&');
         if (!empty($str_params)) {
             $final_url = preg_replace('/^([^?]*)?.*$/', '$1', $canonical_url) . '?' . $str_params;
         } else {
             $final_url = preg_replace('/^([^?]*)?.*$/', '$1', $canonical_url);
         }
         // Don't send any cookie
         Context::getContext()->cookie->disallowWriting();
         if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) {
             die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $final_url . '">' . $final_url . '</a>');
         }
         $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
         header('HTTP/1.0 ' . $redirect_type . ' Moved');
         header('Cache-Control: no-cache');
         Tools::redirectLink($final_url);
     }
 }
Example #30
0
 public function postProcess()
 {
     $cart = $this->context->cart;
     $this->display_column_left = true;
     $this->display_column_right = false;
     if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
         Tools::redirect('index.php?controller=order&step=1');
     }
     $authorized = false;
     foreach (Module::getPaymentModules() as $module) {
         if ($module['name'] == 'greenworld_paypal') {
             $authorized = true;
             break;
         }
     }
     if (!$authorized) {
         die($this->module->l('This payment method is not available.', 'validation'));
     }
     $customer = new Customer($cart->id_customer);
     $currency = $this->context->currency;
     if (!Validate::isLoadedObject($customer)) {
         Tools::redirect('index.php?controller=order&step=1');
     }
     $total = (double) $cart->getOrderTotal(true, Cart::BOTH);
     $inttotal = round($total);
     $return_url = rawurlencode(Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/doFictitiousDetonate.php');
     $this->module->validateOrder((int) $cart->id, 1, $inttotal, $this->module->displayName, null, array(), null, (int) $currency->id, $customer->secure_key);
     if ($total != (double) $inttotal) {
         Db::getInstance()->execute('
                     UPDATE `' . _DB_PREFIX_ . 'orders`
                     SET `total_paid` = ' . $inttotal . ', total_paid_tax_incl=' . $inttotal . '
                     WHERE `id_order` = ' . $this->module->currentOrder);
     }
     /*  $mer_id=Configuration::get('gw_webatm_mer_id');
                     $encryption_code=Configuration::get('gw_webatm_encryption');
                     $PostData="";
                     $PostData.="mer_id=$mer_id";
                     $PostData.="&enc_key=$encryption_code";
                     $PostData.="&setbank=ESUN";
                     $PostData.="&payment_type=webatm"; 
                     $PostData.="&amt=".$inttotal;
                     $PostData.="&od_sob=".$this->module->currentOrder;
     
                     $PostData.="&return_url=".rawurlencode(Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->module->name.'/doFictitiousDetonate.php');
                  
                     //$PostData.="&ok_url=".rawurlencode("http://".$_SERVER["HTTP_HOST"].$CheckPay->path."doFictitiousDetonate.php");
                    
                     // 建立CURL連線
                     $ch = curl_init();
                     // 設定擷取的URL網址
                     curl_setopt($ch, CURLOPT_URL, "https://ecbank.com.tw/gateway.php?");
                     curl_setopt($ch, CURLOPT_HEADER, false);
                     //將curl_exec()獲取的訊息以文件流的形式返回,而不是直接輸出。
                     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
                     //設定CURLOPT_POST 為 1或true,表示要用POST方式傳遞
                     curl_setopt($ch, CURLOPT_POST, 0); 
                     //CURLOPT_POSTFIELDS 後面則是要傳接的POST資料。
                     curl_setopt($ch, CURLOPT_POSTFIELDS, $PostData);
                     // 執行
                     $strAuth=curl_exec($ch);
                     // 關閉CURL連線
                     curl_close($ch);
                     parse_str($strAuth, $res);*/
     /* if(!isset($res['error']) || $res['error'] != '0'){
     
                         $this->context->smarty->assign(array(
                                 'error_code' => $res['error'],
                         ));
             
                         die(Tools::displayError('This payment method is not available.'));
                         //echo Module::display('greenworld','payErrorPage.tpl');
                     }else {*/
     $finishURL = 'index.php?controller=order-confirmation&id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key . '&amt=' . $inttotal . '&return_url=' . $return_url . '.php&mer_id=' . Configuration::get('gw_paypal_mer_id');
     //  $finishURL='index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&amt='.$inttotal.'&return_url='.urlencode($return_url).'&mer_id='.Configuration::get('gw_webatm_mer_id');
     //Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
     Tools::redirectLink($finishURL);
     //echo Module::display('greenworld','thankyouPage.tpl');
     // }
     //echo 'index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key;
     Tools::redirect('index.php?controller=order-confirmation&id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key);
 }