This commit is contained in:
David Bomba 2022-09-14 16:19:08 +10:00
parent c15c1572e9
commit 9b74cb4615
2 changed files with 1 additions and 9 deletions

View File

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

View File

@ -231,7 +231,7 @@ class CompanyTransformer extends EntityTransformer
} }
public function includeBankTransactions(Company $company) public function includeBankTransactions(Company $company)
{ {nlog("GEEETTTTTTTT");
$transformer = new BankTransactionTransformer($this->serializer); $transformer = new BankTransactionTransformer($this->serializer);
return $this->includeCollection($company->bank_transactions, $transformer, BankTransaction::class); return $this->includeCollection($company->bank_transactions, $transformer, BankTransaction::class);