mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 22:22:32 +01:00
Prevent creating payment for a quote through the API
This commit is contained in:
parent
5e5207973f
commit
cef35a98e1
@ -27,14 +27,16 @@ class CreatePaymentAPIRequest extends PaymentRequest
|
|||||||
'amount' => 'required',
|
'amount' => 'required',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoice = Invoice::scope($this->invoice_id)->firstOrFail();
|
$invoice = Invoice::scope($this->invoice_id)
|
||||||
|
->invoices()
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
$this->merge([
|
$this->merge([
|
||||||
'invoice_id' => $invoice->id,
|
'invoice_id' => $invoice->id,
|
||||||
'client_id' => $invoice->client->id,
|
'client_id' => $invoice->client->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'amount' => "required|less_than:{$invoice->balance}|positive",
|
'amount' => "required|less_than:{$invoice->balance}|positive",
|
||||||
];
|
];
|
||||||
|
@ -22,7 +22,9 @@ class CreatePaymentRequest extends PaymentRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
$input = $this->input();
|
$input = $this->input();
|
||||||
$invoice = Invoice::scope($input['invoice'])->firstOrFail();
|
$invoice = Invoice::scope($input['invoice'])
|
||||||
|
->invoices()
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'client' => 'required', // TODO: change to client_id once views are updated
|
'client' => 'required', // TODO: change to client_id once views are updated
|
||||||
|
Loading…
Reference in New Issue
Block a user