From af39d5e50cc41b34c31772f070b88833edc0baba Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 9 Nov 2020 21:26:36 +1100 Subject: [PATCH] Fixes for payment notifications --- app/Jobs/Mail/EntityPaidMailer.php | 8 ++++---- app/Listeners/Payment/PaymentNotification.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Jobs/Mail/EntityPaidMailer.php b/app/Jobs/Mail/EntityPaidMailer.php index b0defdc0cab9..62e0d462f8b3 100644 --- a/app/Jobs/Mail/EntityPaidMailer.php +++ b/app/Jobs/Mail/EntityPaidMailer.php @@ -53,11 +53,11 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue * @param $user * @param $company */ - public function __construct($payment, $company) + public function __construct($payment, $company, $user) { $this->company = $company; - $this->user = $payment->user; + $this->user = $user; $this->payment = $payment; @@ -84,7 +84,7 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue try { $mail_obj = (new EntityPaidObject($this->payment))->build(); - $mail_obj->from = [$this->payment->user->email, $this->payment->user->present()->name()]; + $mail_obj->from = [$this->user->email, $this->user->present()->name()]; //send email Mail::to($this->user->email) @@ -96,7 +96,7 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue } if (count(Mail::failures()) > 0) { - $this->logMailError(Mail::failures(), $this->entity->client); + $this->logMailError(Mail::failures(), $this->payment->client); } else { // $this->entityEmailSucceeded(); } diff --git a/app/Listeners/Payment/PaymentNotification.php b/app/Listeners/Payment/PaymentNotification.php index f57e070e0a1b..07f194170169 100644 --- a/app/Listeners/Payment/PaymentNotification.php +++ b/app/Listeners/Payment/PaymentNotification.php @@ -63,7 +63,7 @@ class PaymentNotification implements ShouldQueue if (($key = array_search('mail', $methods)) !== false) { unset($methods[$key]); - EntityPaidMailer::dispatch($payment, $payment->company); + EntityPaidMailer::dispatch($payment, $payment->company, $user); }