mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Handle edge case with Nordigen where account appears active, but access has expired
This commit is contained in:
parent
1affa63470
commit
c705784137
@ -97,11 +97,11 @@ class Nordigen
|
|||||||
return $it->transform($out);
|
return $it->transform($out);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
if (strpos($e->getMessage(), "Invalid Account ID") !== false) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw $e;
|
nlog("Nordigen getAccount() failed => {$account_id} => " . $e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,23 +114,26 @@ class ProcessBankTransactionsNordigen implements ShouldQueue
|
|||||||
|
|
||||||
private function updateAccount()
|
private function updateAccount()
|
||||||
{
|
{
|
||||||
if (!$this->nordigen->isAccountActive($this->bank_integration->nordigen_account_id)) {
|
$is_account_active = $this->nordigen->isAccountActive($this->bank_integration->nordigen_account_id);
|
||||||
|
$account = $this->nordigen->getAccount($this->bank_integration->nordigen_account_id);
|
||||||
|
|
||||||
|
if (!$is_account_active || !$account) {
|
||||||
$this->bank_integration->disabled_upstream = true;
|
$this->bank_integration->disabled_upstream = true;
|
||||||
$this->bank_integration->save();
|
$this->bank_integration->save();
|
||||||
$this->stop_loop = false;
|
$this->stop_loop = false;
|
||||||
|
|
||||||
nlog("Nordigen: account inactive: " . $this->bank_integration->nordigen_account_id);
|
nlog("Nordigen: account inactive: " . $this->bank_integration->nordigen_account_id);
|
||||||
// @turbo124 @todo send email for expired account
|
|
||||||
|
|
||||||
$this->nordigen->disabledAccountEmail($this->bank_integration);
|
$this->nordigen->disabledAccountEmail($this->bank_integration);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->nordigen_account = $this->nordigen->getAccount($this->bank_integration->nordigen_account_id);
|
$this->nordigen_account = $account;
|
||||||
|
|
||||||
$this->bank_integration->disabled_upstream = false;
|
$this->bank_integration->disabled_upstream = false;
|
||||||
$this->bank_integration->bank_account_status = $this->nordigen_account['account_status'];
|
$this->bank_integration->bank_account_status = $account['account_status'];
|
||||||
$this->bank_integration->balance = $this->nordigen_account['current_balance'];
|
$this->bank_integration->balance = $account['current_balance'];
|
||||||
|
|
||||||
$this->bank_integration->save();
|
$this->bank_integration->save();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user