Allow checking pending transactions

This commit is contained in:
2023-03-20 14:10:31 +00:00
parent 04f5595a86
commit cfffc6c904
3 changed files with 25 additions and 5 deletions

View File

@@ -305,12 +305,25 @@ class NordigenClient(BaseClient, AggregatorClient):
"""
path = f"accounts/{account_id}/transactions"
response = await self.call(path, schema="Transactions")
parsed = response["booked"]
self.normalise_transactions(parsed, state="booked")
source = "booked"
# If requisition is specified, try to get the object
# If present, take the transaction source from there,
# pending or booked.
if req:
requisition = self.instance.get_requisition(req)
if requisition:
source = requisition.transaction_source
parsed = response[source]
self.normalise_transactions(parsed, state=source)
if process:
await self.process_transactions(account_id, parsed, req=req)
if pending:
if process:
raise Exception("Cannot process and get pending")
parsed_pending = response["pending"]
self.normalise_transactions(parsed_pending, state="pending")
parsed_pending.extend(parsed)