app/Mail/Gateways/ACHVerificationNotification.php

This commit is contained in:
Benjamin Beganović 2021-06-09 16:38:24 +02:00
parent d3fcb77e49
commit ae66496711
5 changed files with 25 additions and 22 deletions

View File

@ -12,23 +12,27 @@
namespace App\Mail\Gateways;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Models\Company;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class ACHVerificationNotification extends Mailable
{
use Queueable, SerializesModels;
use SerializesModels;
/**
* @var Company
*/
public $company;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
public function __construct(Company $company)
{
//
$this->company = $company;
}
/**
@ -38,6 +42,11 @@ class ACHVerificationNotification extends Mailable
*/
public function build()
{
return $this->view('email.gateways.ach-verification-notification');
return $this
->subject(ctrans('texts.ach_verification_notification_label'))
->view('email.gateways.ach-verification-notification', [
'logo' => $this->company->present()->logo(),
'settings' => $this->company->settings,
]);
}
}

View File

@ -67,12 +67,12 @@ class ACH
$client_gateway_token = $this->storePaymentMethod($source, $request->input('method'), $customer);
$mailer = new NinjaMailerObject();
$mailer->mailable = new ACHVerificationNotification();
$mailer->mailable = new ACHVerificationNotification(auth('contact')->user()->client->company);
$mailer->company = auth('contact')->user()->client->company;
$mailer->settings = auth('contact')->user()->client->company->settings;
$mailer->to_user = auth('contact')->user();
NinjaMailerJob::dispatchNow($mailer);
NinjaMailerJob::dispatch($mailer);
return redirect()->route('client.payment_methods.verification', ['payment_method' => $client_gateway_token->hashed_id, 'method' => GatewayType::BANK_TRANSFER]);
}

View File

@ -4254,6 +4254,8 @@ $LANG = array(
'account_passwordless_login' => 'Account passwordless login',
'user_duplicate_error' => 'Cannot add the same user to the same company',
'user_cross_linked_error' => 'User exists but cannot be crossed linked to multiple accounts',
'ach_verification_notification_label' => 'ACH verification',
'ach_verification_notification' => 'Connecting bank accounts require verification. Stripe will automatically sends two small deposits for this purpose. These deposits take 1-2 business days to appear on the customer\'s online statement.'
);
return $LANG;

View File

@ -1,14 +1,6 @@
@component('email.template.master', ['design' => 'light'])
@slot('header')
@include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png'])
@endslot
<p>Hello,</p>
<p>Connecting bank accounts require verification. Stripe will automatically sends two
small deposits for this purpose. These deposits take 1-2 business days to appear on the customer's online
statement.
</p>
<p>Thank you!</p>
@component('email.template.admin', ['logo' => $logo, 'settings' => $settings])
<div class="center">
<h1>{{ ctrans('texts.ach_verification_notification_label') }}</h1>
<p>{{ ctrans('texts.ach_verification_notification') }}</p>
</div>
@endcomponent

View File

@ -17,7 +17,7 @@
supported-color-schemes: light dark;
}
@if($settings->email_style === 'dark')
@if(isset($settings) && $settings->email_style === 'dark')
body,
[data-ogsc] {
background-color: #1a1a1a !important;