gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: improve error response for withd


From: gnunet
Subject: [taler-exchange] branch master updated: improve error response for withdrawal
Date: Mon, 10 Jan 2022 01:23:49 +0100

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

dold pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 14efa23a improve error response for withdrawal
14efa23a is described below

commit 14efa23a2b73420593d62cc346466ff0ab322668
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Jan 10 01:23:46 2022 +0100

    improve error response for withdrawal
---
 contrib/gana                                 | 2 +-
 src/exchange/taler-exchange-httpd_withdraw.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/contrib/gana b/contrib/gana
index b0dd85e8..9b8a7875 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit b0dd85e8187f33a1f92dd5eb31082050d333e168
+Subproject commit 9b8a787580307cea5a38359c485d521cd8ece820
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c 
b/src/exchange/taler-exchange-httpd_withdraw.c
index 2e53803a..53ba270b 100644
--- a/src/exchange/taler-exchange-httpd_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -40,6 +40,7 @@
  *
  * @param connection connection to the client
  * @param ebalance expected balance based on our database
+ * @param withdraw_amount amount that the client requested to withdraw
  * @param rh reserve history to return
  * @return MHD result code
  */
@@ -47,6 +48,7 @@ static MHD_RESULT
 reply_withdraw_insufficient_funds (
   struct MHD_Connection *connection,
   const struct TALER_Amount *ebalance,
+  const struct TALER_Amount *withdraw_amount,
   const struct TALER_EXCHANGEDB_ReserveHistory *rh)
 {
   json_t *json_history;
@@ -76,6 +78,8 @@ reply_withdraw_insufficient_funds (
     TALER_JSON_pack_ec (TALER_EC_EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS),
     TALER_JSON_pack_amount ("balance",
                             &balance),
+    TALER_JSON_pack_amount ("requested_amount",
+                            withdraw_amount),
     GNUNET_JSON_pack_array_steal ("history",
                                   json_history));
 }
@@ -174,6 +178,7 @@ withdraw_transaction (void *cls,
   {
     struct TALER_EXCHANGEDB_ReserveHistory *rh;
     struct TALER_Amount balance;
+    struct TALER_Amount requested_amount;
 
     TEH_plugin->rollback (TEH_plugin->cls);
     // FIXME: maybe start read-committed here?
@@ -204,8 +209,11 @@ withdraw_transaction (void *cls,
                                                "reserve history");
       return GNUNET_DB_STATUS_HARD_ERROR;
     }
+    TALER_amount_ntoh (&requested_amount,
+                       &wc->wsrd.amount_with_fee);
     *mhd_ret = reply_withdraw_insufficient_funds (connection,
                                                   &balance,
+                                                  &requested_amount,
                                                   rh);
     TEH_plugin->free_reserve_history (TEH_plugin->cls,
                                       rh);

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