[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: x-libeufin-bank connection.
From: |
gnunet |
Subject: |
[libeufin] branch master updated: x-libeufin-bank connection. |
Date: |
Sat, 01 Apr 2023 22:30:22 +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 ee10f1d3 x-libeufin-bank connection.
ee10f1d3 is described below
commit ee10f1d3346c3bf5d5c9820146cdaad50b85d466
Author: MS <ms@taler.net>
AuthorDate: Sat Apr 1 22:29:45 2023 +0200
x-libeufin-bank connection.
Adding the method to show the connection details.
---
.../nexus/xlibeufinbank/XLibeufinBankNexus.kt | 12 +++++++++++-
nexus/src/test/kotlin/XLibeufinBankTest.kt | 20 ++++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git
a/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
index f83046c3..9c2596cf 100644
---
a/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
+++
b/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
@@ -1,6 +1,7 @@
package tech.libeufin.nexus.xlibeufinbank
import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import io.ktor.client.*
import io.ktor.client.plugins.*
@@ -99,7 +100,16 @@ class XlibeufinBankConnectionProtocol :
BankConnectionProtocol {
}
override fun getConnectionDetails(conn: NexusBankConnectionEntity):
JsonNode {
- TODO("Not yet implemented")
+ val credentials = getXLibeufinBankCredentials(conn)
+ val mapper = ObjectMapper()
+ val details = mapper.createObjectNode()
+ details.put("baseUrl", credentials.baseUrl)
+ details.put("username", credentials.username)
+ val node = mapper.createObjectNode()
+ node.put("type", conn.type)
+ node.put("owner", conn.owner.username)
+ node.set<JsonNode>("details", details)
+ return node
}
override fun exportBackup(bankConnectionId: String, passphrase: String):
JsonNode {
diff --git a/nexus/src/test/kotlin/XLibeufinBankTest.kt
b/nexus/src/test/kotlin/XLibeufinBankTest.kt
index 852caff4..84fa547b 100644
--- a/nexus/src/test/kotlin/XLibeufinBankTest.kt
+++ b/nexus/src/test/kotlin/XLibeufinBankTest.kt
@@ -1,5 +1,8 @@
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import io.ktor.client.plugins.*
+import io.ktor.client.request.*
+import io.ktor.client.statement.*
import io.ktor.server.testing.*
import org.jetbrains.exposed.sql.transactions.transaction
import org.junit.Test
@@ -137,4 +140,21 @@ class XLibeufinBankTest {
}
}
}
+
+ // Testing that Nexus responds with correct connection details.
+ // Currently only testing that the request doesn't throw any error.
+ @Test
+ fun connectionDetails() {
+ withTestDatabase {
+ prepNexusDb()
+ testApplication {
+ application(nexusApp)
+ val r = client.get("/bank-connections/bar") {
+ basicAuth("bar", "bar")
+ expectSuccess = true
+ }
+ println(r.bodyAsText())
+ }
+ }
+ }
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: x-libeufin-bank connection.,
gnunet <=