CLean up code paths for client balance

This commit is contained in:
David Bomba 2022-09-07 08:35:19 +10:00
parent 4e29459985
commit 28915d82a4
3 changed files with 3 additions and 6 deletions

View File

@ -88,7 +88,6 @@ class ApplyPayment extends AbstractService
$this->invoice
->client
->fresh()
->service()
->updateBalance($amount_paid)
->save();

View File

@ -43,7 +43,7 @@ class ApplyPaymentAmount extends AbstractService
public function run()
{
if ($this->invoice->status_id == Invoice::STATUS_DRAFT) {
$this->invoice->service()->markSent()->save();
$this->invoice = $this->invoice->service()->markSent()->save();
}
/*Don't double pay*/
@ -88,10 +88,8 @@ class ApplyPaymentAmount extends AbstractService
$this->invoice
->client
->fresh()
->service()
->updateBalance($payment->amount * -1)
->updatePaidToDate($payment->amount)
->updateBalanceAndPaidToDate($payment->amount * -1, $payment->amount)
->save();

View File

@ -50,7 +50,7 @@ class MarkPaid extends AbstractService
}
if ($this->invoice->status_id == Invoice::STATUS_DRAFT) {
$this->invoice->service()->markSent()->save();
$this->invoice = $this->invoice->service()->markSent()->save();
}
\DB::connection(config('database.default'))->transaction(function () {