Skip to content

Commit

Permalink
Merge pull request #349 from razorpay/fix-order-confirmation-emails
Browse files Browse the repository at this point in the history
Send order confirmation email after payment completed successfully
  • Loading branch information
enishant authored Mar 8, 2022
2 parents 7b86784 + 6f0c454 commit 6751e57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Plugin/Sales/Order/Email/Container/OrderIdentityPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,23 @@ class OrderIdentityPlugin
*/
protected $checkoutSession;

/**
* @var \Psr\Log\LoggerInterface $logger
*/
protected $logger;

/**
* @param \Magento\Checkout\Model\Session $checkoutSession
*
* @codeCoverageIgnore
*/
public function __construct(
\Magento\Checkout\Model\Session $checkoutSession
\Magento\Checkout\Model\Session $checkoutSession,
\Psr\Log\LoggerInterface $logger
)
{
$this->checkoutSession = $checkoutSession;
$this->logger = $logger;
}

/**
Expand All @@ -32,9 +39,11 @@ public function aroundIsEnabled(\Magento\Sales\Model\Order\Email\Container\Order
$forceOrderMailSentOnSuccess = $this->checkoutSession->getRazorpayMailSentOnSuccess();
if(isset($forceOrderMailSentOnSuccess))
{
// Send order confirmation email after payment completed successfully
$returnValue = $forceOrderMailSentOnSuccess;
$this->checkoutSession->unsRazorpayMailSentOnSuccess();
}

$this->logger->info('OrderIdentityPlugin::aroundIsEnabled returnValue:' . $returnValue);

return $returnValue;
}
Expand Down
5 changes: 5 additions & 0 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@
<argument name="logger" xsi:type="object">RazorpayLogger</argument>
</arguments>
</type>
<type name="Razorpay\Magento\Plugin\Sales\Order\Email\Container\OrderIdentityPlugin">
<arguments>
<argument name="logger" xsi:type="object">RazorpayLogger</argument>
</arguments>
</type>
</config>

0 comments on commit 6751e57

Please sign in to comment.