libeufin

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

commit d7dc764e1c19022a5d1fd3a73c02096c3cd75af4
parent e61efb3a0f48d315ec2b4d2d162ab48b3e3b9052
Author: MS <ms@taler.net>
Date:   Sun, 21 Jun 2020 00:11:47 +0200

list accounts under custom name

Diffstat:
Mcli/libeufin-cli-new | 16++++++++++++++++
Mnexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt | 14+++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/cli/libeufin-cli-new b/cli/libeufin-cli-new @@ -175,6 +175,22 @@ def download_bank_accounts(obj, connection_name, nexus_user_id, nexus_password, print(resp.content.decode("utf-8")) +@bank_connection.command(help="list imported bank accounts") +@click.option("--connection-name", help="Connection ID", required=True) +@click.option("--nexus-user-id", help="Nexus user ID", required=True) +@click.option("--nexus-password", help="Nexus password", required=True) +@click.argument("nexus-base-url") +@click.pass_obj +def list_imported_bank_accounts(obj, connection_name, nexus_user_id, nexus_password, nexus_base_url): + # FIXME/NOTE: the 'ebics' part will soon go away. + url = urljoin(nexus_base_url, "/bank-connections/{}/ebics/accounts/imported".format(connection_name)) + try: + resp = get(url, json=dict(), auth = auth.HTTPBasicAuth(nexus_user_id, nexus_password)) + except Exception: + print("Could not reach nexus") + return + print(resp.content.decode("utf-8")) + @bank_connection.command(help="list raw bank account information locally stored") @click.option("--connection-name", help="Connection ID", required=True) @click.option("--nexus-user-id", help="Nexus user ID", required=True) diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt @@ -422,6 +422,18 @@ fun Route.ebicsBankConnectionRoutes(client: HttpClient) { } call.respond(object {}) } + get("/accounts/imported") { + var ret = BankAccounts() + transaction { + val conn = requireBankConnection(call, "connid") + NexusBankAccountEntity.find { + NexusBankAccountsTable.defaultBankConnection eq conn.id.value + }.forEach { ret.accounts.add( + BankAccount(holder = it.accountHolder, iban = it.iban, bic = it.bankCode, account = it.id.value) + ) } + } + call.respond(ret) + } get("/accounts") { val ret = BankAccounts() transaction { @@ -453,7 +465,7 @@ fun Route.ebicsBankConnectionRoutes(client: HttpClient) { post("/accounts/import") { val body = call.receive<ImportBankAccount>() transaction { - val conn = requireBankConnection(call, "callid") + val conn = requireBankConnection(call, "connid") val hasXml = RawHTDResponseEntity.findById(conn.id.value) ?: throw NexusError( HttpStatusCode.NotFound, "Could not found raw bank account data for connection '${conn.id.value}'" )