gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] 01/01: fix URL and permissions check on TWG facade


From: gnunet
Subject: [libeufin] 01/01: fix URL and permissions check on TWG facade
Date: Tue, 03 Aug 2021 14:26:33 +0200

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

dold pushed a commit to branch master
in repository libeufin.

commit c0751302ccd2b6c5af6f6b5240ae0655d45fc533
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Aug 3 14:25:33 2021 +0200

    fix URL and permissions check on TWG facade
---
 nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt | 27 ++++++++++++++--------
 .../main/kotlin/tech/libeufin/nexus/server/JSON.kt |  4 +++-
 .../tech/libeufin/nexus/server/NexusServer.kt      |  2 +-
 3 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
index bdeb91b..e20a0dc 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
@@ -299,7 +299,7 @@ private fun ingestOneIncomingTransaction(payment: 
NexusBankTransactionEntity, tx
         return
     }
     val reservePub = extractReservePubFromSubject(subject)
-    if (reservePub == null){
+    if (reservePub == null) {
         logger.warn("could not find reserve pub in remittance information")
         TalerInvalidIncomingPaymentEntity.new {
             this.payment = payment
@@ -332,8 +332,10 @@ private fun ingestOneIncomingTransaction(payment: 
NexusBankTransactionEntity, tx
 }
 
 fun maybePrepareRefunds(bankAccount: NexusBankAccountEntity, lastSeenId: Long) 
{
-    logger.debug("Searching refundable payments of account: ${bankAccount}," +
-            " after last seen transaction id: ${lastSeenId}")
+    logger.debug(
+        "Searching refundable payments of account: ${bankAccount}," +
+                " after last seen transaction id: ${lastSeenId}"
+    )
     transaction {
         TalerInvalidIncomingPaymentsTable.innerJoin(NexusBankTransactionsTable,
             { NexusBankTransactionsTable.id }, { 
TalerInvalidIncomingPaymentsTable.payment }).select {
@@ -347,8 +349,10 @@ fun maybePrepareRefunds(bankAccount: 
NexusBankAccountEntity, lastSeenId: Long) {
                 CamtBankAccountEntry::class.java
             )
             if (paymentData.batches == null) {
-                logger.error("A singleton batched payment was expected to be 
refunded," +
-                        " but none was found (in transaction (AcctSvcrRef): 
${paymentData.accountServicerRef})")
+                logger.error(
+                    "A singleton batched payment was expected to be refunded," 
+
+                            " but none was found (in transaction 
(AcctSvcrRef): ${paymentData.accountServicerRef})"
+                )
                 throw NexusError(HttpStatusCode.InternalServerError, 
"Unexpected void payment, cannot refund")
             }
             val debtorAccount = 
paymentData.batches[0].batchTransactions[0].details.debtorAccount
@@ -405,8 +409,10 @@ fun maybePrepareRefunds(bankAccount: 
NexusBankAccountEntity, lastSeenId: Long) {
  */
 fun ingestTalerTransactions(bankAccountId: String) {
     fun ingest(bankAccount: NexusBankAccountEntity, facade: FacadeEntity) {
-        logger.debug("Ingesting transactions for Taler facade 
${facade.id.value}," +
-                " and bank account: ${bankAccount.bankAccountName}")
+        logger.debug(
+            "Ingesting transactions for Taler facade ${facade.id.value}," +
+                    " and bank account: ${bankAccount.bankAccountName}"
+        )
         val facadeState = getTalerFacadeState(facade.facadeName)
         var lastId = facadeState.highestSeenMessageSerialId
         NexusBankTransactionEntity.find {
@@ -554,7 +560,10 @@ fun talerFacadeRoutes(route: Route, httpClient: 
HttpClient) {
 
     route.get("/config") {
         val facadeId = ensureNonNull(call.parameters["fcid"])
-        call.request.requirePermission(PermissionQuery("facade", facadeId, 
"facade.talerWireGateway.config"))
+        call.request.requirePermission(
+            PermissionQuery("facade", facadeId, 
"facade.talerWireGateway.transfer"),
+            PermissionQuery("facade", facadeId, 
"facade.talerWireGateway.history")
+        )
         call.respond(object {
             val version = "0.0.0"
             val name = "taler-wire-gateway"
@@ -575,7 +584,7 @@ fun talerFacadeRoutes(route: Route, httpClient: HttpClient) 
{
         return@get
     }
     route.get("") {
-        call.respondText("Hello, this is Taler Facade")
+        call.respondText("Hello, this is a Taler Facade")
         return@get
     }
 }
\ No newline at end of file
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
index 0ee5bbe..cf442fe 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
@@ -348,7 +348,9 @@ data class BankMessageInfo(
 data class FacadeShowInfo(
     val name: String,
     val type: String,
-    val baseUrl: String,
+    // Taler wire gateway API base URL.
+    // Different from the base URL of the facade.
+    val twgBaseUrl: String,
     val config: JsonNode
 )
 
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index 476aede..9b53c4b 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -890,7 +890,7 @@ fun serverMain(dbName: String, host: String, port: Int) {
                             FacadeShowInfo(
                                 name = it.facadeName,
                                 type = it.type,
-                                baseUrl = 
"http://${host}/facades/${it.id.value}/${it.type}/";,
+                                twgBaseUrl = 
"http://${host}/facades/${it.facadeName}/${it.type}/";,
                                 config = getFacadeState(it.type, it)
                             )
                         )

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