|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file has been created by developers from BitBag. |
|
5
|
|
|
* Feel free to contact us once you face any issues or want to start |
|
6
|
|
|
* You can find more information about us on https://bitbag.io and write us |
|
7
|
|
|
* an email on [email protected]. |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
declare(strict_types=1); |
|
11
|
|
|
|
|
12
|
|
|
namespace BitBag\SyliusMolliePlugin\Preparer; |
|
13
|
|
|
|
|
14
|
|
|
use BitBag\SyliusMolliePlugin\EmailSender\PaymentLinkEmailSenderInterface; |
|
15
|
|
|
use BitBag\SyliusMolliePlugin\Entity\TemplateMollieEmailTranslationInterface; |
|
16
|
|
|
use Liip\ImagineBundle\Exception\Config\Filter\NotFoundException; |
|
17
|
|
|
use Sylius\Component\Core\Model\OrderInterface; |
|
18
|
|
|
use Sylius\Component\Resource\Repository\RepositoryInterface; |
|
19
|
|
|
|
|
20
|
|
|
final class PaymentLinkEmailPreparer implements PaymentLinkEmailPreparerInterface |
|
21
|
|
|
{ |
|
22
|
|
|
/** @var RepositoryInterface */ |
|
23
|
|
|
private $templateRepository; |
|
24
|
|
|
|
|
25
|
|
|
/** @var PaymentLinkEmailSenderInterface */ |
|
26
|
|
|
private $emailSender; |
|
27
|
|
|
|
|
28
|
|
|
public function __construct(RepositoryInterface $templateRepository, PaymentLinkEmailSenderInterface $emailSender) |
|
29
|
|
|
{ |
|
30
|
|
|
$this->templateRepository = $templateRepository; |
|
31
|
|
|
$this->emailSender = $emailSender; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function prepare(OrderInterface $order, string $templateName): void |
|
35
|
|
|
{ |
|
36
|
|
|
$locale = $order->getLocaleCode(); |
|
37
|
|
|
|
|
38
|
|
|
/** @var TemplateMollieEmailTranslationInterface $template */ |
|
39
|
|
|
$template = $this->templateRepository->findOneByLocaleCodeAdnType( |
|
|
|
|
|
|
40
|
|
|
$locale, |
|
41
|
|
|
$templateName |
|
42
|
|
|
); |
|
43
|
|
|
|
|
44
|
|
|
if (null === $template) { |
|
45
|
|
|
throw new NotFoundException(\sprintf('Not payment link template found, or not translation added')); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
$this->emailSender->sendConfirmationEmail($order, $template); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.