Implement serde for JSON deserialisation

This commit is contained in:
2022-03-25 18:04:17 +00:00
parent a69a585c71
commit b3a39401b5
2 changed files with 73 additions and 46 deletions

View File

@@ -541,7 +541,7 @@ class IRCCommands(object):
class transactions(object):
name = "transactions"
authed = True
helptext = "Get a list of transactions. Usage: transactions <account> <account_id>"
helptext = "Get a list of transactions from TrueLayer. Usage: transactions <account> <account_id>"
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
@@ -559,6 +559,27 @@ class IRCCommands(object):
description = transaction["description"]
msg(f"{timestamp} {txid} {ptxid} {txtype} {amount}{currency} {description}")
class ntransactions(object):
name = "ntransactions"
authed = True
helptext = "Get a list of transactions from Nordigen. Usage: ntransactions <account_id>"
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
if length == 2:
account_id = spl[1]
transactions = tx.sinks.nordigen.get_transactions(account_id)
for transaction in transactions:
msg(dumps(transaction))
# txid = transaction["transaction_id"]
# ptxid = transaction["meta"]["provider_transaction_id"]
# txtype = transaction["transaction_type"]
# timestamp = transaction["timestamp"]
# amount = transaction["amount"]
# currency = transaction["currency"]
# description = transaction["description"]
# msg(f"{timestamp} {txid} {ptxid} {txtype} {amount}{currency} {description}")
class mapaccount(object):
name = "mapaccount"
authed = True