gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] 05/07: Withdrawal.


From: gnunet
Subject: [libeufin] 05/07: Withdrawal.
Date: Mon, 20 Dec 2021 17:44:48 +0100

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

ms pushed a commit to branch master
in repository libeufin.

commit 19d8bb16014c969590e190ce617b020ac6e0fd31
Author: ms <ms@taler.net>
AuthorDate: Sun Dec 19 22:09:47 2021 +0100

    Withdrawal.
    
    Not checking idempotency for confirmed withdrawals.
---
 sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 7cfd3915..b2dd5a93 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -1041,11 +1041,9 @@ val sandboxApp: Application.() -> Unit = {
                         }.firstOrNull() ?: throw SandboxError(
                             HttpStatusCode.NotFound, "Withdrawal operation 
$wopid not found."
                         )
-                        /**
-                         * Check for idempotency.  Note: to spare one 'if' 
statement,
-                         * the check happens even for 'confirmed' (= already 
paid) withdrawal
-                         * operations.
-                         */
+                        if (wo.confirmationDone) {
+                            return@newSuspendedTransaction true
+                        }
                         if (wo.selectionDone) {
                             if (body.reserve_pub != wo.reservePub) throw 
SandboxError(
                                 HttpStatusCode.Conflict,
@@ -1055,7 +1053,7 @@ val sandboxApp: Application.() -> Unit = {
                                 HttpStatusCode.Conflict,
                                 "Selecting a different exchange from the one 
already selected"
                             )
-                            return@newSuspendedTransaction wo.confirmationDone
+                            return@newSuspendedTransaction false
                         }
                         // Flow here means never selected, hence must as well 
never be paid.
                         if (wo.confirmationDone) throw internalServerError(
@@ -1063,10 +1061,9 @@ val sandboxApp: Application.() -> Unit = {
                                     "but is marked as paid!"
                         )
                         wo.reservePub = body.reserve_pub
-                        val demobank = ensureDemobank(call)
                         wo.selectedExchangePayto = body.selected_exchange
                         wo.selectionDone = true
-                        wo.confirmationDone // == false
+                        false
                     }
                     call.respond(object {
                         val transfer_done: Boolean = transferDone

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