gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: detect double withdraw


From: gnunet
Subject: [libeufin] branch master updated: detect double withdraw
Date: Sun, 19 Sep 2021 15:30:50 +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 fab22e8  detect double withdraw
fab22e8 is described below

commit fab22e862f8183e90926353d5a95b15d30b8e5f2
Author: ms <ms@taler.net>
AuthorDate: Sun Sep 19 15:30:47 2021 +0200

    detect double withdraw
---
 sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index f51e287..296f83d 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -1038,16 +1038,25 @@ fun serverMain(dbName: String, port: Int) {
              * is as well collected in this request.
              */
             post("/api/withdrawal-operation/{wopid}") {
+
                 val wopid: String = ensureNonNull(call.parameters["wopid"])
-                logger.debug("Confirming withdraw operation: $wopid")
                 val body = call.receiveJson<TalerWithdrawalConfirmation>()
-                logger.debug("Withdrawal confirmation valid.")
+
                 transaction {
                     var wo = TalerWithdrawalEntity.find {
                         TalerWithdrawalsTable.wopid eq UUID.fromString(wopid)
                     }.firstOrNull() ?: throw SandboxError(
                         HttpStatusCode.NotFound, "Withdrawal operation $wopid 
not found."
                     )
+                    if (wo.transferDone) {
+                        throw SandboxError(
+                            HttpStatusCode.Conflict,
+                            "This withdraw operation was already funded.  
Aborting"
+                        )
+                    }
+                    if (wo.selectionDone) {
+                        logger.warn("This withdraw operation was already 
confirmed, but not funded.  Trying again")
+                    }
                     wireTransfer(
                         "sandbox-account-customer",
                         "sandbox-account-exchange",

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