From ae66496711ffe24f0b1db2de907b6546089d6341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Wed, 9 Jun 2021 16:38:24 +0200 Subject: [PATCH] app/Mail/Gateways/ACHVerificationNotification.php --- .../Gateways/ACHVerificationNotification.php | 21 +++++++++++++------ app/PaymentDrivers/Stripe/ACH.php | 4 ++-- resources/lang/en/texts.php | 2 ++ .../ach-verification-notification.blade.php | 18 +++++----------- .../views/email/template/admin.blade.php | 2 +- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/app/Mail/Gateways/ACHVerificationNotification.php b/app/Mail/Gateways/ACHVerificationNotification.php index 69bf8b30e494..b15709d6386e 100644 --- a/app/Mail/Gateways/ACHVerificationNotification.php +++ b/app/Mail/Gateways/ACHVerificationNotification.php @@ -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, + ]); } } diff --git a/app/PaymentDrivers/Stripe/ACH.php b/app/PaymentDrivers/Stripe/ACH.php index 3dfe09459170..7cbac39e17d0 100644 --- a/app/PaymentDrivers/Stripe/ACH.php +++ b/app/PaymentDrivers/Stripe/ACH.php @@ -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]); } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index e329553bd1f9..69c9a65459c4 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -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; diff --git a/resources/views/email/gateways/ach-verification-notification.blade.php b/resources/views/email/gateways/ach-verification-notification.blade.php index ffc804d990ba..d03b3e64f50d 100644 --- a/resources/views/email/gateways/ach-verification-notification.blade.php +++ b/resources/views/email/gateways/ach-verification-notification.blade.php @@ -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 - -

Hello,

- -

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. -

- -

Thank you!

+@component('email.template.admin', ['logo' => $logo, 'settings' => $settings]) +
+

{{ ctrans('texts.ach_verification_notification_label') }}

+

{{ ctrans('texts.ach_verification_notification') }}

+
@endcomponent diff --git a/resources/views/email/template/admin.blade.php b/resources/views/email/template/admin.blade.php index a7769219b8c8..3f269ddaa2b2 100644 --- a/resources/views/email/template/admin.blade.php +++ b/resources/views/email/template/admin.blade.php @@ -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;