Skip to content

Commit

Permalink
command added
Browse files Browse the repository at this point in the history
  • Loading branch information
SirDomin committed Nov 17, 2020
1 parent a73d321 commit 24ac912
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/Sylius/Bundle/ApiBundle/Command/OrderEmailSender.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Sylius\Bundle\ApiBundle\Command;

use Sylius\Bundle\CoreBundle\Mailer\Emails;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Mailer\Sender\SenderInterface;

final class OrderEmailSender implements OrderEmailSenderInterface
{
/** @var SenderInterface */
private $emailSender;

public function __construct(SenderInterface $emailSender)
{
$this->emailSender = $emailSender;
}

public function sendConfirmationEmail(OrderInterface $order): void
{
$this->emailSender->send(
Emails::ORDER_CONFIRMATION_RESENT,
[$order->getCustomer()->getEmail()],
[
'order' => $order,
'channel' => $order->getChannel(),
'localeCode' => $order->getLocaleCode(),
]
);
}
}
21 changes: 21 additions & 0 deletions src/Sylius/Bundle/ApiBundle/Command/OrderEmailSenderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Sylius\Bundle\ApiBundle\Command;

use Sylius\Component\Core\Model\OrderInterface;

interface OrderEmailSenderInterface
{
public function sendConfirmationEmail(OrderInterface $order): void;
}

0 comments on commit 24ac912

Please sign in to comment.