gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Extend history API.


From: gnunet
Subject: [libeufin] branch master updated: Extend history API.
Date: Tue, 11 Jan 2022 14:02:47 +0100

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 e13dde4e Extend history API.
e13dde4e is described below

commit e13dde4e98108276635880fa414571bd5b72f49e
Author: ms <ms@taler.net>
AuthorDate: Tue Jan 11 14:02:28 2022 +0100

    Extend history API.
---
 .../src/main/kotlin/tech/libeufin/sandbox/Main.kt  | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index a74fd970..f55fc72c 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -1279,6 +1279,27 @@ val sandboxApp: Application.() -> Unit = {
                     })
                     return@get
                 }
+                get("/accounts/{account_name}/transactions/{tId}") {
+                    val demobank = ensureDemobank(call)
+                    val bankAccount = getBankAccountFromLabel(
+                        call.getUriComponent("account_name"),
+                        demobank
+                    )
+                    val authOk: Boolean = bankAccount.isPublic || (!WITH_AUTH)
+                    if (!authOk && (call.request.basicAuth() != 
bankAccount.owner)) throw forbidden(
+                        "Cannot access bank account ${bankAccount.label}"
+                    )
+                    // Flow here == Right on the bank account.
+                    val tId = call.parameters["tId"] ?: throw badRequest("URI 
didn't contain the transaction ID")
+                    val tx: BankAccountTransactionEntity? = transaction {
+                        BankAccountTransactionEntity.find {
+                            
BankAccountTransactionsTable.accountServicerReference eq tId
+                        }.firstOrNull()
+                    }
+                    if (tx == null) throw notFound("Transaction $tId wasn't 
found")
+                    call.respond(getHistoryElementFromTransactionRow(tx))
+                    return@get
+                }
                 get("/accounts/{account_name}/transactions") {
                     val demobank = ensureDemobank(call)
                     val bankAccount = getBankAccountFromLabel(
@@ -1321,7 +1342,7 @@ val sandboxApp: Application.() -> Unit = {
                             }
                         }
                     }
-                    call.respond(ret)
+                    call.respond(object {val transactions = ret})
                     return@get
                 }
                 get("/public-accounts") {

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