Refactor for bank transactions

This commit is contained in:
David Bomba 2022-09-23 12:34:52 +10:00
parent 023d596844
commit 268ad71bfb

View File

@ -176,6 +176,9 @@ class MatchBankTransactions implements ShouldQueue
$expense->transaction_id = $this->bt->id; $expense->transaction_id = $this->bt->id;
$expense->save(); $expense->save();
$this->bt->expense_id = $expense->id;
$this->bt->save();
return $this; return $this;
} }
@ -281,6 +284,7 @@ class MatchBankTransactions implements ShouldQueue
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
event(new InvoiceWasPaid($this->invoice, $payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); event(new InvoiceWasPaid($this->invoice, $payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
$this->bt->invoice_id = collect($invoices)->pluck('hashed_id')->implode(',');
$this->bt->status_id = BankTransaction::STATUS_CONVERTED; $this->bt->status_id = BankTransaction::STATUS_CONVERTED;
$this->bt->save(); $this->bt->save();
} }