mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 19:04:41 -04:00
Merge pull request #6118 from beganovich/v5-2306-ach-improvements
Add "complete verification" button in the ACH verification email
This commit is contained in:
commit
fa4aa83638
@ -25,14 +25,21 @@ class ACHVerificationNotification extends Mailable
|
|||||||
*/
|
*/
|
||||||
public $company;
|
public $company;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(Company $company)
|
public function __construct(Company $company, string $url)
|
||||||
{
|
{
|
||||||
$this->company = $company;
|
$this->company = $company;
|
||||||
|
|
||||||
|
$this->url = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +68,7 @@ class ACH
|
|||||||
$client_gateway_token = $this->storePaymentMethod($source, $request->input('method'), $customer);
|
$client_gateway_token = $this->storePaymentMethod($source, $request->input('method'), $customer);
|
||||||
|
|
||||||
$mailer = new NinjaMailerObject();
|
$mailer = new NinjaMailerObject();
|
||||||
$mailer->mailable = new ACHVerificationNotification(auth('contact')->user()->client->company);
|
$mailer->mailable = new ACHVerificationNotification(auth('contact')->user()->client->company, route('client.payment_methods.verification', ['payment_method' => $client_gateway_token->hashed_id, 'method' => GatewayType::BANK_TRANSFER]));
|
||||||
$mailer->company = auth('contact')->user()->client->company;
|
$mailer->company = auth('contact')->user()->client->company;
|
||||||
$mailer->settings = auth('contact')->user()->client->company->settings;
|
$mailer->settings = auth('contact')->user()->client->company->settings;
|
||||||
$mailer->to_user = auth('contact')->user();
|
$mailer->to_user = auth('contact')->user();
|
||||||
@ -80,6 +80,12 @@ class ACH
|
|||||||
|
|
||||||
public function verificationView(ClientGatewayToken $token)
|
public function verificationView(ClientGatewayToken $token)
|
||||||
{
|
{
|
||||||
|
if (isset($token->meta->state) && $token->meta->state === 'authorized') {
|
||||||
|
return redirect()
|
||||||
|
->route('client.payment_methods.show', $token->hashed_id)
|
||||||
|
->with('message', __('texts.payment_method_verified'));
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'gateway' => $this->stripe,
|
'gateway' => $this->stripe,
|
||||||
@ -88,8 +94,14 @@ class ACH
|
|||||||
return render('gateways.stripe.ach.verify', $data);
|
return render('gateways.stripe.ach.verify', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processVerification(VerifyPaymentMethodRequest $request, ClientGatewayToken $token)
|
public function processVerification($request, ClientGatewayToken $token)
|
||||||
{
|
{
|
||||||
|
if (isset($token->meta->state) && $token->meta->state === 'authorized') {
|
||||||
|
return redirect()
|
||||||
|
->route('client.payment_methods.show', $token->hashed_id)
|
||||||
|
->with('message', __('texts.payment_method_verified'));
|
||||||
|
}
|
||||||
|
|
||||||
$this->stripe->init();
|
$this->stripe->init();
|
||||||
|
|
||||||
$bank_account = Customer::retrieveSource($request->customer, $request->source, $this->stripe->stripe_connect_auth);
|
$bank_account = Customer::retrieveSource($request->customer, $request->source, $this->stripe->stripe_connect_auth);
|
||||||
@ -97,12 +109,14 @@ class ACH
|
|||||||
try {
|
try {
|
||||||
$bank_account->verify(['amounts' => request()->transactions]);
|
$bank_account->verify(['amounts' => request()->transactions]);
|
||||||
|
|
||||||
$token->meta->verified_at = now();
|
$meta = $token->meta;
|
||||||
|
$meta->state = 'authorized';
|
||||||
|
$token->meta = $meta;
|
||||||
$token->save();
|
$token->save();
|
||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('client.invoices.index')
|
->route('client.payment_methods.show', $token->hashed_id)
|
||||||
->with('success', __('texts.payment_method_verified'));
|
->with('message', __('texts.payment_method_verified'));
|
||||||
} catch (CardException $e) {
|
} catch (CardException $e) {
|
||||||
return back()->with('error', $e->getMessage());
|
return back()->with('error', $e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -2,5 +2,7 @@
|
|||||||
<div class="center">
|
<div class="center">
|
||||||
<h1>{{ ctrans('texts.ach_verification_notification_label') }}</h1>
|
<h1>{{ ctrans('texts.ach_verification_notification_label') }}</h1>
|
||||||
<p>{{ ctrans('texts.ach_verification_notification') }}</p>
|
<p>{{ ctrans('texts.ach_verification_notification') }}</p>
|
||||||
|
|
||||||
|
<a class="button" href="{{ $url }}">{{ ctrans('texts.complete_verification') }}</a>
|
||||||
</div>
|
</div>
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user