Skip to content

Commit

Permalink
Send order email for Braintree Paypal orders
Browse files Browse the repository at this point in the history
Order emails are sent using observers on the
`sales_model_service_quote_submit_success` event, but only in the
`webapi_rest` and `webapi_soap` areas. When customers checkout with
Braintree Paypal the order placement occurs in the `frontend` area with
a request to `Magento\Braintree\Controller\Paypal\PlaceOrder`, so these
orders were not sent a new order email.

Fixes #13778
Fixes #12792
  • Loading branch information
Patrick McLain committed Mar 1, 2018
1 parent ec47891 commit 975137b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Quote\Observer\Webapi;
namespace Magento\Quote\Observer;

use Magento\Sales\Model\Order\Email\Sender\OrderSender;
use Magento\Framework\Event\ObserverInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Quote\Test\Unit\Observer\Webapi;
namespace Magento\Quote\Test\Unit\Observer;

class SubmitObserverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Quote\Observer\Webapi\SubmitObserver
* @var \Magento\Quote\Observer\SubmitObserver
*/
protected $model;

Expand Down Expand Up @@ -59,7 +59,7 @@ protected function setUp()
$eventMock->expects($this->once())->method('getQuote')->willReturn($this->quoteMock);
$eventMock->expects($this->once())->method('getOrder')->willReturn($this->orderMock);
$this->quoteMock->expects($this->once())->method('getPayment')->willReturn($this->paymentMock);
$this->model = new \Magento\Quote\Observer\Webapi\SubmitObserver(
$this->model = new \Magento\Quote\Observer\SubmitObserver(
$this->loggerMock,
$this->orderSenderMock
);
Expand Down
12 changes: 12 additions & 0 deletions app/code/Magento/Quote/etc/frontend/events.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_model_service_quote_submit_success">
<observer name="sendEmail" instance="Magento\Quote\Observer\SubmitObserver" />
</event>
</config>
2 changes: 1 addition & 1 deletion app/code/Magento/Quote/etc/webapi_rest/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_model_service_quote_submit_success">
<observer name="sendEmail" instance="Magento\Quote\Observer\Webapi\SubmitObserver" />
<observer name="sendEmail" instance="Magento\Quote\Observer\SubmitObserver" />
</event>
</config>
2 changes: 1 addition & 1 deletion app/code/Magento/Quote/etc/webapi_soap/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_model_service_quote_submit_success">
<observer name="sendEmail" instance="Magento\Quote\Observer\Webapi\SubmitObserver" />
<observer name="sendEmail" instance="Magento\Quote\Observer\SubmitObserver" />
</event>
</config>

0 comments on commit 975137b

Please sign in to comment.