-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug fix #66
base: master
Are you sure you want to change the base?
Bug fix #66
Changes from 5 commits
3868a16
514d6ea
fba34ff
c57f553
2ddd96d
c3f8a1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,8 +120,7 @@ public function callback() | |
); | ||
|
||
$api->utility->verifyPaymentSignature($attributes); | ||
|
||
$this->model_checkout_order->addOrderHistory($merchant_order_id, $this->config->get('payment_razorpay_order_status_id'), 'Payment Successful. Razorpay Payment Id:'.$razorpay_payment_id, true); | ||
$this->model_checkout_order->addOrderHistory($merchant_order_id, $this->config->get('payment_razorpay_order_status_id'), 'Payment Successful. Razorpay Payment Id:'.$razorpay_payment_id, true); | ||
$this->response->redirect($this->url->link('checkout/success', '', true)); | ||
} | ||
catch(\Razorpay\Api\Errors\SignatureVerificationError $e) | ||
|
@@ -212,7 +211,15 @@ protected function orderPaid(array $data) | |
$merchant_order_id = $data['payload']['payment']['entity']['notes']['opencart_order_id']; | ||
$razorpay_payment_id = $data['payload']['payment']['entity']['id']; | ||
if(isset($merchant_order_id) === true) | ||
{ | ||
{ | ||
$this->load->model('extension/payment/razorpay'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check if this can be loaded one time only in class. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ramth05 have checked for this, tried using class instance but it not working out. |
||
$order_flag = $this->model_extension_payment_razorpay->getWebhookFlag($merchant_order_id); | ||
if($order_flag == 0){ | ||
$flag = 1; | ||
$this->model_extension_payment_razorpay->setWebhookFlag($merchant_order_id,$flag); | ||
header('Status: 400 ', true, 400); | ||
exit; | ||
} | ||
$order_info = $this->model_checkout_order->getOrder($merchant_order_id); | ||
|
||
if($order_info['payment_code'] === 'razorpay' and | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,20 @@ public function getMethod($address, $total) | |
|
||
return $method_data; | ||
} | ||
|
||
public function setWebhookFlag($order_id,$flag) { | ||
|
||
$this->db->query("UPDATE " . DB_PREFIX . "order SET webhook_flag = '" . (int)$flag . "' WHERE order_id = '" . (int)$order_id . "'"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this table if belongs to opencart, rename the column to |
||
|
||
} | ||
|
||
public function getWebhookFlag($order_id) { | ||
|
||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order WHERE order_id = '" . (int)$order_id . "'"); | ||
|
||
if(isset($query->rows[0]['webhook_flag'])){ | ||
return $query->rows[0]['webhook_flag']; | ||
} | ||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move DB changes it inside model