Skip to content

Commit

Permalink
Create MailjetMail on each new call
Browse files Browse the repository at this point in the history
  • Loading branch information
kpitn committed Oct 31, 2019
1 parent 40744da commit 6e9a95c
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions Model/Mail/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Magento\Framework\Mail\TransportInterface;
use Magento\Framework\Serialize\Serializer\Json;
use Web200\Mailjet\Helper\Config;
use Web200\Mailjet\Logger\Logger;
use Web200\Mailjet\Model\Store as StoreModel;
use Web200\Mailjet\Model\Webservice\Email as MailjetEmail;
use Zend\Mail\Address as ZendMailAddress;
Expand Down Expand Up @@ -34,22 +35,31 @@ class Api
* @var StoreModel
*/
protected $storeModel;
/**
* Description $logger field
*
* @var Logger $logger
*/
protected $logger;

/**
* Api constructor.
*
* @param Json $json
* @param StoreModel $storeModel
* @param Config $config
* @param Json $json
* @param StoreModel $storeModel
* @param Config $config
* @param Logger $logger
*/
public function __construct(
Json $json,
StoreModel $storeModel,
Config $config
Config $config,
Logger $logger
) {
$this->json = $json;
$this->config = $config;
$this->storeModel = $storeModel;
$this->json = $json;
$this->config = $config;
$this->storeModel = $storeModel;
$this->logger = $logger;
}

/**
Expand All @@ -62,7 +72,7 @@ public function sendMail(TransportInterface $transport)
$templateId = 0;
$mailVariables = [];

$mailjetEmail = new MailjetEmail();
$mailjetEmail = new MailjetEmail($this->logger, $this->config);
$mailjetEmail->setStoreId($this->storeModel->getStoreId());

$message = Message::fromString($transport->getMessage()->getRawMessage());
Expand Down

0 comments on commit 6e9a95c

Please sign in to comment.