mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Enforce max payment amount
This commit is contained in:
parent
1b5d8f850b
commit
9d6b8aed15
@ -45,7 +45,7 @@ class CreatePaymentAPIRequest extends PaymentRequest
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'amount' => 'required|numeric|not_in:0',
|
'amount' => 'required|numeric',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->payment_type_id == PAYMENT_TYPE_CREDIT) {
|
if ($this->payment_type_id == PAYMENT_TYPE_CREDIT) {
|
||||||
|
@ -194,6 +194,7 @@ class PaymentRepository extends BaseRepository
|
|||||||
if (! $publicId) {
|
if (! $publicId) {
|
||||||
$clientId = $input['client_id'];
|
$clientId = $input['client_id'];
|
||||||
$amount = Utils::parseFloat($input['amount']);
|
$amount = Utils::parseFloat($input['amount']);
|
||||||
|
$amount = min($amount, MAX_INVOICE_AMOUNT);
|
||||||
|
|
||||||
if ($paymentTypeId == PAYMENT_TYPE_CREDIT) {
|
if ($paymentTypeId == PAYMENT_TYPE_CREDIT) {
|
||||||
$credits = Credit::scope()->where('client_id', '=', $clientId)
|
$credits = Credit::scope()->where('client_id', '=', $clientId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user