gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated (d03fda8 -> 606efcd)


From: gnunet
Subject: [libeufin] branch master updated (d03fda8 -> 606efcd)
Date: Mon, 14 Dec 2020 23:50:53 +0100

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

ms pushed a change to branch master
in repository libeufin.

    from d03fda8  allowing subjects broken into multiple lines
     new 4a37f9d  add-incoming passes
     new 606efcd  add-incoming

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 integration-tests/tests.py                         | 13 ++++++++++++-
 integration-tests/util.py                          |  7 +++++--
 nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt |  9 ++++++++-
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index 9c22591..8cecec2 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -258,7 +258,18 @@ def test_taler_facade_config(make_taler_facade):
     )
 
 
-def test_taler_facade_history(make_taler_facade):
+def test_taler_facade_incoming(make_taler_facade):
+    assertResponse(post(
+        
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler/admin/add-incoming",
+        json=dict(
+            amount="EUR:1",
+            reserve_pub="not ingested for now",
+            debit_account="payto://iban/THEIBAN/THEBIC?sender-name=TheName"
+        ),
+        auth=PERSONA.nexus.auth
+    ))
+
+def test_taler_facade_outgoing(make_taler_facade):
     assertResponse(
         post(
             
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler/transfer",
diff --git a/integration-tests/util.py b/integration-tests/util.py
index bba34df..a7fbbac 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -193,6 +193,9 @@ def startNexus(dbConnString):
     return nexus
 
 def assertResponse(r, acceptedResponses=[200]):
-    assert r.status_code in acceptedResponses, \
-        f"Unexpected status code (r.status_code) from: {r.request.method} 
{r.url}"
+    def http_trace(r):
+        request = f"{r.request.method} 
{r.request.url}\n{r.request.body.decode('utf-8')}"
+        response = f"{r.status_code} {r.reason}\n{r.text}"
+        return f"(the following communication 
failed)\n\n{request}\n\n{response}"
+    assert r.status_code in acceptedResponses, http_trace(r)
     return r
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
index 184fbe6..ed201e8 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
@@ -24,6 +24,7 @@ import io.ktor.application.ApplicationCall
 import io.ktor.application.call
 import io.ktor.client.HttpClient
 import io.ktor.client.request.post
+import io.ktor.client.statement.*
 import io.ktor.content.TextContent
 import io.ktor.http.ContentType
 import io.ktor.http.HttpStatusCode
@@ -317,7 +318,7 @@ private suspend fun talerAddIncoming(call: ApplicationCall, 
httpClient: HttpClie
         }
     }
     /** forward the payment information to the sandbox.  */
-    httpClient.post<String>(
+    val response = httpClient.post<HttpResponse>(
         urlString = "http://localhost:5000/admin/payments";,
         block = {
             /** FIXME: ideally Jackson should define such request body.  */
@@ -336,6 +337,12 @@ private suspend fun talerAddIncoming(call: 
ApplicationCall, httpClient: HttpClie
             contentType(ContentType.Application.Json)
         }
     )
+    if (response.status != HttpStatusCode.OK) {
+        throw NexusError(
+            HttpStatusCode.InternalServerError,
+            "Could not forward the 'add-incoming' payment to the bank 
(sandbox)"
+        )
+    }
     return call.respond(
         TextContent(
             customConverter(

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