mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 13:14:30 -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;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Company $company)
|
||||
public function __construct(Company $company, string $url)
|
||||
{
|
||||
$this->company = $company;
|
||||
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ class ACH
|
||||
$client_gateway_token = $this->storePaymentMethod($source, $request->input('method'), $customer);
|
||||
|
||||
$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->settings = auth('contact')->user()->client->company->settings;
|
||||
$mailer->to_user = auth('contact')->user();
|
||||
@ -80,6 +80,12 @@ class ACH
|
||||
|
||||
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 = [
|
||||
'token' => $token,
|
||||
'gateway' => $this->stripe,
|
||||
@ -88,8 +94,14 @@ class ACH
|
||||
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();
|
||||
|
||||
$bank_account = Customer::retrieveSource($request->customer, $request->source, $this->stripe->stripe_connect_auth);
|
||||
@ -97,12 +109,14 @@ class ACH
|
||||
try {
|
||||
$bank_account->verify(['amounts' => request()->transactions]);
|
||||
|
||||
$token->meta->verified_at = now();
|
||||
$meta = $token->meta;
|
||||
$meta->state = 'authorized';
|
||||
$token->meta = $meta;
|
||||
$token->save();
|
||||
|
||||
return redirect()
|
||||
->route('client.invoices.index')
|
||||
->with('success', __('texts.payment_method_verified'));
|
||||
->route('client.payment_methods.show', $token->hashed_id)
|
||||
->with('message', __('texts.payment_method_verified'));
|
||||
} catch (CardException $e) {
|
||||
return back()->with('error', $e->getMessage());
|
||||
}
|
||||
|
@ -2,5 +2,7 @@
|
||||
<div class="center">
|
||||
<h1>{{ ctrans('texts.ach_verification_notification_label') }}</h1>
|
||||
<p>{{ ctrans('texts.ach_verification_notification') }}</p>
|
||||
|
||||
<a class="button" href="{{ $url }}">{{ ctrans('texts.complete_verification') }}</a>
|
||||
</div>
|
||||
@endcomponent
|
||||
|
Loading…
x
Reference in New Issue
Block a user