gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Responding to POST /withdrawals.


From: gnunet
Subject: [libeufin] branch master updated: Responding to POST /withdrawals.
Date: Tue, 19 Sep 2023 14:59:28 +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 4604071f Responding to POST /withdrawals.
4604071f is described below

commit 4604071f1baa7f8d297295ddccb97b8e3adf1e5a
Author: MS <ms@taler.net>
AuthorDate: Tue Sep 19 14:58:46 2023 +0200

    Responding to POST /withdrawals.
---
 bank/src/main/kotlin/tech/libeufin/bank/talerWebHandlers.kt | 5 ++++-
 util/src/main/kotlin/HTTP.kt                                | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/bank/src/main/kotlin/tech/libeufin/bank/talerWebHandlers.kt 
b/bank/src/main/kotlin/tech/libeufin/bank/talerWebHandlers.kt
index 8d6fd3d6..bf06f21f 100644
--- a/bank/src/main/kotlin/tech/libeufin/bank/talerWebHandlers.kt
+++ b/bank/src/main/kotlin/tech/libeufin/bank/talerWebHandlers.kt
@@ -29,6 +29,7 @@ import io.ktor.server.request.*
 import io.ktor.server.response.*
 import io.ktor.server.routing.*
 import net.taler.common.errorcodes.TalerErrorCode
+import tech.libeufin.util.getBaseUrl
 import java.util.*
 
 fun Routing.talerWebHandlers() {
@@ -65,9 +66,11 @@ fun Routing.talerWebHandlers() {
         )
             throw internalServerError("Bank failed at creating the withdraw 
operation.")
 
+        val bankBaseUrl = call.request.getBaseUrl()
+            ?: throw internalServerError("Bank could not find its base URL")
         call.respond(BankAccountCreateWithdrawalResponse(
             withdrawal_id = opId.toString(),
-            taler_withdraw_uri = "FIXME"
+            taler_withdraw_uri = getTalerWithdrawUri(bankBaseUrl, 
opId.toString())
         ))
         return@post
     }
diff --git a/util/src/main/kotlin/HTTP.kt b/util/src/main/kotlin/HTTP.kt
index 9bb769ea..ac3a51bc 100644
--- a/util/src/main/kotlin/HTTP.kt
+++ b/util/src/main/kotlin/HTTP.kt
@@ -8,7 +8,7 @@ import io.ktor.server.util.*
 import io.ktor.util.*
 import logger
 
-// Get the base URL of a request; handles proxied case.
+// Get the base URL of a request, returns null if any problem occurs.
 fun ApplicationRequest.getBaseUrl(): String? {
     return if (this.headers.contains("X-Forwarded-Host")) {
         logger.info("Building X-Forwarded- base URL")

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