I am trying to develop my first payment gateway in Opencart but I am having issues in processing the order after successful payment or cancelled payment.
This is because I cannot find the syntax of confirm and update functions.
I found this somewhere:
$this->model_checkout_order->update(
$order_id,
$order_status,
"",
true
);
But I just have the order_id variable but I am not sure about the others. Like where do I set them or what should it contain?
Here is my code (callback function):
public function callback() {
if (isset($this->request->post['merchant_refID'])) {
$order_id = $this->request->post['merchant_refID'];
} else {
die('Illegal Access');
}
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ($order_info) {
$data = array_merge($this->request->post,$this->request->get);
//I am using mail function to verify transaction and it is working fine
if ($data['status'] == '0') {
mail('a@a.com','success','Success' ,'From: b@b.com');
}else if ($data['status'] == '-22') {
mail('a@a.com','failed','amount low' ,'From: b@b.com');
}else if ($data['status'] == '-202') {
mail('a@a.com','failed','bank low' ,'From: b@b.com');
}else if ($data['status'] == '-300') {
mail('a@a.com','failed','bank high' ,'From: b@b.com');
}else if ($data['status'] == '-305') {
mail('a@a.com','failed','failed' ,'From: b@b.com');
}else if ($data['status'] == '-999') {
mail('a@a.com','failed','other' ,'From: b@b.com');
}
}
}
How do I update or confirm my order? Is there any guide for this? I am really confused!