[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 02/02: add-incoming
From: |
gnunet |
Subject: |
[libeufin] 02/02: add-incoming |
Date: |
Mon, 14 Dec 2020 23:50:55 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
commit 606efcd0d67a844cdb165be8cd8f2f42ecc4c37f
Author: MS <ms@taler.net>
AuthorDate: Mon Dec 14 23:49:58 2020 +0100
add-incoming
Check that the Sandbox actually booked the
payment represented by Taler's /admin/add-incoming
endpoint.
---
nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
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.