Add docstrings to transactions functions

pull/1/head
Mark Veidemanis 3 years ago
parent 66b138b324
commit 5d21953199
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -62,12 +62,15 @@ class Transactions(object):
r.hmset(f"tx.{txid}", to_store) r.hmset(f"tx.{txid}", to_store)
def find_tx(self, reference, amount): 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.*") all_transactions = r.scan(0, match="tx.*")
print(f"ALL {all_transactions}")
for tx_iter in all_transactions[1]: for tx_iter in all_transactions[1]:
tx_obj = r.hgetall(tx_iter) 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"reference"] == str.encode(reference):
if tx_obj[b"amount"] == str.encode(amount): if tx_obj[b"amount"] == str.encode(amount):
return tx_obj return tx_obj

Loading…
Cancel
Save