Skip to content

Commit

Permalink
added condition to update amount paid variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsharma1100 committed Jul 22, 2022
1 parent e6c8e79 commit e62258e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Controller/Payment/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,21 @@ public function execute()
$orderId = $post['payload']['payment']['entity']['notes']['merchant_order_id'];
$paymentId = $post['payload']['payment']['entity']['id'];
$orderWebhookData = $this->getOrderWebhookData($orderId);
$amountPaid = $post['payload']['payment']['entity']['amount'];

if (empty($orderWebhookData['rzp_webhook_notified_at']) === true)
{
$this->setWebhookNotifiedAt($orderWebhookData['entity_id']);
$this->setWebhookData($orderWebhookData['entity_id'], true, $paymentId, $post['event'], $post['payload']['payment']['entity']['amount']);

if ($post['event'] === 'payment.authorized')
{
$amountPaid = $post['payload']['payment']['entity']['amount'];
}
else if ($post['event'] === 'order.paid')
{
$amountPaid = $post['payload']['order']['entity']['amount_paid'];
}
$this->setWebhookData($orderWebhookData['entity_id'], true, $paymentId, $post['event'], $amountPaid);

$this->logger->info("Razorpay Webhook: Updated WebhookNotifiedAt.");

Expand Down

0 comments on commit e62258e

Please sign in to comment.