|
|
|
@ -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
|
|
|
|
|