gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-bank] branch master updated: don't error on consiste


From: gnunet
Subject: [GNUnet-SVN] [taler-bank] branch master updated: don't error on consistent, repeated withdraw data
Date: Sun, 01 Sep 2019 00:11:51 +0200

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

dold pushed a commit to branch master
in repository bank.

The following commit(s) were added to refs/heads/master by this push:
     new 820685c  don't error on consistent, repeated withdraw data
820685c is described below

commit 820685c6ea5b9e425f45c6af2c3a5e3d71586415
Author: Florian Dold <address@hidden>
AuthorDate: Sun Sep 1 00:11:48 2019 +0200

    don't error on consistent, repeated withdraw data
---
 talerbank/app/views.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 920bd04..3762ddf 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -900,11 +900,6 @@ def api_withdraw_operation(request, withdraw_id):
     host = request.get_host()
 
     if request.method == "POST":
-        if op.selection_done or op.withdraw_done:
-            return JsonResponse(
-                dict(error="selection of withdraw parameters already done"),
-                status=409
-            )
         data = json.loads(request.body.decode("utf-8"))
         exchange_payto_uri = data.get("selected_exchange")
         try:
@@ -919,12 +914,23 @@ def api_withdraw_operation(request, withdraw_id):
             return JsonResponse(
                 dict(error="bank accound in payto URI unknown"), status=400
             )
-        op.selected_exchange_account = exchange_acct
         selected_reserve_pub = data.get("reserve_pub")
         if not isinstance(selected_reserve_pub, str):
             return JsonResponse(
                 dict(error="reserve_pub must be a string"), status=400
             )
+        if op.selection_done or op.withdraw_done:
+            if (
+                op.selected_exchange_account != exchange_acct
+                or op.selected_reserve_pub != selected_reserve_pub
+            ):
+                return JsonResponse(
+                    dict(error="selection of withdraw parameters already 
done"),
+                    status=409
+                )
+            # No conflict, same data!
+            return JsonResponse(dict(), status=200)
+        op.selected_exchange_account = exchange_acct
         op.selected_reserve_pub = selected_reserve_pub
         op.selection_done = True
         op.save()

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]