1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Set payment min amount to 0.01

This commit is contained in:
Hillel Coren 2016-08-28 17:19:33 +03:00
parent 2a195db798
commit 56856f1435
3 changed files with 2 additions and 10 deletions

View File

@ -38,7 +38,7 @@ class CreatePaymentAPIRequest extends PaymentRequest
]); ]);
$rules = [ $rules = [
'amount' => "required|less_than:{$invoice->balance}|positive", 'amount' => "required|numeric|between:0.01,{$invoice->balance}",
]; ];
if ($this->payment_type_id == PAYMENT_TYPE_CREDIT) { if ($this->payment_type_id == PAYMENT_TYPE_CREDIT) {

View File

@ -29,7 +29,7 @@ class CreatePaymentRequest extends PaymentRequest
$rules = [ $rules = [
'client' => 'required', // TODO: change to client_id once views are updated 'client' => 'required', // TODO: change to client_id once views are updated
'invoice' => 'required', // TODO: change to invoice_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', 'payment_date' => 'required',
]; ];

View File

@ -165,14 +165,6 @@ class AppServiceProvider extends ServiceProvider
return true; 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) { Validator::extend('has_counter', function($attribute, $value, $parameters) {
return !$value || strstr($value, '{$counter}'); return !$value || strstr($value, '{$counter}');
}); });