libeufin

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

commit a35695866144b15d7ecd02af201371cf0c073721
parent af21b276ffbcfbaa41c7586f38a547c56b39cdee
Author: Antoine A <>
Date:   Sun, 15 Feb 2026 22:03:36 +0100

nexus: add IBAN generation command

Diffstat:
Mlibeufin-nexus/src/main/kotlin/tech/libeufin/nexus/cli/Testing.kt | 46+++++++++++++++++++++++++++++++++-------------
1 file changed, 33 insertions(+), 13 deletions(-)

diff --git a/libeufin-nexus/src/main/kotlin/tech/libeufin/nexus/cli/Testing.kt b/libeufin-nexus/src/main/kotlin/tech/libeufin/nexus/cli/Testing.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2024-2025 Taler Systems S.A. + * Copyright (C) 2024, 2025, 2026 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -28,6 +28,7 @@ import com.github.ajalt.clikt.parameters.options.convert import com.github.ajalt.clikt.parameters.options.default import com.github.ajalt.clikt.parameters.options.flag import com.github.ajalt.clikt.parameters.options.option +import com.github.ajalt.clikt.parameters.options.required import com.github.ajalt.clikt.parameters.types.* import com.github.ajalt.mordant.terminal.* import tech.libeufin.common.* @@ -39,7 +40,7 @@ import java.util.zip.* import java.time.Instant import java.io.* -class Wss: TalerCmd() { +class Wss : TalerCmd() { override fun help(context: Context) = "Listen to EBICS instant notification over websocket" private val ebicsLog by ebicsLogOption() @@ -66,7 +67,7 @@ class Wss: TalerCmd() { } } -class FakeIncoming: TalerCmd() { +class FakeIncoming : TalerCmd() { override fun help(context: Context) = "Genere a fake incoming payment" private val amount by option( @@ -93,8 +94,9 @@ class FakeIncoming: TalerCmd() { require(amount.currency == cfg.currency) { "Wrong currency: expected ${cfg.currency} got ${amount.currency}" } - - registerIncomingPayment(db, cfg.ingest, + + registerIncomingPayment( + db, cfg.ingest, IncomingPayment( amount = amount, debtor = payto, @@ -108,7 +110,7 @@ class FakeIncoming: TalerCmd() { } } -class TxCheck: TalerCmd() { +class TxCheck : TalerCmd() { override fun help(context: Context) = "Check transaction semantic" override fun run() = cliCmd(logger) { @@ -134,9 +136,9 @@ enum class ListKind { } } -class EbicsDownload: TalerCmd("ebics-btd") { +class EbicsDownload : TalerCmd("ebics-btd") { override fun help(context: Context) = "Perform EBICS requests" - + private val type by option().default("BTD") private val name by option() private val scope by option() @@ -150,12 +152,13 @@ class EbicsDownload: TalerCmd("ebics-btd") { " to download (only consumed in --transient mode). The" + " latest document is always until the current time." ) - private val peek by option("--peek", + private val peek by option( + "--peek", help = "Do not consume fetched documents" ).flag() private val dryRun by option().flag() - class DryRun: Exception() + class DryRun : Exception() override fun run() = cliCmd(logger) { nexusConfig(config).withDb { db, cfg -> @@ -197,12 +200,30 @@ class EbicsDownload: TalerCmd("ebics-btd") { } } +class IbanGen : CliktCommand("gen") { + override fun help(context: Context) = "Generate fake IBANs for testing" + + private val country by option().enum<Country>().required() + + override fun run() { + println(IBAN.rand(country)) + } +} + +class IbanCmd : CliktCommand("iban") { + init { + subcommands(IbanGen()) + } + + override fun run() = Unit +} + class TestingCmd : CliktCommand("testing") { init { - subcommands(FakeIncoming(), ListCmd(), EbicsDownload(), TxCheck(), Wss()) + subcommands(IbanCmd(), FakeIncoming(), ListCmd(), EbicsDownload(), TxCheck(), Wss()) } override fun help(context: Context) = "Testing helper commands" override fun run() = Unit -} -\ No newline at end of file +}