/** * @see FrontController::postProcess() */ public function postProcess() { if (empty($_POST)) { $fap = json_decode(file_get_contents("php://input")); $_POST = array(); foreach ($fap as $key => $val) { $_POST[$key] = $val; } } try { if ($_POST['order_status'] == FondyCls::ORDER_DECLINED) { exit('Order declined'); } $fondy = new Fondy(); $settings = array('merchant_id' => $fondy->getOption('merchant'), 'secret_key' => $fondy->getOption('secret_key')); $isPaymentValid = FondyCls::isPaymentValid($settings, $_POST); if ($isPaymentValid !== true) { exit($isPaymentValid); } list($orderId, ) = explode(FondyCls::ORDER_SEPARATOR, $_POST['order_id']); $history = new OrderHistory(); $history->id_order = $orderId; $id_order_state = _PS_OS_PAYMENT_; $history->changeIdOrderState(intval($id_order_state), intval($orderId)); $history->addWithemail(true, ""); exit('OK'); } catch (Exception $e) { exit(get_class($e) . ': ' . $e->getMessage()); } }
/** * @see FrontController::postProcess() */ public function postProcess() { $fondy = new Fondy(); if ($_POST['order_status'] == FondyCls::ORDER_DECLINED) { $this->errors[] = Tools::displayError('Order declined'); } if ($_POST['order_status'] == 'processing') { $this->errors[] = Tools::displayError('Payment proccesing'); } $settings = array('merchant_id' => $fondy->getOption('merchant'), 'secret_key' => $fondy->getOption('secret_key')); $isPaymentValid = FondyCls::isPaymentValid($settings, $_POST); if ($isPaymentValid !== true) { $this->errors[] = Tools::displayError($isPaymentValid); } $cart = $this->context->cart; 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'); } $customer = new Customer($cart->id_customer); if (!Validate::isLoadedObject($customer)) { Tools::redirect('index.php?controller=order&step=1'); } if (empty($this->errors)) { list($orderId, ) = explode(FondyCls::ORDER_SEPARATOR, $_POST['order_id']); $history = new OrderHistory(); $history->id_order = $orderId; $history->changeIdOrderState((int) Configuration::get('PS_OS_PAYMENT'), $orderId); $history->addWithemail(true, array('order_name' => $orderId)); Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key); } }
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'); }
die('Access denied'); } $ExternalLibPath = realpath(dirname(__FILE__)) . DS . 'fondyLib.php'; require_once $ExternalLibPath; if (defined('PAYMENT_NOTIFICATION')) { $pp_response = array(); $pp_response['order_status'] = 'F'; $pp_response['reason_text'] = __('text_transaction_declined'); $order_id = !empty($_REQUEST['order_id']) ? (int) $_REQUEST['order_id'] : 0; if ($mode == 'response' && !empty($_REQUEST['order_id'])) { $order_info = fn_get_order_info($order_id); if (empty($processor_data)) { $processor_data = fn_get_processor_data($order_info['payment_id']); } $option = array('merchant_id' => $processor_data['processor_params']['fondy_merchantid'], 'secret_key' => $processor_data['processor_params']['fondy_merchnatSecretKey']); $response = FondyCls::isPaymentValid($option, $_POST); if ($response == true && $order_info['status'] == 'N') { if ($_REQUEST['order_status'] == FondyCls::ORDER_APPROVED) { $pp_response['order_status'] = 'P'; $pp_response['reason_text'] = __('transaction_approved'); $pp_response['transaction_id'] = $_REQUEST['payment_id']; if (fn_check_payment_script('fondy.php', $order_id)) { fn_finish_payment($order_id, $pp_response); fn_order_placement_routines('route', $order_id); } } } } elseif ($mode == 'sucsses' && !empty($_REQUEST['order_id'])) { if ($response == true && $order_info['status'] == 'N') { if ($_REQUEST['order_status'] == FondyCls::ORDER_APPROVED) { $pp_response['order_status'] = 'P';