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();