mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Uses queue when sending email through API
This commit is contained in:
parent
b110702487
commit
640d9323a2
@ -200,15 +200,13 @@ class InvoiceApiController extends BaseAPIController
|
|||||||
|
|
||||||
if ($isEmailInvoice) {
|
if ($isEmailInvoice) {
|
||||||
if ($payment) {
|
if ($payment) {
|
||||||
app('App\Ninja\Mailers\ContactMailer')->sendPaymentConfirmation($payment);
|
$this->dispatch(new SendPaymentEmail($payment));
|
||||||
//$this->dispatch(new SendPaymentEmail($payment));
|
|
||||||
} else {
|
} else {
|
||||||
if ($invoice->is_recurring && $recurringInvoice = $this->invoiceRepo->createRecurringInvoice($invoice)) {
|
if ($invoice->is_recurring && $recurringInvoice = $this->invoiceRepo->createRecurringInvoice($invoice)) {
|
||||||
$invoice = $recurringInvoice;
|
$invoice = $recurringInvoice;
|
||||||
}
|
}
|
||||||
$reminder = isset($data['email_type']) ? $data['email_type'] : false;
|
$reminder = isset($data['email_type']) ? $data['email_type'] : false;
|
||||||
app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice, $reminder);
|
$this->dispatch(new SendInvoiceEmail($invoice, auth()->user()->id, $reminder));
|
||||||
//$this->dispatch(new SendInvoiceEmail($invoice));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,11 +333,13 @@ class InvoiceApiController extends BaseAPIController
|
|||||||
$invoice = $recurringInvoice;
|
$invoice = $recurringInvoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
//$this->dispatch(new SendInvoiceEmail($invoice));
|
if (config('queue.default') !== 'sync') {
|
||||||
$result = app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice);
|
$this->dispatch(new SendInvoiceEmail($invoice, auth()->user()->id));
|
||||||
|
} else {
|
||||||
if ($result !== true) {
|
$result = app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice);
|
||||||
return $this->errorResponse($result, 500);
|
if ($result !== true) {
|
||||||
|
return $this->errorResponse($result, 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = Utils::getApiHeaders();
|
$headers = Utils::getApiHeaders();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user