Add basic interface for MailerMethod

[MAILPOET-4115]
This commit is contained in:
Rostislav Wolny
2022-03-24 14:53:17 +01:00
committed by Veljko V
parent eb07872d13
commit b10c30a7b1
7 changed files with 19 additions and 12 deletions

View File

@ -7,7 +7,7 @@ use MailPoet\Mailer\Methods\Common\BlacklistCheck;
use MailPoet\Mailer\Methods\ErrorMappers\SendGridMapper;
use MailPoet\WP\Functions as WPFunctions;
class SendGrid {
class SendGrid implements MailerMethod {
public $url = 'https://api.sendgrid.com/api/mail.send.json';
public $apiKey;
public $sender;
@ -35,7 +35,7 @@ class SendGrid {
$this->blacklist = new BlacklistCheck();
}
public function send($newsletter, $subscriber, $extraParams = []) {
public function send($newsletter, $subscriber, $extraParams = []): array {
if ($this->blacklist->isBlacklisted($subscriber)) {
$error = $this->errorMapper->getBlacklistError($subscriber);
return Mailer::formatMailerErrorResult($error);