mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Resolve categories
This commit is contained in:
parent
84b37d7e94
commit
a4d7d4af54
@ -59,6 +59,7 @@ class MatchBankTransactions implements ShouldQueue
|
|||||||
$this->company_id = $company_id;
|
$this->company_id = $company_id;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->input = $input;
|
$this->input = $input;
|
||||||
|
$this->categories = collect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +78,10 @@ class MatchBankTransactions implements ShouldQueue
|
|||||||
|
|
||||||
$yodlee = new Yodlee($this->company->account->bank_integration_account_id);
|
$yodlee = new Yodlee($this->company->account->bank_integration_account_id);
|
||||||
|
|
||||||
$this->categories = collect($yodlee->getTransactionCategories());
|
$_categories = collect($yodlee->getTransactionCategories());
|
||||||
|
|
||||||
|
if($_categories)
|
||||||
|
$this->categories = collect($_categories->transactionCategory);
|
||||||
|
|
||||||
foreach($this->input as $match)
|
foreach($this->input as $match)
|
||||||
{
|
{
|
||||||
@ -111,6 +115,9 @@ class MatchBankTransactions implements ShouldQueue
|
|||||||
private function matchExpense(array $match) :void
|
private function matchExpense(array $match) :void
|
||||||
{
|
{
|
||||||
//if there is a category id, pull it from Yodlee and insert - or just reuse!!
|
//if there is a category id, pull it from Yodlee and insert - or just reuse!!
|
||||||
|
$this->bt = BankTransaction::find($match['id']);
|
||||||
|
|
||||||
|
$category_id = $this->resolveCategory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createPayment(int $invoice_id, float $amount) :void
|
private function createPayment(int $invoice_id, float $amount) :void
|
||||||
@ -192,6 +199,11 @@ class MatchBankTransactions implements ShouldQueue
|
|||||||
$this->bt->save();
|
$this->bt->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function resolveCategory() :?int
|
||||||
|
{
|
||||||
|
$this->categories->firstWhere('highLevelCategoryId', $this->bt->category_id)
|
||||||
|
}
|
||||||
|
|
||||||
private function harvestCurrencyId() :int
|
private function harvestCurrencyId() :int
|
||||||
{
|
{
|
||||||
$currency = Currency::where('code', $this->bt->currency_code)->first();
|
$currency = Currency::where('code', $this->bt->currency_code)->first();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user