From 5d2195319987405aa6d1a1b9c7b7b42bc877b1c9 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 27 Dec 2021 21:02:38 +0000 Subject: [PATCH] Add docstrings to transactions functions --- handler/transactions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/handler/transactions.py b/handler/transactions.py index a24dc1a..408064a 100644 --- a/handler/transactions.py +++ b/handler/transactions.py @@ -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