From c1bf578658b4d99f16f51f6297887675710855ef Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 14 Mar 2022 14:39:44 +1100 Subject: [PATCH] Refund payment receipts --- app/Jobs/Payment/EmailRefundPayment.php | 4 ++-- app/Services/Payment/RefundPayment.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Jobs/Payment/EmailRefundPayment.php b/app/Jobs/Payment/EmailRefundPayment.php index 6096061f6eef..8539cceb550c 100644 --- a/app/Jobs/Payment/EmailRefundPayment.php +++ b/app/Jobs/Payment/EmailRefundPayment.php @@ -83,8 +83,8 @@ class EmailRefundPayment implements ShouldQueue App::setLocale($this->contact->preferredLocale()); $t->replace(Ninja::transformTranslations($this->settings)); - $template_data['body'] = ''; - $template_data['subject'] = ''; + $template_data['body'] = ctrans('texts.refunded_payment') . ' $amount

$invoices'; + $template_data['subject'] = ctrans('texts.refunded_payment'); $email_builder = (new PaymentEmailEngine($this->payment, $this->contact, $template_data))->build(); diff --git a/app/Services/Payment/RefundPayment.php b/app/Services/Payment/RefundPayment.php index c63ebc383404..cdf86f2d0f9b 100644 --- a/app/Services/Payment/RefundPayment.php +++ b/app/Services/Payment/RefundPayment.php @@ -15,6 +15,7 @@ use App\Exceptions\PaymentRefundFailed; use App\Factory\CreditFactory; use App\Factory\InvoiceItemFactory; use App\Jobs\Ninja\TransactionLog; +use App\Jobs\Payment\EmailRefundPayment; use App\Models\Activity; use App\Models\Credit; use App\Models\Invoice; @@ -66,7 +67,10 @@ class RefundPayment if(array_key_exists('email_receipt', $this->refund_data) && $this->refund_data['email_receipt'] == 'true'){ - // $this->payment->service()->sendEmail(); + + $contact = $this->payment->client->contacts()->whereNotNull('email')->first(); + EmailRefundPayment::dispatch($this->payment, $this->payment->company, $contact); + } $transaction = [