From ae357efaeb797698761fed99cf8b46fd89b73776 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 13 Jun 2017 12:03:13 +0300 Subject: [PATCH] Roll back notification queue changes --- app/Listeners/NotificationListener.php | 47 ++++++++++++++++++++------ 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/app/Listeners/NotificationListener.php b/app/Listeners/NotificationListener.php index f0377c83f8f1..df6882d4e871 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 @@ -37,7 +63,7 @@ class NotificationListener public function emailedInvoice(InvoiceWasEmailed $event) { $this->sendEmails($event->invoice, 'sent', null, $event->notes); - 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', null, $event->notes); - 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'); } }