1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Client payment failure emails

This commit is contained in:
David Bomba 2021-10-26 14:44:34 +11:00
parent b8e81df058
commit 70e0a1db52
3 changed files with 24 additions and 5 deletions

View File

@ -15,6 +15,7 @@ use App\Jobs\Mail\NinjaMailer;
use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Mail\NinjaMailerObject;
use App\Libraries\MultiDB;
use App\Mail\Admin\ClientPaymentFailureObject;
use App\Mail\Admin\EntityNotificationMailer;
use App\Mail\Admin\PaymentFailureObject;
use App\Models\Client;
@ -102,6 +103,24 @@ class PaymentFailedMailer implements ShouldQueue
});
//add client payment failures here.
nlog("pre client failure email");
if($contact = $this->client->primary_contact()->first())
{
nlog("inside failure");
$mail_obj = (new ClientPaymentFailureObject($this->client, $this->error, $this->company, $this->payment_hash))->build();
$nmo = new NinjaMailerObject;
$nmo->mailable = new NinjaMailer($mail_obj);
$nmo->company = $this->company;
$nmo->to_user = $contact;
$nmo->settings = $settings;
NinjaMailerJob::dispatch($nmo);
}
}

View File

@ -14,7 +14,6 @@ namespace App\Mail\Admin;
use App\Models\Invoice;
use App\Utils\HtmlEngine;
use App\Utils\Ninja;
use App\Utils\Number;
use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\App;
use stdClass;
@ -91,7 +90,7 @@ class ClientPaymentFailureObject
return
ctrans(
'texts.notification_invoice_payment_failed_subject',
['invoice' => $this->client->present()->name()]
['invoice' => implode(",", $this->invoices->pluck('number')->toArray())]
);
}
@ -110,7 +109,7 @@ class ClientPaymentFailureObject
]
),
'greeting' => ctrans('texts.email_salutation', ['name' => $this->client->present()->name]),
'message' => $this->error,
'message' => ctrans('texts.client_payment_failure_body', ['invoice' => implode(",", $this->invoices->pluck('number')->toArray()), 'amount' => $this->getAmount()]),
'signature' => $signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->client->getMergedSettings(),

View File

@ -1400,7 +1400,7 @@ $LANG = array(
'more_options' => 'More options',
'credit_card' => 'Credit Card',
'bank_transfer' => 'Bank Transfer',
'no_transaction_reference' => 'We did not recieve a payment transaction reference from the gateway.',
'no_transaction_reference' => 'We did not receive a payment transaction reference from the gateway.',
'use_bank_on_file' => 'Use Bank on File',
'auto_bill_email_message' => 'This invoice will automatically be billed to the payment method on file on the due date.',
'bitcoin' => 'Bitcoin',
@ -4334,7 +4334,8 @@ $LANG = array(
'clone_to_expense' => 'Clone to expense',
'checkout' => 'Checkout',
'acss' => 'Pre-authorized debit payments',
'invalid_amount' => 'Invalid amount. Number/Decimal values only.'
'invalid_amount' => 'Invalid amount. Number/Decimal values only.',
'client_payment_failure_body' => 'Payment for Invoice :invoice for amount :amount failed.',
);
return $LANG;