1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
This commit is contained in:
David Bomba 2022-09-14 15:50:44 +10:00
parent aaa06e0f33
commit 25ac6a68b2
2 changed files with 10 additions and 4 deletions

View File

@ -79,6 +79,8 @@ class ProcessBankTransactions implements ShouldQueue
'accountId' => $this->bank_integration->bank_account_id,
];
nlog($data);
$transaction_count = $yodlee->getTransactionCount($data);
$count = $transaction_count->transaction->TOTAL->count;
@ -94,12 +96,16 @@ class ProcessBankTransactions implements ShouldQueue
BankTransaction::unguard();
nlog("transactions = " . count($transactions));
foreach($transactions as $transaction)
{
if(BankTransaction::where('transaction_id', $transaction['transaction_id'])->where('company_id', $company->id)->withTrashed()->exists())
continue;
nlog("inserting");
//this should be much faster to insert than using ::create()
$bt = \DB::table('bank_transactions')->insert(
array_merge($transaction,[
@ -115,9 +121,11 @@ class ProcessBankTransactions implements ShouldQueue
$last_transaction = reset($transactions);
nlog("last tranny = " . $last_transaction->id);
$this->bank_integration->from_date = isset($last_transaction['date']) ? \Carbon\Carbon::parse($last_transaction['date']) : now();
$this->from_date = $this->bank_integration->from_date->format('Y-m-d');
$this->from_date = \Carbon\Carbon::parse($this->bank_integration->from_date)->format('Y-m-d');
$this->bank_integration->save();

View File

@ -53,7 +53,7 @@ class BankTransactionSync implements ShouldQueue
MultiDB::setDB($db);
nlog("syncing transactions");
$this->syncTransactions();
}
}
@ -69,8 +69,6 @@ class BankTransactionSync implements ShouldQueue
$account->bank_integrations->each(function ($bank_integration) use ($account){
nlog("processing {$account->bank_integration_account_id} - {$bank_integration->id}");
ProcessBankTransactions::dispatch($account->bank_integration_account_id, $bank_integration);
});