Extract email authorization error messages from bridge to strings
As a part of those changes I tried to unify the array key with error messages. [MAILPOET-4639]
This commit is contained in:
@@ -7,7 +7,7 @@ use MailPoet\Mailer\Mailer;
|
||||
use MailPoet\Mailer\MailerError;
|
||||
use MailPoet\Mailer\MailerLog;
|
||||
use MailPoet\Newsletter\NewslettersRepository;
|
||||
use MailPoet\Services\AuthorizedSenderDomainController;
|
||||
use MailPoet\Services\Bridge\API;
|
||||
use MailPoet\Settings\SettingsController;
|
||||
use MailPoet\Util\Helpers;
|
||||
|
||||
@@ -95,13 +95,12 @@ class AuthorizedEmailsController {
|
||||
throw new \InvalidArgumentException(self::AUTHORIZED_EMAIL_ERROR_PENDING_CONFIRMATION);
|
||||
}
|
||||
|
||||
$finalData = $this->bridge->createAuthorizedEmailAddress($email);
|
||||
|
||||
if ($finalData && isset($finalData['error'])) {
|
||||
throw new \InvalidArgumentException($finalData['error']);
|
||||
$response = $this->bridge->createAuthorizedEmailAddress($email);
|
||||
if ($response['status'] === API::AUTHORIZED_EMAIL_STATUS_ERROR) {
|
||||
throw new \InvalidArgumentException($response['message']);
|
||||
}
|
||||
|
||||
return $finalData;
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function isEmailAddressAuthorized(string $email): bool {
|
||||
|
Reference in New Issue
Block a user