mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
better logging for jobs
This commit is contained in:
parent
e4d0c9f901
commit
1060dad7d7
@ -67,14 +67,16 @@ class ProcessBankTransactionsNordigen implements ShouldQueue
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
nlog("Nordigen: Processing transactions for account: {$this->bank_integration->account->key}");
|
||||
|
||||
// UPDATE ACCOUNT
|
||||
try {
|
||||
$this->updateAccount();
|
||||
} catch (\Exception $e) {
|
||||
nlog("{$this->bank_integration->account->key} - exited abnormally => " . $e->getMessage());
|
||||
nlog("Nordigen: {$this->bank_integration->nordigen_account_id} - exited abnormally => " . $e->getMessage());
|
||||
|
||||
$content = [
|
||||
"Processing transactions for account: {$this->bank_integration->account->key} failed",
|
||||
"Processing transactions for account: {$this->bank_integration->nordigen_account_id} failed",
|
||||
"Exception Details => ",
|
||||
$e->getMessage(),
|
||||
];
|
||||
@ -94,10 +96,10 @@ class ProcessBankTransactionsNordigen implements ShouldQueue
|
||||
$this->bank_integration->from_date = now()->subDays(90);
|
||||
$this->bank_integration->save();
|
||||
|
||||
nlog("{$this->bank_integration->account->key} - exited abnormally => " . $e->getMessage());
|
||||
nlog("Nordigen: {$this->bank_integration->nordigen_account_id} - exited abnormally => " . $e->getMessage());
|
||||
|
||||
$content = [
|
||||
"Processing transactions for account: {$this->bank_integration->account->key} failed",
|
||||
"Processing transactions for account: {$this->bank_integration->nordigen_account_id} failed",
|
||||
"Exception Details => ",
|
||||
$e->getMessage(),
|
||||
];
|
||||
@ -114,13 +116,11 @@ class ProcessBankTransactionsNordigen implements ShouldQueue
|
||||
|
||||
private function updateAccount()
|
||||
{
|
||||
|
||||
Log::info("try to execute updateAccount");
|
||||
if (!$this->nordigen->isAccountActive($this->bank_integration->nordigen_account_id)) {
|
||||
$this->bank_integration->disabled_upstream = true;
|
||||
$this->bank_integration->save();
|
||||
$this->stop_loop = false;
|
||||
Log::info("account inactive");
|
||||
Log::info("Nordigen: account inactive: " . $this->bank_integration->nordigen_account_id);
|
||||
// @turbo124 @todo send email for expired account
|
||||
return;
|
||||
}
|
||||
|
@ -71,16 +71,16 @@ class ProcessBankTransactionsYodlee implements ShouldQueue
|
||||
//Loop through everything until we are up to date
|
||||
$this->from_date = $this->from_date ?: '2021-01-01';
|
||||
|
||||
nlog("Processing transactions for account: {$this->bank_integration->account->key}");
|
||||
nlog("Yodlee: Processing transactions for account: {$this->bank_integration->account->key}");
|
||||
|
||||
do {
|
||||
try {
|
||||
$this->processTransactions();
|
||||
} catch (\Exception $e) {
|
||||
nlog("{$this->account->bank_integration_account_id} - exited abnormally => " . $e->getMessage());
|
||||
nlog("Yodlee: {$this->bank_integration->bank_account_id} - exited abnormally => " . $e->getMessage());
|
||||
|
||||
$content = [
|
||||
"Processing transactions for account: {$this->bank_integration->account->key} failed",
|
||||
"Processing transactions for account: {$this->bank_integration->bank_account_id} failed",
|
||||
"Exception Details => ",
|
||||
$e->getMessage(),
|
||||
];
|
||||
@ -164,7 +164,7 @@ class ProcessBankTransactionsYodlee implements ShouldQueue
|
||||
$now = now();
|
||||
|
||||
foreach ($transactions as $transaction) {
|
||||
if (BankTransaction::query()->where('transaction_id', $transaction['transaction_id'])->where('company_id', $this->company->id)->withTrashed()->exists()) {
|
||||
if (BankTransaction::query()->where('transaction_id', $transaction['transaction_id'])->where('company_id', $this->company->id)->where('bank_integration_id', $this->bank_integration->id)->withTrashed()->exists()) { // @turbo124 was not scoped to bank_integration_id => from my pov this should be present, because when an account was historized (is_deleted) a transaction can occur multiple (in the archived bank_integration and in the new one
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user