✏️ 正在编辑: validation.php
路径:
/home/bpioifn/www/pigmentse/modules/axepta/controllers/front/validation.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php /** * 2007-2019 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <contact@prestashop.com> * @copyright 2007-2019 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AxeptaValidationModuleFrontController extends ModuleFrontController { public $ssl = true; public function initContent() { $this->display_column_left = false; $this->display_column_right = false; parent::initContent(); } /** * This class should be use by your Instant Payment * Notification system to validate the order remotely */ public function postProcess() { /* * If the module is not active anymore, no need to process anything. */ if ($this->module->active == false) { die; } /*if (Tools::getValue('data')) { $data = Tools::getValue('data'); }*/ $context = Context::getContext(); $id_cart = $context->cart->id; $customer_id = $context->customer->id; //$link = new Link(); $cart = new Cart((int) $id_cart); $amount = $cart->getOrderTotal(); $id_order = Order::getOrderByCartId((int) $this->context->cart->id); // IMPORTANT FOR MULTISHOP if (empty($id_order)) { $order = new Order((int) AxeptaApi::getOrderByCartId($id_cart, $cart->id_shop)); } else { $order = new Order((int) $id_order); } $this->context->order = $order; /*$params = array( 'id_cart' => (int) $this->context->cart->id, 'id_module' => (int) $this->module->id, 'id_order' => (int) $this->context->order->id, 'key' => $this->context->customer->secure_key, );*/ Context::getContext()->cart = new Cart((int) $id_cart); Context::getContext()->customer = new Customer((int) $customer_id); Context::getContext()->currency = new Currency((int) Context::getContext()->cart->id_currency); Context::getContext()->language = new Language((int) Context::getContext()->customer->id_lang); $secure_key = Context::getContext()->customer->secure_key; if ($this->isValidOrder() === true) { $payment_status = Configuration::get('PS_OS_PAYMENT'); $message = null; } else { $payment_status = Configuration::get('PS_OS_ERROR'); /** * Add a message to explain why the order has not been validated */ $message = $this->module->trans('An error occurred while processing payment', [], 'Modules.Axepta.Axepta'); } $module_name = $this->module->displayName; $currency_id = (int) Context::getContext()->currency->id; $this->context->smarty->assign('id_account', Tools::getValue('id_account')); $this->module->validateOrder($id_cart, $payment_status, $amount, $module_name, $message, array(), $currency_id, false, $secure_key); return $this->setTemplate('module:axepta/views/templates/front/validation.tpl'); } protected function isValidOrder() { /* * Add your checks right there */ return true; } }
💾 保存文件
← 返回文件管理器