Small fixes for payment email logic

This commit is contained in:
David Bomba 2024-08-11 09:27:13 +10:00
parent 489476feeb
commit 344603123a

View File

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