diff --git a/app/Constants.php b/app/Constants.php index 92a49a54bf..2f4bfff16b 100644 --- a/app/Constants.php +++ b/app/Constants.php @@ -292,7 +292,7 @@ if (!defined('APP_NAME')) define('NINJA_APP_URL', env('NINJA_APP_URL', 'https://app.invoiceninja.com')); define('NINJA_DOCS_URL', env('NINJA_DOCS_URL', 'http://docs.invoiceninja.com/en/latest')); define('NINJA_DATE', '2000-01-01'); - define('NINJA_VERSION', '3.0.0' . env('NINJA_VERSION_SUFFIX')); + define('NINJA_VERSION', '3.0.1' . env('NINJA_VERSION_SUFFIX')); define('SOCIAL_LINK_FACEBOOK', env('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja')); define('SOCIAL_LINK_TWITTER', env('SOCIAL_LINK_TWITTER', 'https://twitter.com/invoiceninja')); diff --git a/app/Http/Controllers/InvoiceApiController.php b/app/Http/Controllers/InvoiceApiController.php index ce38734ff3..a408f6e6df 100644 --- a/app/Http/Controllers/InvoiceApiController.php +++ b/app/Http/Controllers/InvoiceApiController.php @@ -185,9 +185,11 @@ class InvoiceApiController extends BaseAPIController if ($isEmailInvoice) { if ($payment) { - $this->dispatch(new SendPaymentEmail($payment)); + app('App\Ninja\Mailers\ContactMailer')->sendPaymentConfirmation($payment); + //$this->dispatch(new SendPaymentEmail($payment)); } elseif ( ! $invoice->is_recurring) { - $this->dispatch(new SendInvoiceEmail($invoice)); + app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice); + //$this->dispatch(new SendInvoiceEmail($invoice)); } } diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 702e47df38..0964d17b15 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -415,8 +415,9 @@ class InvoiceController extends BaseController if ($invoice->is_recurring) { $response = $this->emailRecurringInvoice($invoice); } else { - $this->dispatch(new SendInvoiceEmail($invoice, false, $pdfUpload)); - return true; + return app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice, false, $pdfUpload); + //$this->dispatch(new SendInvoiceEmail($invoice, false, $pdfUpload)); + //return true; } if ($response === true) { @@ -446,8 +447,9 @@ class InvoiceController extends BaseController if ($invoice->isPaid()) { return true; } else { - $this->dispatch(new SendInvoiceEmail($invoice)); - return true; + return app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice); + //$this->dispatch(new SendInvoiceEmail($invoice)); + //return true; } } diff --git a/app/Listeners/NotificationListener.php b/app/Listeners/NotificationListener.php index 8772ef02e0..ad94e5767a 100644 --- a/app/Listeners/NotificationListener.php +++ b/app/Listeners/NotificationListener.php @@ -1,20 +1,46 @@ userMailer = $userMailer; + $this->contactMailer = $contactMailer; + $this->pushService = $pushService; + } + /** * @param $invoice * @param $type @@ -26,7 +52,7 @@ class NotificationListener { if ($user->{"notify_{$type}"}) { - dispatch(new SendNotificationEmail($user, $invoice, $type, $payment)); + $this->userMailer->sendNotification($user, $invoice, $type, $payment); } } } @@ -37,7 +63,7 @@ class NotificationListener public function emailedInvoice(InvoiceWasEmailed $event) { $this->sendEmails($event->invoice, 'sent'); - dispatch(new SendPushNotification($event->invoice, 'sent')); + $this->pushService->sendNotification($event->invoice, 'sent'); } /** @@ -46,7 +72,7 @@ class NotificationListener public function emailedQuote(QuoteWasEmailed $event) { $this->sendEmails($event->quote, 'sent'); - dispatch(new SendPushNotification($event->quote, 'sent')); + $this->pushService->sendNotification($event->quote, 'sent'); } /** @@ -59,7 +85,7 @@ class NotificationListener } $this->sendEmails($event->invoice, 'viewed'); - dispatch(new SendPushNotification($event->invoice, 'viewed')); + $this->pushService->sendNotification($event->invoice, 'viewed'); } /** @@ -72,7 +98,7 @@ class NotificationListener } $this->sendEmails($event->quote, 'viewed'); - dispatch(new SendPushNotification($event->quote, 'viewed')); + $this->pushService->sendNotification($event->quote, 'viewed'); } /** @@ -81,7 +107,7 @@ class NotificationListener public function approvedQuote(QuoteInvitationWasApproved $event) { $this->sendEmails($event->quote, 'approved'); - dispatch(new SendPushNotification($event->quote, 'approved')); + $this->pushService->sendNotification($event->quote, 'approved'); } /** @@ -94,9 +120,10 @@ class NotificationListener return; } + $this->contactMailer->sendPaymentConfirmation($event->payment); $this->sendEmails($event->payment->invoice, 'paid', $event->payment); - dispatch(new SendPaymentEmail($event->payment)); - dispatch(new SendPushNotification($event->payment->invoice, 'paid')); + + $this->pushService->sendNotification($event->payment->invoice, 'paid'); } } diff --git a/app/Ninja/Repositories/InvoiceRepository.php b/app/Ninja/Repositories/InvoiceRepository.php index 8b65765190..f720e91192 100644 --- a/app/Ninja/Repositories/InvoiceRepository.php +++ b/app/Ninja/Repositories/InvoiceRepository.php @@ -756,7 +756,8 @@ class InvoiceRepository extends BaseRepository */ public function emailInvoice(Invoice $invoice) { - dispatch(new SendInvoiceEmail($invoice)); + app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice); + //dispatch(new SendInvoiceEmail($invoice)); }