Add docstrings to transactions functions

This commit is contained in:
Mark Veidemanis 2021-12-27 21:02:38 +00:00
parent 66b138b324
commit 5d21953199
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 6 additions and 3 deletions

View File

@ -62,12 +62,15 @@ class Transactions(object):
r.hmset(f"tx.{txid}", to_store)
def find_tx(self, reference, amount):
"""
Find transactions that match the given reference and amount.
:param reference: transaction reference in Revolut
:param amount: transaction amount
:return: transaction details or AMOUNT_INVALID, or False
"""
all_transactions = r.scan(0, match="tx.*")
print(f"ALL {all_transactions}")
for tx_iter in all_transactions[1]:
tx_obj = r.hgetall(tx_iter)
print(f"ITER {tx_iter}")
print(f"OBJ {tx_obj}")
if tx_obj[b"reference"] == str.encode(reference):
if tx_obj[b"amount"] == str.encode(amount):
return tx_obj