return checkout/success and checkout/failure
Posted: Tue Oct 03, 2017 3:05 pm
hi,
i am using 2.3.0.2 version.
i had create one custom payment using pp_standard template.here are the flow process.
1. the will give all parameter that payment gateway required such as like this code.
2. the order will redirect to payment gateway and return order ID & payment_status and directly redirect to checkout/success.
The problem is if the transaction failed, it will directly go to checkout/success. how can i redirect page based on payment_status? For example, if payment_status = 'SUCCESSFUL' it wil redirect to checkout/success and if payment_status = 'UNSUCCESSFUL', it will redirect to checkout/failure.
i am using 2.3.0.2 version.
i had create one custom payment using pp_standard template.here are the flow process.
1. the will give all parameter that payment gateway required such as like this code.
Code: Select all
public function index() {
$this->load->language('extension/payment/custom_online_banking');
$data['button_confirm'] = $this->language->get('button_confirm');
$data['action'] = 'https://payportal.com/epayment/gateway.jsp';
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
if ($order_info) {
$data['orderid'] = $this->session->data['order_id'];
$data['callbackurl'] = $this->url->link('extension/payment/custom_online_banking/callback');
$data['description'] = trim($this->config->get('custom_online_banking_description'));
$data['tax_code'] = trim($this->config->get('custom_online_banking_tax_code'));
$data['cost_center'] = trim($this->config->get('custom_online_banking_cost_center'));
$data['acc_code'] = trim($this->config->get('custom_online_banking_acc_code'));
$data['fund_type'] = trim($this->config->get('custom_online_banking_fund_type'));
$data['project_code'] = trim($this->config->get('custom_online_banking_project_code'));
$data['name'] = html_entity_decode($order_info['payment_firstname'] . $order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
$data['amtTotal'] = $this->currency->format($order_info['total'], $this->session->data['currency'] , false, false);
$data['redirect'] = $this->url->link('checkout/success');
return $this->load->view('extension/payment/custom_online_banking', $data);
}
}
The problem is if the transaction failed, it will directly go to checkout/success. how can i redirect page based on payment_status? For example, if payment_status = 'SUCCESSFUL' it wil redirect to checkout/success and if payment_status = 'UNSUCCESSFUL', it will redirect to checkout/failure.