From ce6068f9246427fb0f0e9b83119131f5129122d9 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 18 Jul 2016 22:03:28 +0300 Subject: [PATCH] Additional online payment checks --- app/Http/Controllers/OnlinePaymentController.php | 4 ++++ app/Ninja/PaymentDrivers/BasePaymentDriver.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/OnlinePaymentController.php b/app/Http/Controllers/OnlinePaymentController.php index 246c77b03098..4e1f5a1fc6f7 100644 --- a/app/Http/Controllers/OnlinePaymentController.php +++ b/app/Http/Controllers/OnlinePaymentController.php @@ -68,6 +68,10 @@ class OnlinePaymentController extends BaseController ]); } + if ( ! floatval($invitation->invoice->balance)) { + return redirect()->to('view/' . $invitation->invitation_key); + } + $invitation = $invitation->load('invoice.client.account.account_gateways.gateway'); if ( ! $gatewayType) { diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index c342b8500b19..07b3fcbe0af4 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -716,7 +716,7 @@ class BasePaymentDriver } // check invoice still has balance - if ( ! $this->invoice()->balance) { + if ( ! floatval($this->invoice()->balance)) { throw new Exception(trans('texts.payment_error_code', ['code' => 'NB'])); }