diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index e6bc57408d6d..ea9838358515 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -615,7 +615,7 @@ class PaymentController extends BaseController } break; case 'email_receipt': - $this->payment->service()->sendEmail(); + $payment->service()->sendEmail(); if (! $bulk) { return $this->itemResponse($payment); diff --git a/app/Services/Payment/SendEmail.php b/app/Services/Payment/SendEmail.php index 770b54de7248..04c8e2da6da8 100644 --- a/app/Services/Payment/SendEmail.php +++ b/app/Services/Payment/SendEmail.php @@ -36,14 +36,10 @@ class SendEmail $contact = $this->payment->client->contacts()->first(); - // if ($contact?->email) - // EmailPayment::dispatch($this->payment, $this->payment->company, $contact)->delay(now()->addSeconds(2)); - - $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, $invitation->contact)->delay(now()->addSeconds(2)); + EmailPayment::dispatch($this->payment, $this->payment->company, $invitation->contact); } }); });