From 56856f14352761431e1e3432eaf0323723c1954d Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 28 Aug 2016 17:19:33 +0300 Subject: [PATCH] Set payment min amount to 0.01 --- app/Http/Requests/CreatePaymentAPIRequest.php | 2 +- app/Http/Requests/CreatePaymentRequest.php | 2 +- app/Providers/AppServiceProvider.php | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/Http/Requests/CreatePaymentAPIRequest.php b/app/Http/Requests/CreatePaymentAPIRequest.php index d00fbb44573b..226ab5366663 100644 --- a/app/Http/Requests/CreatePaymentAPIRequest.php +++ b/app/Http/Requests/CreatePaymentAPIRequest.php @@ -38,7 +38,7 @@ class CreatePaymentAPIRequest extends PaymentRequest ]); $rules = [ - 'amount' => "required|less_than:{$invoice->balance}|positive", + 'amount' => "required|numeric|between:0.01,{$invoice->balance}", ]; if ($this->payment_type_id == PAYMENT_TYPE_CREDIT) { diff --git a/app/Http/Requests/CreatePaymentRequest.php b/app/Http/Requests/CreatePaymentRequest.php index a6eda2d599e4..745f0afa3ba4 100644 --- a/app/Http/Requests/CreatePaymentRequest.php +++ b/app/Http/Requests/CreatePaymentRequest.php @@ -29,7 +29,7 @@ class CreatePaymentRequest extends PaymentRequest $rules = [ 'client' => 'required', // TODO: change to client_id once views are updated 'invoice' => 'required', // TODO: change to invoice_id once views are updated - 'amount' => "required|less_than:{$invoice->balance}|positive", + 'amount' => "required|numeric|between:0.01,{$invoice->balance}", 'payment_date' => 'required', ]; diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 203bc6c080ef..ceaa9e89ceb7 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -165,14 +165,6 @@ class AppServiceProvider extends ServiceProvider return true; }); - Validator::extend('less_than', function($attribute, $value, $parameters) { - return floatval($value) <= floatval($parameters[0]); - }); - - Validator::replacer('less_than', function($message, $attribute, $rule, $parameters) { - return str_replace(':value', $parameters[0], $message); - }); - Validator::extend('has_counter', function($attribute, $value, $parameters) { return !$value || strstr($value, '{$counter}'); });