diff --git a/app/PaymentDrivers/Stripe/CreditCard.php b/app/PaymentDrivers/Stripe/CreditCard.php
index 1de1cd6fa482..196fc09f696c 100644
--- a/app/PaymentDrivers/Stripe/CreditCard.php
+++ b/app/PaymentDrivers/Stripe/CreditCard.php
@@ -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)
diff --git a/resources/views/portal/ninja2020/gateways/stripe/credit_card/pay.blade.php b/resources/views/portal/ninja2020/gateways/stripe/credit_card/pay.blade.php
index 26c56a4f76c0..1704b7b17f41 100644
--- a/resources/views/portal/ninja2020/gateways/stripe/credit_card/pay.blade.php
+++ b/resources/views/portal/ninja2020/gateways/stripe/credit_card/pay.blade.php
@@ -2,8 +2,8 @@
@section('gateway_head')
-
+
@endsection
@@ -12,7 +12,7 @@
@csrf
-
+
@@ -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