|
14 | 14 | use Magento\Sales\Api\Data\OrderInterface;
|
15 | 15 | use Magento\Store\Model\StoreManagerInterface;
|
16 | 16 | use Opengento\Gdpr\Model\Notifier\AbstractMailSender;
|
17 |
| -use Psr\Log\LoggerInterface; |
18 | 17 |
|
19 | 18 | class MailSender extends AbstractMailSender implements SenderInterface
|
20 | 19 | {
|
21 |
| - /** |
22 |
| - * @var LoggerInterface |
23 |
| - */ |
24 |
| - private LoggerInterface $logger; |
25 |
| - |
26 |
| - /** |
27 |
| - * @var StoreManagerInterface |
28 |
| - */ |
29 |
| - private StoreManagerInterface $storeManager; |
30 |
| - |
31 | 20 | public function __construct(
|
32 |
| - LoggerInterface $logger, |
| 21 | + private StoreManagerInterface $storeManager, |
33 | 22 | TransportBuilder $transportBuilder,
|
34 | 23 | ScopeConfigInterface $scopeConfig,
|
35 |
| - StoreManagerInterface $storeManager, |
36 | 24 | array $configPaths
|
37 | 25 | ) {
|
38 |
| - $this->logger = $logger; |
39 |
| - $this->storeManager = $storeManager; |
40 | 26 | parent::__construct($transportBuilder, $scopeConfig, $configPaths);
|
41 | 27 | }
|
42 | 28 |
|
43 | 29 | /**
|
44 |
| - * @inheritdoc |
45 | 30 | * @throws LocalizedException
|
46 | 31 | * @throws MailException
|
47 | 32 | */
|
48 | 33 | public function send(OrderInterface $order): void
|
49 | 34 | {
|
50 | 35 | $storeId = $order->getStoreId() === null ? null : (int)$order->getStoreId();
|
51 |
| - $vars = [ |
52 |
| - 'order' => $order, |
53 |
| - 'billing' => $order->getBillingAddress(), |
54 |
| - 'store' => $this->storeManager->getStore($order->getStoreId()), |
55 |
| - 'customer_data' => [ |
56 |
| - 'customer_name' => $order->getCustomerName(), |
57 |
| - ], |
58 |
| - ]; |
59 |
| - |
60 |
| - try { |
61 |
| - $this->sendMail($order->getCustomerEmail(), $order->getCustomerName(), $storeId, $vars); |
62 |
| - $this->logger->debug(__('GDPR Email Success')); |
63 |
| - } catch (MailException $exc) { |
64 |
| - $this->logger->error(__('GDPR Email Error: %1', $exc->getMessage())); |
65 |
| - } |
66 | 36 |
|
| 37 | + $this->sendMail( |
| 38 | + $order->getCustomerEmail(), |
| 39 | + $order->getCustomerName(), |
| 40 | + $storeId, |
| 41 | + [ |
| 42 | + 'order' => $order, |
| 43 | + 'billing' => $order->getBillingAddress(), |
| 44 | + 'store' => $this->storeManager->getStore($storeId), |
| 45 | + 'customer_data' => [ |
| 46 | + 'customer_name' => $order->getCustomerName(), |
| 47 | + ] |
| 48 | + ] |
| 49 | + ); |
67 | 50 | }
|
68 | 51 | }
|
0 commit comments