Skip to content

Commit

Permalink
removed webhook inline wait (#248)
Browse files Browse the repository at this point in the history
Co-authored-by: Ram Prakash Singh <[email protected]>
  • Loading branch information
ramth05 and Ram Prakash Singh authored May 24, 2021
1 parent 7c7bf19 commit 4b38d92
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
13 changes: 6 additions & 7 deletions Controller/Payment/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,7 @@ protected function orderPaid(array $post)

$quote = $this->getQuoteObject($post, $quoteId);

//before creating order let wait for 5 sec and re-verify if the quote is active or not
$this->logger->info("Razorpay Webhook: Waiting for 5 sec with quoteID:$quoteId.");

sleep(5);

$this->logger->info("Razorpay Webhook: Waiting of 5 sec over with quoteID:$quoteId.");
$this->logger->info("Razorpay Webhook: Order creation started with quoteID:$quoteId.");

//validate if the quote Order is still active
$quoteUpdated = $this->quoteRepository->get($quoteId);
Expand Down Expand Up @@ -338,9 +333,13 @@ protected function orderPaid(array $post)

$this->cache->save("started", "quote_processing_$quoteId", ["razorpay"], 30);

$this->logger->info("Razorpay Webhook: Quote submitted for order creation with quoteID:$quoteId.");

$order = $this->quoteManagement->submit($quote);

$payment = $order->getPayment();
$payment = $order->getPayment();

$this->logger->info("Razorpay Webhook: Adding payment to order for quoteID:$quoteId.");

$payment->setAmountPaid($amount)
->setLastTransId($paymentId)
Expand Down
3 changes: 0 additions & 3 deletions Observer/AfterConfigSaveObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Razorpay\Magento\Observer;

// require in case of zip installation without composer
require_once __DIR__ . "/../../Razorpay/Razorpay.php";

use Razorpay\Api\Api;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "razorpay/magento",
"description": "Razorpay Magento 2.0 plugin for accepting payments.",
"version": "3.5.0",
"version": "3.5.1",
"require": {
"php": "~5.5.0|~5.6.0|^7.0",
"razorpay/razorpay": "2.*"
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Razorpay_Magento" setup_version="3.5.0">
<module name="Razorpay_Magento" setup_version="3.5.1">
<sequence>
<module name="Magento_Sales" />
<module name="Magento_Payment" />
Expand Down

0 comments on commit 4b38d92

Please sign in to comment.