libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 7a38d56d81fb556f0e0c8738b9747dab396487bd
parent 0e716df72a0e424754dd1f33aceff81e799f68b5
Author: Antoine A <>
Date:   Wed,  2 Jul 2025 13:28:25 +0200

nexus: improve list output

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/cli/Testing.kt | 82++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
Mnexus/src/main/kotlin/tech/libeufin/nexus/db/ListDAO.kt | 3+++
2 files changed, 49 insertions(+), 36 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/cli/Testing.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/cli/Testing.kt @@ -229,52 +229,62 @@ class ListCmd: CliktCommand("list") { ListKind.incoming -> { val txs = db.list.incoming() for (tx in txs) { - if (tx.creditFee.isZero()) { - println("${tx.date} ${tx.id} ${tx.amount}") - } else { - println("${tx.date} ${tx.id} ${tx.amount}-${tx.creditFee}") - } - if (tx.debtor != null) { - println(" debtor: ${fmtPayto(tx.debtor)}") - } - if (tx.subject != null) { - println(" subject: ${tx.subject}") - } - if (tx.talerable != null) { - println(" talerable: ${tx.talerable}") - } - if (tx.bounced != null) { - println(" bounced: ${tx.bounced}") - } - println() + println(buildString{ + if (tx.creditFee.isZero()) { + append("${tx.date} ${tx.id} ${tx.amount}\n") + } else { + append("${tx.date} ${tx.id} ${tx.amount}-${tx.creditFee}\n") + } + if (tx.debtor != null) { + append(" debtor: ${fmtPayto(tx.debtor)}\n") + } + if (tx.subject != null) { + append(" subject: ${tx.subject}\n") + } + if (tx.talerable != null) { + append(" talerable: ${tx.talerable}\n") + } + if (tx.bounced != null) { + append(" bounced: ${tx.bounced}\n") + } + }) } } ListKind.outgoing -> { val txs = db.list.outgoing() for (tx in txs) { - println("${tx.date} ${tx.id} ${tx.amount}") - if (tx.creditor != null) { - println(" creditor: ${fmtPayto(tx.creditor)}") - } - println(" subject: ${tx.subject}") - if (tx.wtid != null) { - println(" talerable: ${tx.wtid} ${tx.exchangeBaseUrl}") - } - println() + println(buildString{ + append("${tx.date} ${tx.id} ${tx.amount}\n") + if (tx.creditor != null) { + append(" creditor: ${fmtPayto(tx.creditor)}\n") + } + append(" subject: ${tx.subject}\n") + if (tx.wtid != null) { + append(" talerable: ${tx.wtid} ${tx.exchangeBaseUrl}\n") + } + }) } } ListKind.initiated -> { val txs = db.list.initiated() for (tx in txs) { - println("${tx.date} ${tx.id} ${tx.amount}") - println(" creditor: ${fmtPayto(tx.creditor)}") - println(" subject: ${tx.subject}") - if (tx.batch != null) { - println(" batch: ${tx.batch}") - } - println(" submission: ${tx.submissionTime} ${tx.submissionCounter}") - println(" status: ${tx.status} ${tx.msg ?: ""}") - println() + println(buildString{ + append("${tx.date} ${tx.id} ${tx.amount}\n") + append(" creditor: ${fmtPayto(tx.creditor)}\n") + append(" subject: ${tx.subject}\n") + if (tx.batch != null) { + append(" batch: ${tx.batch}") + if (tx.batchOrder != null) + append(" ${tx.batchOrder}") + append('\n') + } + append(" submission: ${tx.submissionTime} ${tx.submissionCounter}\n") + append(" status: ${tx.status}") + if (tx.msg != null) { + append(" ${tx.msg}") + } + append('\n') + }) } } } diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/db/ListDAO.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/db/ListDAO.kt @@ -124,6 +124,7 @@ class ListDAO(private val db: Database) { ,credit_payto ,end_to_end_id ,message_id + ,order_id ,initiated_outgoing_transactions.status ,initiated_outgoing_transactions.status_msg FROM initiated_outgoing_transactions @@ -139,6 +140,7 @@ class ListDAO(private val db: Database) { creditor = it.getString("credit_payto"), id = it.getString("end_to_end_id"), batch = it.getString("message_id"), + batchOrder = it.getString("order_id"), status = it.getString("status"), msg = it.getString("status_msg"), submissionTime = it.getLong("submission_date").asInstant(), @@ -179,6 +181,7 @@ data class InitiatedTxMetadata( val creditor: String, val id: String, val batch: String?, + val batchOrder: String?, val status: String, val msg: String?, val submissionTime: Instant,