diff options
author | Florian Dold <florian@dold.me> | 2021-08-03 14:25:33 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-08-03 14:26:16 +0200 |
commit | c0751302ccd2b6c5af6f6b5240ae0655d45fc533 (patch) | |
tree | be1ed57233c6831b9c5c5ec667e670e56a99c607 /nexus | |
parent | affbce0a3d4be52ca0663eb87c8fb7d28de8e5a1 (diff) | |
download | libeufin-c0751302ccd2b6c5af6f6b5240ae0655d45fc533.tar.gz libeufin-c0751302ccd2b6c5af6f6b5240ae0655d45fc533.tar.bz2 libeufin-c0751302ccd2b6c5af6f6b5240ae0655d45fc533.zip |
fix URL and permissions check on TWG facade
Diffstat (limited to 'nexus')
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 bdeb91bd..e20a0dce 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 0ee5bbeb..cf442fea 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 476aede5..9b53c4bf 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) ) ) |