Fix releasing mapped trades

This commit is contained in:
Mark Veidemanis 2022-04-23 19:39:09 +01:00
parent 2d9c458ce3
commit 32af22cff4
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 6 additions and 1 deletions

View File

@ -309,11 +309,15 @@ class Nordigen(util.Base):
self.log.error("Could not get requisitions.")
return {}
for req in requisitions:
print("REQ ITER", req)
if not req["accounts"]:
print("NOT REQ ACCOUNTS")
continue
accounts = self.get_accounts(req["id"])
for account_id in accounts:
print("ACCOUNT ID ITER", account_id)
account_info = self.get_account(account_id)
print("INFO", account_info)
if not account_info:
continue
if req["institution_id"] in to_return:

View File

@ -295,9 +295,10 @@ class Transactions(util.Base):
Return False if the trade already has a mapped transaction.
"""
existing_tx = r.hget(f"trade.{reference}", "tx")
print("existing_tx", existing_tx)
if existing_tx is None:
return None
elif existing_tx == "":
elif existing_tx == b"":
r.hset(f"trade.{reference}", "tx", txid)
return True
else: # Already a mapped transaction