mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Logging
This commit is contained in:
parent
f512edb606
commit
56f3af100f
@ -52,12 +52,16 @@ class ProcessBankTransactions implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
set_time_limit(0);
|
||||||
//Loop through everything until we are up to date
|
//Loop through everything until we are up to date
|
||||||
|
|
||||||
$this->from_date = $this->from_date ?: '2021-01-01';
|
$this->from_date = $this->from_date ?: '2021-01-01';
|
||||||
|
|
||||||
do{
|
do{
|
||||||
|
|
||||||
$this->processTransactions();
|
$this->processTransactions();
|
||||||
|
|
||||||
}
|
}
|
||||||
while($this->stop_loop);
|
while($this->stop_loop);
|
||||||
|
|
||||||
@ -68,8 +72,6 @@ class ProcessBankTransactions implements ShouldQueue
|
|||||||
{
|
{
|
||||||
$yodlee = new Yodlee($this->bank_integration_account_id);
|
$yodlee = new Yodlee($this->bank_integration_account_id);
|
||||||
|
|
||||||
nlog("BANK ACCOUNT ID = {$this->bank_integration->bank_account_id}");
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'top' => 500,
|
'top' => 500,
|
||||||
'fromDate' => $this->from_date,
|
'fromDate' => $this->from_date,
|
||||||
@ -77,20 +79,17 @@ nlog("BANK ACCOUNT ID = {$this->bank_integration->bank_account_id}");
|
|||||||
'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);
|
||||||
|
|
||||||
nlog($transaction_count);
|
|
||||||
|
|
||||||
$count = $transaction_count->transaction->TOTAL->count;
|
$count = $transaction_count->transaction->TOTAL->count;
|
||||||
|
|
||||||
nlog($count);
|
|
||||||
|
|
||||||
//expense transactions
|
//expense transactions
|
||||||
$transactions = $yodlee->getTransactions($data);
|
$transactions = $yodlee->getTransactions($data);
|
||||||
|
|
||||||
$company = $this->bank_integration->company;
|
$company = $this->bank_integration->company;
|
||||||
|
|
||||||
|
MultiDB::setDb($company->db);
|
||||||
|
|
||||||
$user_id = $company->owner()->id;
|
$user_id = $company->owner()->id;
|
||||||
|
|
||||||
BankTransaction::unguard();
|
BankTransaction::unguard();
|
||||||
@ -114,18 +113,23 @@ nlog($count);
|
|||||||
|
|
||||||
BankService::dispatch($company->id, $company->db);
|
BankService::dispatch($company->id, $company->db);
|
||||||
|
|
||||||
MultiDB::setDb($company->db);
|
|
||||||
|
|
||||||
$last_transaction = end($transactions);
|
$last_transaction = end($transactions);
|
||||||
|
|
||||||
|
nlog("last transaction");
|
||||||
|
nlog($last_transaction);
|
||||||
|
|
||||||
$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 = $this->bank_integration->from_date->format('Y-m-d');
|
$this->from_date = $this->bank_integration->from_date->format('Y-m-d');
|
||||||
|
|
||||||
$this->bank_integration->save();
|
$this->bank_integration->save();
|
||||||
|
|
||||||
|
|
||||||
|
nlog($this->bank_integration->toArray());
|
||||||
|
|
||||||
if($count < 500)
|
if($count < 500)
|
||||||
$this->stop_loop = false;
|
$this->stop_loop = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user