Uses queue when sending email through API
This commit is contained in:
parent
b110702487
commit
640d9323a2
1 changed files with 9 additions and 9 deletions
|
|
@ -200,15 +200,13 @@ class InvoiceApiController extends BaseAPIController
|
|||
|
||||
if ($isEmailInvoice) {
|
||||
if ($payment) {
|
||||
app('App\Ninja\Mailers\ContactMailer')->sendPaymentConfirmation($payment);
|
||||
//$this->dispatch(new SendPaymentEmail($payment));
|
||||
$this->dispatch(new SendPaymentEmail($payment));
|
||||
} else {
|
||||
if ($invoice->is_recurring && $recurringInvoice = $this->invoiceRepo->createRecurringInvoice($invoice)) {
|
||||
$invoice = $recurringInvoice;
|
||||
}
|
||||
$reminder = isset($data['email_type']) ? $data['email_type'] : false;
|
||||
app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice, $reminder);
|
||||
//$this->dispatch(new SendInvoiceEmail($invoice));
|
||||
$this->dispatch(new SendInvoiceEmail($invoice, auth()->user()->id, $reminder));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -335,11 +333,13 @@ class InvoiceApiController extends BaseAPIController
|
|||
$invoice = $recurringInvoice;
|
||||
}
|
||||
|
||||
//$this->dispatch(new SendInvoiceEmail($invoice));
|
||||
$result = app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice);
|
||||
|
||||
if ($result !== true) {
|
||||
return $this->errorResponse($result, 500);
|
||||
if (config('queue.default') !== 'sync') {
|
||||
$this->dispatch(new SendInvoiceEmail($invoice, auth()->user()->id));
|
||||
} else {
|
||||
$result = app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice);
|
||||
if ($result !== true) {
|
||||
return $this->errorResponse($result, 500);
|
||||
}
|
||||
}
|
||||
|
||||
$headers = Utils::getApiHeaders();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue