diff --git a/Controller/Payment/Webhook.php b/Controller/Payment/Webhook.php index 72cce1fc..ae1ff0dd 100644 --- a/Controller/Payment/Webhook.php +++ b/Controller/Payment/Webhook.php @@ -167,6 +167,16 @@ protected function orderPaid(array $post) $this->logger->warning("Razorpay Webhook processing started for Razorpay payment_id(:$paymentId)"); + $payment_created_time = $post['payload']['payment']['entity']['created_at']; + + //added check that webhook should not executed, during front end payment processing + if((time() - $payment_created_time) < 10) + { + $this->logger->warning("Razorpay Webhook: Order processing is active for quoteID: $quoteId and Razorpay payment_id(:$paymentId)"); + header('Status: 409 Conflict, too early for processing', true, 409); + exit; + } + //validate if the quote Order is still active $quote = $this->quoteRepository->get($quoteId); diff --git a/composer.json b/composer.json index d1b40738..bb747672 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "razorpay/magento", "description": "Razorpay Magento 2.0 plugin for accepting payments.", - "version": "2.9.2", + "version": "2.9.3", "require": { "php": "~5.5.0|~5.6.0|^7.0", "razorpay/razorpay": "2.*" diff --git a/etc/module.xml b/etc/module.xml index ab2ca7b6..a0e0dbd5 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - +