mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for paid invoices via gateways
This commit is contained in:
parent
0b56e8d4cb
commit
2f7e01c5a4
@ -201,6 +201,14 @@ class InvoiceService
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updateStatus()
|
||||
{
|
||||
if($this->invoice->balance == 0)
|
||||
$this->setStatus(Invoice::STATUS_PAID);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function toggleFeesPaid()
|
||||
{
|
||||
$this->invoice->line_items = collect($this->invoice->line_items)
|
||||
|
@ -73,6 +73,7 @@ class UpdateInvoicePayment
|
||||
$invoice->service() //caution what if we amount paid was less than partial - we wipe it!
|
||||
->clearPartial()
|
||||
->updateBalance($paid_amount * -1)
|
||||
->updateStatus()
|
||||
->save();
|
||||
|
||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user