im trying to build a custom payment module. I have 80% completed it. But im having a few issues with it.
In the callback, when the user is returned to the site if a payment is successful or failed. It shows me as
The page you requested cannot be found! The page you requested cannot
be found.
when i try to directly access the callback page it gives me a blank page.
index.php?route=payment/hyperion/callback
and when a payment is successful and returned to my page (which gives me the page cannot be found). i dont see the order in the "Orders" page. It doesn't update if the payment is successful
below is my callback function
public function callback() {
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$order_id = $order_info['order_id'];
if ($order_info) {
$this->language->load('payment/hyper');
$this->data['title'] = sprintf($this->language->get('heading_title'), $this->config->get('config_name'));
if (!isset($this->request->server['HTTPS']) || ($this->request->server['HTTPS'] != 'on')) {
$this->data['base'] = HTTP_SERVER;
} else {
$this->data['base'] = HTTPS_SERVER;
}
$this->data['language'] = $this->language->get('code');
$this->data['direction'] = $this->language->get('direction');
$this->data['heading_title'] = sprintf($this->language->get('heading_title'), $this->config->get('config_name'));
$this->data['text_response'] = $this->language->get('text_response');
$this->data['text_success'] = $this->language->get('text_success');
$this->data['text_success_wait'] = sprintf($this->language->get('text_success_wait'), $this->url->link('checkout/success'));
$this->data['text_failure'] = $this->language->get('text_failure');
$this->data['text_failure_wait'] = sprintf($this->language->get('text_failure_wait'), $this->url->link('checkout/cart'));
if (isset($_POST['flag_msg']) && $_POST['flag_msg'] == 'Status_Success') {
$this->load->model('checkout/order');
$this->model_checkout_order->confirm($order_id, $this->config->get('config_order_status_id'));
$message = '';
if (isset($_POST['flag_msg'])) {
$message .= 'Payment Status = ' . $_POST['flag_msg'] . "\n";
}
if (isset($_POST['Response'])) {
$message .= 'Response = ' . $_POST['Response'] . "\n";
}
if (isset($_POST['Result'])) {
$message .= 'Result= ' . $_POST['Result'] . "\n";
}
$this->model_checkout_order->update($order_id, $this->config->get('hyper_order_status_id'), $message, false);
$this->data['continue'] = $this->url->link('checkout/success');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/hyper_success.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/hyper_success.tpl';
} else {
$this->template = 'default/template/payment/hyper_success.tpl';
}
$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render());
}
else if (isset($_POST['flag_msg']) && $_POST['flag_msg'] == 'Status_Fail') {
$this->load->model('checkout/order');
$this->model_checkout_order->confirm($order_id, $this->config->get('config_order_status_id'));
$message = '';
if (isset($_POST['flag_msg'])) {
$message .= 'Payment Status = ' . $_POST['flag_msg'] . "\n";
}
if (isset($_POST['message'])) {
$message .= 'Reason= ' . $_POST['message'] . "\n";
}
$this->model_checkout_order->update($order_id, 'Failed', $message, false);
$this->data['continue'] = $this->url->link('checkout/checkout');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/hyper_failure.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/hyper_failure.tpl';
} else {
$this->template = 'default/template/payment/hyper_failure.tpl';
}
$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render());
} else {
$this->data['continue'] = $this->url->link('checkout/cart');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/hyper_failure.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/hyper_failure.tpl';
} else {
$this->template = 'default/template/payment/hyper_failure.tpl';
}
$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render());
}
}
}
can someone help me on this?