mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Catch for payment edge cases
This commit is contained in:
parent
00b5dac278
commit
00061cfa25
@ -109,14 +109,35 @@ class ACH
|
|||||||
|
|
||||||
public function verificationView(ClientGatewayToken $token)
|
public function verificationView(ClientGatewayToken $token)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//double check here if we need to show the verification view.
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
if(substr($token->token,0,2) == 'pm'){
|
||||||
|
$pm = $this->stripe->getStripePaymentMethod($token->token);
|
||||||
|
|
||||||
|
if(!$pm->customer){
|
||||||
|
|
||||||
|
$meta = $token->meta;
|
||||||
|
$meta->state = 'unauthorized';
|
||||||
|
$token->meta = $meta;
|
||||||
|
$token->save();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('client.payment_methods.show', $token->hashed_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($token->meta->state) && $token->meta->state === 'authorized') {
|
if (isset($token->meta->state) && $token->meta->state === 'authorized') {
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('client.payment_methods.show', $token->hashed_id)
|
->route('client.payment_methods.show', $token->hashed_id)
|
||||||
->with('message', __('texts.payment_method_verified'));
|
->with('message', __('texts.payment_method_verified'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//double check here if we need to show the verification view.
|
if($token->meta->next_action)
|
||||||
$this->stripe->init();
|
return redirect($token->meta->next_action);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$bank_account = Customer::retrieveSource($token->gateway_customer_reference, $token->token, [], $this->stripe->stripe_connect_auth);
|
$bank_account = Customer::retrieveSource($token->gateway_customer_reference, $token->token, [], $this->stripe->stripe_connect_auth);
|
||||||
|
|
||||||
@ -319,6 +340,9 @@ class ACH
|
|||||||
$data['message'] = 'Too many requests made to the API too quickly';
|
$data['message'] = 'Too many requests made to the API too quickly';
|
||||||
break;
|
break;
|
||||||
case $e instanceof InvalidRequestException:
|
case $e instanceof InvalidRequestException:
|
||||||
|
|
||||||
|
return redirect()->route('client.payment_methods.verification', ['payment_method' => $cgt->hashed_id, 'method' => GatewayType::BANK_TRANSFER]);
|
||||||
|
|
||||||
$data['message'] = 'Invalid parameters were supplied to Stripe\'s API';
|
$data['message'] = 'Invalid parameters were supplied to Stripe\'s API';
|
||||||
break;
|
break;
|
||||||
case $e instanceof AuthenticationException:
|
case $e instanceof AuthenticationException:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user