gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: listing raw bank accounts


From: gnunet
Subject: [libeufin] branch master updated: listing raw bank accounts
Date: Fri, 19 Jun 2020 17:16:12 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new af043ff  listing raw bank accounts
af043ff is described below

commit af043ff81663ae2e1029a3fde56e031f13a8adb4
Author: MS <ms@taler.net>
AuthorDate: Fri Jun 19 16:57:33 2020 +0200

    listing raw bank accounts
---
 .../kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt | 26 +++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
index 9309f8e..0493d21 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
@@ -423,7 +423,31 @@ fun Route.ebicsBankConnectionRoutes(client: HttpClient) {
     }
     get("/accounts") {
         val ret = BankAccounts()
-        call.respond(object {})
+        transaction {
+            val conn = requireBankConnection(call, "connid")
+            val hasXml = RawHTDResponseEntity.findById(conn.id.value) ?: throw 
NexusError(
+                HttpStatusCode.NotFound, "Bank connection ${conn.id.value} 
never called HTD"
+            )
+            val payload = 
XMLUtil.convertStringToJaxb<HTDResponseOrderData>(hasXml.htdResponse)
+            payload.value.partnerInfo.accountInfoList?.forEach {
+                ret.accounts.add(
+                    BankAccount(
+                        holder = it.accountHolder ?: "NOT-GIVEN",
+                        iban = 
it.accountNumberList?.filterIsInstance<EbicsTypes.GeneralAccountNumber>()
+                            ?.find { it.international }?.value
+                            ?: throw NexusError(HttpStatusCode.NotFound, 
reason = "bank gave no IBAN"),
+                        bic = 
it.bankCodeList?.filterIsInstance<EbicsTypes.GeneralBankCode>()
+                            ?.find { it.international }?.value
+                            ?: throw NexusError(
+                                HttpStatusCode.NotFound,
+                                reason = "bank gave no BIC"
+                            ),
+                        account = it.id
+                    )
+                )
+            }
+        }
+        call.respond(ret)
     }
     post("/account/import") {
         call.respond(object {})

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]