Handle errors in fetching transactions
This commit is contained in:
@@ -305,6 +305,12 @@ class NordigenClient(BaseClient, AggregatorClient):
|
||||
path = f"accounts/{account_id}/transactions"
|
||||
response = await self.call(path, schema="Transactions")
|
||||
|
||||
if response["status_code"] == 401:
|
||||
log.error(
|
||||
f"Error getting transactions for {account_id}: {response['summary']}"
|
||||
)
|
||||
return []
|
||||
|
||||
source = "booked"
|
||||
|
||||
# If requisition is specified, try to get the object
|
||||
@@ -315,7 +321,7 @@ class NordigenClient(BaseClient, AggregatorClient):
|
||||
if requisition:
|
||||
source = requisition.transaction_source
|
||||
|
||||
parsed = response[source]
|
||||
parsed = response["transactions"][source]
|
||||
self.normalise_transactions(parsed, state=source)
|
||||
|
||||
if process:
|
||||
@@ -323,7 +329,7 @@ class NordigenClient(BaseClient, AggregatorClient):
|
||||
if pending:
|
||||
if process:
|
||||
raise Exception("Cannot process and get pending")
|
||||
parsed_pending = response["pending"]
|
||||
parsed_pending = response["transactions"]["pending"]
|
||||
self.normalise_transactions(parsed_pending, state="pending")
|
||||
parsed_pending.extend(parsed)
|
||||
parsed = parsed_pending
|
||||
|
||||
Reference in New Issue
Block a user