diff --git a/app/Http/Controllers/ClientPortal/PaymentMethodController.php b/app/Http/Controllers/ClientPortal/PaymentMethodController.php index 1ed3c9c00453..53fde312a8e1 100644 --- a/app/Http/Controllers/ClientPortal/PaymentMethodController.php +++ b/app/Http/Controllers/ClientPortal/PaymentMethodController.php @@ -89,29 +89,6 @@ class PaymentMethodController extends Controller ]); } - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return void - */ - public function edit($id) - { - // - } - - /** - * Update the specified resource in storage. - * - * @param Request $request - * @param int $id - * @return void - */ - public function update(Request $request, $id) - { - // - } - public function verify(ClientGatewayToken $payment_method) { $gateway = $this->getClientGateway(); @@ -151,7 +128,7 @@ class PaymentMethodController extends Controller event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars())); $payment_method->delete(); } catch (Exception $e) { - + nlog($e->getMessage()); return back(); diff --git a/app/Mail/Gateways/ACHVerificationNotification.php b/app/Mail/Gateways/ACHVerificationNotification.php new file mode 100644 index 000000000000..69bf8b30e494 --- /dev/null +++ b/app/Mail/Gateways/ACHVerificationNotification.php @@ -0,0 +1,43 @@ +view('email.gateways.ach-verification-notification'); + } +} diff --git a/app/PaymentDrivers/Stripe/ACH.php b/app/PaymentDrivers/Stripe/ACH.php index 3d991a7eddee..330ae6fdafcd 100644 --- a/app/PaymentDrivers/Stripe/ACH.php +++ b/app/PaymentDrivers/Stripe/ACH.php @@ -14,8 +14,11 @@ namespace App\PaymentDrivers\Stripe; use App\Exceptions\PaymentFailed; use App\Http\Requests\Request; +use App\Jobs\Mail\NinjaMailerJob; +use App\Jobs\Mail\NinjaMailerObject; use App\Jobs\Mail\PaymentFailureMailer; use App\Jobs\Util\SystemLogger; +use App\Mail\Gateways\ACHVerificationNotification; use App\Models\ClientGatewayToken; use App\Models\GatewayType; use App\Models\Payment; @@ -47,7 +50,7 @@ class ACH return render('gateways.stripe.ach.authorize', array_merge($data)); } - public function authorizeResponse($request) + public function authorizeResponse(Request $request) { $this->stripe->init(); @@ -63,6 +66,14 @@ class ACH $client_gateway_token = $this->storePaymentMethod($source, $request->input('method'), $customer); + $mailer = new NinjaMailerObject(); + $mailer->mailable = new ACHVerificationNotification(); + $mailer->company = auth('contact')->user()->client->company; + $mailer->settings = auth('contact')->user()->client->company->settings; + $mailer->to_user = auth('contact')->user(); + + NinjaMailerJob::dispatchNow($mailer); + return redirect()->route('client.payment_methods.verification', ['payment_method' => $client_gateway_token->hashed_id, 'method' => GatewayType::BANK_TRANSFER]); } diff --git a/resources/views/email/gateways/ach-verification-notification.blade.php b/resources/views/email/gateways/ach-verification-notification.blade.php new file mode 100644 index 000000000000..ffc804d990ba --- /dev/null +++ b/resources/views/email/gateways/ach-verification-notification.blade.php @@ -0,0 +1,14 @@ +@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!

+@endcomponent diff --git a/routes/client.php b/routes/client.php index 8ddac89510a8..fb228c2e7688 100644 --- a/routes/client.php +++ b/routes/client.php @@ -54,7 +54,7 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence Route::get('payment_methods/{payment_method}/verification', 'ClientPortal\PaymentMethodController@verify')->name('payment_methods.verification'); Route::post('payment_methods/{payment_method}/verification', 'ClientPortal\PaymentMethodController@processVerification'); - Route::resource('payment_methods', 'ClientPortal\PaymentMethodController'); // name = (payment_methods. index / create / show / update / destroy / edit + Route::resource('payment_methods', 'ClientPortal\PaymentMethodController')->except(['edit', 'update']); // name = (payment_methods. index / create / show / update / destroy / edit Route::match(['GET', 'POST'], 'quotes/approve', 'ClientPortal\QuoteController@bulk')->name('quotes.bulk'); Route::get('quotes', 'ClientPortal\QuoteController@index')->name('quotes.index')->middleware('portal_enabled');