mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 16:31:33 +02:00
Fixes for email payment
This commit is contained in:
parent
e302b9f9cb
commit
7955548b87
@ -11,20 +11,15 @@
|
||||
|
||||
namespace App\Services\Payment;
|
||||
|
||||
use App\Models\Payment;
|
||||
use App\Models\ClientContact;
|
||||
use App\Jobs\Payment\EmailPayment;
|
||||
|
||||
class SendEmail
|
||||
{
|
||||
public $payment;
|
||||
|
||||
public $contact;
|
||||
|
||||
public function __construct($payment, $contact)
|
||||
{
|
||||
$this->payment = $payment;
|
||||
|
||||
$this->contact = $contact;
|
||||
}
|
||||
public function __construct(public Payment $payment, public ?ClientContact $contact)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Builds the correct template to send.
|
||||
@ -34,12 +29,13 @@ class SendEmail
|
||||
{
|
||||
$this->payment->load('company', 'client.contacts', 'invoices');
|
||||
|
||||
$contact = $this->payment->client->contacts()->first();
|
||||
if(!$this->contact)
|
||||
$this->contact = $this->payment->client->contacts()->first();
|
||||
|
||||
// $this->payment->invoices->sortByDesc('id')->first(function ($invoice) {
|
||||
// $invoice->invitations->each(function ($invitation) {
|
||||
// if (!$invitation->contact->trashed() && $invitation->contact->email) {
|
||||
EmailPayment::dispatch($this->payment, $this->payment->company, $contact);
|
||||
EmailPayment::dispatch($this->payment, $this->payment->company, $this->contact);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
Loading…
Reference in New Issue
Block a user