diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index bec391591a4c..2c545556c05e 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -126,7 +126,7 @@ class MarkPaid extends AbstractService // $client->save(); // }, 1); - $this->invoice->client->service()->updateBalanceAndPaidToDate($payment->amount, $payment->amount*-1)->save(); + $this->invoice->client->service()->updateBalanceAndPaidToDate($payment->amount*-1, $payment->amount)->save(); $this->invoice = $this->invoice ->service() diff --git a/tests/Feature/DeleteInvoiceTest.php b/tests/Feature/DeleteInvoiceTest.php index 4d378b54a02d..d49f6f27c9e9 100644 --- a/tests/Feature/DeleteInvoiceTest.php +++ b/tests/Feature/DeleteInvoiceTest.php @@ -258,7 +258,7 @@ class DeleteInvoiceTest extends TestCase $invoice = $invoice->service()->markPaid()->save(); $this->assertEquals(0, $invoice->balance); - $this->assertEquals(0, $invoice->client->balance); + $this->assertEquals(0, $invoice->client->fresh()->balance); $this->assertEquals(20, $invoice->client->paid_to_date); //partially refund payment diff --git a/tests/Integration/MarkInvoicePaidTest.php b/tests/Integration/MarkInvoicePaidTest.php index 873a87340c78..c0921c0b2832 100644 --- a/tests/Integration/MarkInvoicePaidTest.php +++ b/tests/Integration/MarkInvoicePaidTest.php @@ -57,8 +57,6 @@ class MarkInvoicePaidTest extends TestCase } //events are not firing which makes this impossible to control. -nlog($client_balance); -nlog($invoice_balance); $this->assertEquals(0.00, $invoice->balance); $this->assertEquals(($client_balance - $invoice_balance), $client->balance);