Fix adding time to transactions when usual fields absent

This commit is contained in:
Mark Veidemanis 2023-03-12 13:10:37 +00:00
parent b800139bcf
commit 2e02cdba9e
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 5 additions and 2 deletions

View File

@ -265,12 +265,15 @@ class NordigenClient(BaseClient, AggregatorClient):
# Rename timestamp # Rename timestamp
if "bookingDateTime" in transaction: if transaction["bookingDateTime"]:
transaction["ts"] = transaction["bookingDateTime"] transaction["ts"] = transaction["bookingDateTime"]
del transaction["bookingDateTime"] del transaction["bookingDateTime"]
elif "bookingDate" in transaction: elif transaction["bookingDate"]:
transaction["ts"] = transaction["bookingDate"] transaction["ts"] = transaction["bookingDate"]
del transaction["bookingDate"] del transaction["bookingDate"]
elif transaction["valueDate"]:
transaction["ts"] = transaction["valueDate"]
del transaction["valueDate"]
transaction["amount"] = float(transaction["transactionAmount"]["amount"]) transaction["amount"] = float(transaction["transactionAmount"]["amount"])
transaction["currency"] = transaction["transactionAmount"]["currency"] transaction["currency"] = transaction["transactionAmount"]["currency"]