Fixes for mailers

This commit is contained in:
David Bomba 2020-08-08 14:38:02 +10:00
parent 731001baf5
commit 6840e3e471
7 changed files with 10 additions and 69 deletions

View File

@ -76,7 +76,8 @@ class EmailCredit extends BaseMailerJob implements ShouldQueue
if (count(Mail::failures()) > 0) {
event(new CreditWasEmailedAndFailed($this->credit, $this->credit->company, Mail::failures(), Ninja::eventVars()));
return $this->logMailError($errors);
return $this->logMailError(Mail::failures(), $this->credit->client);
}
//fire any events

View File

@ -80,18 +80,9 @@ class EmailInvoice extends BaseMailerJob implements ShouldQueue
);
if (count(Mail::failures()) > 0) {
return $this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->invoice->client);
}
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->invoice->client
);
}
}

View File

@ -83,21 +83,12 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
//catch errors
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->payment->client);
}
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->payment->client
);
}
}

View File

@ -82,21 +82,11 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
//catch errors
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->entity->client);
}
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->entity->client
);
}
}

View File

@ -83,21 +83,11 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue
//catch errors
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->invoice->client);
}
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->invoice->client
);
}
}

View File

@ -93,7 +93,7 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue
//catch errors
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->client);
}
}
@ -102,16 +102,5 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->client
);
}
}

View File

@ -72,7 +72,7 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue
//Catch errors and report.
if (count(Mail::failures()) > 0) {
$this->logMailError(Mail::failures());
return $this->logMailError(Mail::failures(), $this->company);
}
}
@ -94,15 +94,4 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue
];
}
private function logMailError($errors)
{
SystemLogger::dispatch(
$errors,
SystemLog::CATEGORY_MAIL,
SystemLog::EVENT_MAIL_SEND,
SystemLog::TYPE_FAILURE,
$this->company
);
}
}