From 9f2e82323d5d5e7fce01a46f0998ae886cb0f9e1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 22 Feb 2016 12:26:26 +0200 Subject: [PATCH] Fixed invalid payment if auto-billing with invalid token --- app/Services/PaymentService.php | 11 +++++++---- resources/views/clients/show.blade.php | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index 78e6a031c1..66e94e43dc 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -273,10 +273,13 @@ class PaymentService extends BaseService // submit purchase/get response $response = $gateway->purchase($details)->send(); - $ref = $response->getTransactionReference(); - - // create payment record - return $this->createPayment($invitation, $accountGateway, $ref); + + if ($response->isSuccessful()) { + $ref = $response->getTransactionReference(); + return $this->createPayment($invitation, $accountGateway, $ref); + } else { + return false; + } } public function getDatatable($clientPublicId, $search) diff --git a/resources/views/clients/show.blade.php b/resources/views/clients/show.blade.php index e4209fdd39..c29fffe1df 100644 --- a/resources/views/clients/show.blade.php +++ b/resources/views/clients/show.blade.php @@ -22,7 +22,7 @@ @section('content')
-
+
{{ $client->getDisplayName() }} @if ($client->trashed()) @@ -30,7 +30,7 @@ @endif
-
+
{!! Former::open('clients/bulk')->addClass('mainForm') !!}