-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FRW-229: Remove Swiftmailer dependency (#9624)
FRW-229 Remove Swiftmailer dependency
- Loading branch information
1 parent
db46379
commit 81d8d1b
Showing
7 changed files
with
207 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"include": { | ||
"spryker/transfer": "Provides transfer objects definition with associative and decimal functionality." | ||
"spryker/transfer": "Provides transfer objects definition with `::get*OrFail()` functionality." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
src/Spryker/Zed/Oms/Communication/Plugin/Mail/OrderConfirmationMailTypeBuilderPlugin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace Spryker\Zed\Oms\Communication\Plugin\Mail; | ||
|
||
use Generated\Shared\Transfer\MailRecipientTransfer; | ||
use Generated\Shared\Transfer\MailTemplateTransfer; | ||
use Generated\Shared\Transfer\MailTransfer; | ||
use Spryker\Zed\Kernel\Communication\AbstractPlugin; | ||
use Spryker\Zed\MailExtension\Dependency\Plugin\MailTypeBuilderPluginInterface; | ||
|
||
/** | ||
* @method \Spryker\Zed\Oms\OmsConfig getConfig() | ||
* @method \Spryker\Zed\Oms\Communication\OmsCommunicationFactory getFactory() | ||
* @method \Spryker\Zed\Oms\Business\OmsFacadeInterface getFacade() | ||
* @method \Spryker\Zed\Oms\Persistence\OmsQueryContainerInterface getQueryContainer() | ||
*/ | ||
class OrderConfirmationMailTypeBuilderPlugin extends AbstractPlugin implements MailTypeBuilderPluginInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected const MAIL_TYPE = 'order confirmation mail'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const MAIL_TEMPLATE_HTML = 'oms/mail/order_confirmation.html.twig'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const MAIL_TEMPLATE_TEXT = 'oms/mail/order_confirmation.text.twig'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const GLOSSARY_KEY_MAIL_SUBJECT = 'mail.order.confirmation.subject'; | ||
|
||
/** | ||
* {@inheritDoc} | ||
* - Returns the name of mail for an order confirmation mail. | ||
* | ||
* @api | ||
* | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return static::MAIL_TYPE; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* - Builds the `MailTransfer` with data for an order confirmation mail. | ||
* | ||
* @api | ||
* | ||
* @param \Generated\Shared\Transfer\MailTransfer $mailTransfer | ||
* | ||
* @return \Generated\Shared\Transfer\MailTransfer | ||
*/ | ||
public function build(MailTransfer $mailTransfer): MailTransfer | ||
{ | ||
/** @var \Generated\Shared\Transfer\OrderTransfer $orderTransfer */ | ||
$orderTransfer = $mailTransfer->getOrderOrFail(); | ||
|
||
return $mailTransfer | ||
->setSubject(static::GLOSSARY_KEY_MAIL_SUBJECT) | ||
->addTemplate( | ||
(new MailTemplateTransfer()) | ||
->setName(static::MAIL_TEMPLATE_HTML) | ||
->setIsHtml(true), | ||
) | ||
->addTemplate( | ||
(new MailTemplateTransfer()) | ||
->setName(static::MAIL_TEMPLATE_TEXT) | ||
->setIsHtml(false), | ||
) | ||
->addRecipient( | ||
(new MailRecipientTransfer()) | ||
->setEmail($orderTransfer->getEmailOrFail()) | ||
->setName(sprintf('%s %s', $orderTransfer->getFirstName(), $orderTransfer->getLastName())), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/Spryker/Zed/Oms/Communication/Plugin/Mail/OrderShippedMailTypeBuilderPlugin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace Spryker\Zed\Oms\Communication\Plugin\Mail; | ||
|
||
use Generated\Shared\Transfer\MailRecipientTransfer; | ||
use Generated\Shared\Transfer\MailTemplateTransfer; | ||
use Generated\Shared\Transfer\MailTransfer; | ||
use Spryker\Zed\Kernel\Communication\AbstractPlugin; | ||
use Spryker\Zed\MailExtension\Dependency\Plugin\MailTypeBuilderPluginInterface; | ||
|
||
/** | ||
* @method \Spryker\Zed\Oms\OmsConfig getConfig() | ||
* @method \Spryker\Zed\Oms\Communication\OmsCommunicationFactory getFactory() | ||
* @method \Spryker\Zed\Oms\Business\OmsFacadeInterface getFacade() | ||
* @method \Spryker\Zed\Oms\Persistence\OmsQueryContainerInterface getQueryContainer() | ||
*/ | ||
class OrderShippedMailTypeBuilderPlugin extends AbstractPlugin implements MailTypeBuilderPluginInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected const MAIL_TYPE = 'order shipped mail'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const MAIL_TEMPLATE_HTML = 'oms/mail/order_shipped.html.twig'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const MAIL_TEMPLATE_TEXT = 'oms/mail/order_shipped.text.twig'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const GLOSSARY_KEY_MAIL_SUBJECT = 'mail.order.shipped.subject'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const PARAMETER_ORDER_REFERENCE = '%orderReference%'; | ||
|
||
/** | ||
* {@inheritDoc} | ||
* - Returns the name of mail for an order shipped mail. | ||
* | ||
* @api | ||
* | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return static::MAIL_TYPE; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* - Builds the `MailTransfer` with data for an order shipped mail. | ||
* | ||
* @api | ||
* | ||
* @param \Generated\Shared\Transfer\MailTransfer $mailTransfer | ||
* | ||
* @return \Generated\Shared\Transfer\MailTransfer | ||
*/ | ||
public function build(MailTransfer $mailTransfer): MailTransfer | ||
{ | ||
/** @var \Generated\Shared\Transfer\OrderTransfer $orderTransfer */ | ||
$orderTransfer = $mailTransfer->getOrderOrFail(); | ||
|
||
return $mailTransfer | ||
->setSubject(static::GLOSSARY_KEY_MAIL_SUBJECT) | ||
->setSubjectTranslationParameters([static::PARAMETER_ORDER_REFERENCE => $orderTransfer->getOrderReferenceOrFail()]) | ||
->addTemplate( | ||
(new MailTemplateTransfer()) | ||
->setName(static::MAIL_TEMPLATE_HTML) | ||
->setIsHtml(true), | ||
) | ||
->addTemplate( | ||
(new MailTemplateTransfer()) | ||
->setName(static::MAIL_TEMPLATE_TEXT) | ||
->setIsHtml(false), | ||
) | ||
->addRecipient( | ||
(new MailRecipientTransfer()) | ||
->setEmail($orderTransfer->getEmailOrFail()) | ||
->setName(sprintf('%s %s', $orderTransfer->getFirstName(), $orderTransfer->getLastName())), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters