libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 606efcd0d67a844cdb165be8cd8f2f42ecc4c37f
parent 4a37f9de87c29e20178e989f404469bb7e45719e
Author: MS <ms@taler.net>
Date:   Mon, 14 Dec 2020 23:49:58 +0100

add-incoming

Check that the Sandbox actually booked the
payment represented by Taler's /admin/add-incoming
endpoint.

Diffstat:
Mnexus/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 @@ -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(