Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Ignore all notification after COMPLETED
Browse files Browse the repository at this point in the history
  • Loading branch information
regdos committed May 15, 2017
1 parent 0f672e0 commit 1647ce8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions upload/catalog/controller/extension/payment/payu.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@ public function ordernotify()
$orderRetrive->getError() . ' [response: ' . serialize($orderRetrive->getResponse()) . ']'
);
} else {
$payuOrderStatus = $orderRetrive->getResponse()->orders[0]->status;
$order = $this->model_checkout_order->getOrder($orderInfo['order_id']);

if ($orderInfo['status'] != OpenPayuOrderStatus::STATUS_COMPLETED) {
$newstatus = $this->getPaymentStatusId($orderRetrive->getResponse()->orders[0]->status);
$newstatus = $this->getPaymentStatusId($payuOrderStatus);

if ($newstatus && $newstatus != $orderInfo['status']) {
$this->model_extension_payment_payu->updateSatatus($session_id, $newstatus);
if ($newstatus && $newstatus != $order['order_status']) {
$this->model_extension_payment_payu->updateSatatus($session_id, $payuOrderStatus);
$this->model_checkout_order->addOrderHistory($orderInfo['order_id'], $newstatus);
}

Expand All @@ -132,6 +134,7 @@ public function ordernotify()

} catch (OpenPayU_Exception $e) {
$this->logger->write('OCR Notification: ' . $e->getMessage());
die($e->getMessage());
}

}
Expand Down
2 changes: 1 addition & 1 deletion upload/catalog/model/extension/payment/payu.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getMethod($address, $total)

public function bindOrderIdAndSessionId($orderId, $sessionId)
{
$query = 'INSERT INTO ' . DB_PREFIX . 'payu_so VALUES (NULL, "'.(int)$orderId.'", "'.$this->db->escape($sessionId).'", 1)';
$query = 'INSERT INTO ' . DB_PREFIX . 'payu_so VALUES (NULL, "'.(int)$orderId.'", "'.$this->db->escape($sessionId).'", "'.OpenPayuOrderStatus::STATUS_PENDING.'")';
return $this->db->query($query);
}

Expand Down

0 comments on commit 1647ce8

Please sign in to comment.