From 25ac6a68b254a3216b8c5e28895aef0fe7d7ee0e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 14 Sep 2022 15:50:44 +1000 Subject: [PATCH] Logging --- app/Jobs/Bank/ProcessBankTransactions.php | 10 +++++++++- app/Jobs/Ninja/BankTransactionSync.php | 4 +--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Jobs/Bank/ProcessBankTransactions.php b/app/Jobs/Bank/ProcessBankTransactions.php index 090e6a9b4f..4fd7b538dd 100644 --- a/app/Jobs/Bank/ProcessBankTransactions.php +++ b/app/Jobs/Bank/ProcessBankTransactions.php @@ -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(); diff --git a/app/Jobs/Ninja/BankTransactionSync.php b/app/Jobs/Ninja/BankTransactionSync.php index c7c3923a6e..91b4a658b8 100644 --- a/app/Jobs/Ninja/BankTransactionSync.php +++ b/app/Jobs/Ninja/BankTransactionSync.php @@ -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); });