diff --git a/app/Listeners/NotificationListener.php b/app/Listeners/NotificationListener.php index df6882d4e871..f0377c83f8f1 100644 --- a/app/Listeners/NotificationListener.php +++ b/app/Listeners/NotificationListener.php @@ -1,46 +1,20 @@ userMailer = $userMailer; - $this->contactMailer = $contactMailer; - $this->pushService = $pushService; - } - /** * @param $invoice * @param $type @@ -63,7 +37,7 @@ class NotificationListener public function emailedInvoice(InvoiceWasEmailed $event) { $this->sendEmails($event->invoice, 'sent', null, $event->notes); - $this->pushService->sendNotification($event->invoice, 'sent'); + dispatch(new SendPushNotification($event->invoice, 'sent')); } /** @@ -72,7 +46,7 @@ class NotificationListener public function emailedQuote(QuoteWasEmailed $event) { $this->sendEmails($event->quote, 'sent', null, $event->notes); - $this->pushService->sendNotification($event->quote, 'sent'); + dispatch(new SendPushNotification($event->quote, 'sent')); } /** @@ -85,7 +59,7 @@ class NotificationListener } $this->sendEmails($event->invoice, 'viewed'); - $this->pushService->sendNotification($event->invoice, 'viewed'); + dispatch(new SendPushNotification($event->invoice, 'viewed')); } /** @@ -98,7 +72,7 @@ class NotificationListener } $this->sendEmails($event->quote, 'viewed'); - $this->pushService->sendNotification($event->quote, 'viewed'); + dispatch(new SendPushNotification($event->quote, 'viewed')); } /** @@ -107,7 +81,7 @@ class NotificationListener public function approvedQuote(QuoteInvitationWasApproved $event) { $this->sendEmails($event->quote, 'approved'); - $this->pushService->sendNotification($event->quote, 'approved'); + dispatch(new SendPushNotification($event->quote, 'approved')); } /** @@ -120,10 +94,9 @@ class NotificationListener return; } - $this->contactMailer->sendPaymentConfirmation($event->payment); $this->sendEmails($event->payment->invoice, 'paid', $event->payment); - - $this->pushService->sendNotification($event->payment->invoice, 'paid'); + dispatch(new SendPaymentEmail($event->payment)); + dispatch(new SendPushNotification($event->payment->invoice, 'paid')); } }