gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] 08/08: abstract over Camt type


From: gnunet
Subject: [libeufin] 08/08: abstract over Camt type
Date: Fri, 04 Dec 2020 15:00:11 +0100

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

ms pushed a commit to branch master
in repository libeufin.

commit ae7897d8bd68640e2bb327bbb8448b3b443fed3a
Author: MS <ms@taler.net>
AuthorDate: Fri Dec 4 13:24:28 2020 +0100

    abstract over Camt type
---
 integration-tests/tests.py                            | 8 ++++----
 sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt | 5 +++++
 sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 9 +++++----
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index c866545..27e2246 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -379,10 +379,10 @@ def test_sandbox_camt():
             json=payment_instruction
         )
     )
-    resp = assertResponse(
+
+    assertResponse(
         post(
-            f"{S}/admin/payments/camt/53",
-            data="GB33BUKB20201555555555"
+            f"{S}/admin/payments/camt",
+            json=dict(iban="GB33BUKB20201555555555", type=53)
         )
     )
-    print(resp.text)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
index 9716bc2..ad46123 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
@@ -77,6 +77,11 @@ data class DateRange(
     val endDate: Long
 )
 
+data class CamtParams(
+    val iban: String,
+    val type: Int
+)
+
 data class BankAccountStatements(
     var bankAccountStatements: MutableList<BankAccountStatement> = 
mutableListOf()
 )
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 330fee6..6ea2a02 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -235,10 +235,11 @@ fun serverMain(dbName: String) {
                 call.respondText("Hello, this is Sandbox\n", 
ContentType.Text.Plain)
             }
             // only reason for a post is to hide the iban (to some degree.)
-            post("/admin/payments/camt/53") {
-                val iban = call.receiveText()
-                val history = historyForAccount(iban)
-                val camt53 = buildCamtString(53, iban, history)
+            post("/admin/payments/camt") {
+                val body = call.receive<CamtParams>()
+                val history = historyForAccount(body.iban)
+                SandboxAssert(body.type == 53, "Only Camt.053 is implemented")
+                val camt53 = buildCamtString(body.type, body.iban, history)
                 call.respondText(camt53, ContentType.Text.Xml, 
HttpStatusCode.OK)
                 return@post
             }

-- 
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]