From 344603123a5eb20a21fdf0c4073c290a8e013389 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 11 Aug 2024 09:27:13 +1000 Subject: [PATCH] Small fixes for payment email logic --- app/Jobs/Payment/EmailPayment.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Jobs/Payment/EmailPayment.php b/app/Jobs/Payment/EmailPayment.php index 1e93c099181d..5906cce74b17 100644 --- a/app/Jobs/Payment/EmailPayment.php +++ b/app/Jobs/Payment/EmailPayment.php @@ -58,10 +58,6 @@ class EmailPayment implements ShouldQueue */ public function handle() { - if ($this->company->is_disabled || (!$this->contact?->email ?? false)) { - nlog("company disabled - or - contact email not found"); - return; - } MultiDB::setDb($this->company->db); @@ -71,6 +67,11 @@ class EmailPayment implements ShouldQueue $this->contact = $this->payment->client->contacts()->orderBy('is_primary', 'desc')->first(); } + if ($this->company->is_disabled || (!$this->contact?->email ?? false)) { + nlog("company disabled - or - contact email not found"); + return; + } + $this->contact->load('client'); $email_builder = (new PaymentEmailEngine($this->payment, $this->contact))->build();