mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
Stripe: Payments with tokens & error handling
This commit is contained in:
parent
7d50430a9e
commit
99c30846ad
@ -13,6 +13,7 @@
|
||||
namespace App\PaymentDrivers\Stripe;
|
||||
|
||||
use App\Events\Payment\PaymentWasCreated;
|
||||
use App\Exceptions\PaymentFailed;
|
||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||
use App\Jobs\Mail\PaymentFailureMailer;
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
@ -159,14 +160,27 @@ class CreditCard
|
||||
{
|
||||
PaymentFailureMailer::dispatch($this->stripe->client, $server_response->cancellation_reason, $this->stripe->client->company, $server_response->amount);
|
||||
|
||||
PaymentFailureMailer::dispatch(
|
||||
$this->stripe->client,
|
||||
$server_response,
|
||||
$this->stripe->client->company,
|
||||
$server_response->amount
|
||||
);
|
||||
|
||||
$message = [
|
||||
'server_response' => $server_response,
|
||||
'data' => [],
|
||||
'data' => $this->stripe->payment_hash->data,
|
||||
];
|
||||
|
||||
SystemLogger::dispatch($message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client);
|
||||
SystemLogger::dispatch(
|
||||
$message,
|
||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||
SystemLog::EVENT_GATEWAY_FAILURE,
|
||||
SystemLog::TYPE_STRIPE,
|
||||
$this->stripe->client
|
||||
);
|
||||
|
||||
throw new \Exception('Failed to process the payment.', 1);
|
||||
throw new PaymentFailed('Failed to process the payment.', 500);
|
||||
}
|
||||
|
||||
private function storePaymentMethod(\Stripe\PaymentMethod $method, $payment_method_id, $customer)
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
@section('gateway_head')
|
||||
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
|
||||
<meta name="stripe-token" content="{{ $token->token }}">
|
||||
<meta name="stripe-secret" content="{{ $intent->client_secret }}">
|
||||
<meta name="stripe-token" content="{{ optional($token)->token }}">
|
||||
<meta name="only-authorization" content="">
|
||||
@endsection
|
||||
|
||||
@ -26,9 +26,7 @@
|
||||
|
||||
@include('portal.ninja2020.gateways.includes.payment_details')
|
||||
|
||||
@if((int)$total['amount_with_fee'] == 0)
|
||||
@include('portal.ninja2020.gateways.stripe.includes.pay_with_credit')
|
||||
@elseif($token)
|
||||
@if($token)
|
||||
@include('portal.ninja2020.gateways.stripe.includes.pay_with_token')
|
||||
@include('portal.ninja2020.gateways.includes.pay_now', ['id' => 'pay-now-with-token'])
|
||||
@else
|
||||
|
Loading…
Reference in New Issue
Block a user