summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-11-08 14:56:32 +0100
committerChristian Grothoff <christian@grothoff.org>2022-11-08 14:56:32 +0100
commitfe18c104d8a8d3667b3c872078549c7e78c71db0 (patch)
tree31bdd37cd3fe5a247e25a4b0c807dc364e7c7d4c /src/exchange
parent55f1217a3313876a8c5f5ea24be9bd81dc922910 (diff)
downloadexchange-fe18c104d8a8d3667b3c872078549c7e78c71db0.tar.gz
exchange-fe18c104d8a8d3667b3c872078549c7e78c71db0.tar.bz2
exchange-fe18c104d8a8d3667b3c872078549c7e78c71db0.zip
-fix #7428
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_batch-withdraw.c1
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_history.c2
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_open.c1
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c11
-rw-r--r--src/exchange/taler-exchange-httpd_responses.h2
-rw-r--r--src/exchange/taler-exchange-httpd_withdraw.c1
6 files changed, 13 insertions, 5 deletions
diff --git a/src/exchange/taler-exchange-httpd_batch-withdraw.c b/src/exchange/taler-exchange-httpd_batch-withdraw.c
index cf2382042..541d65728 100644
--- a/src/exchange/taler-exchange-httpd_batch-withdraw.c
+++ b/src/exchange/taler-exchange-httpd_batch-withdraw.c
@@ -240,6 +240,7 @@ batch_withdraw_transaction (void *cls,
TEH_plugin->rollback (TEH_plugin->cls);
*mhd_ret = TEH_RESPONSE_reply_reserve_insufficient_balance (
connection,
+ TALER_EC_EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS,
&wc->batch_total,
wc->reserve_pub);
return GNUNET_DB_STATUS_HARD_ERROR;
diff --git a/src/exchange/taler-exchange-httpd_reserves_history.c b/src/exchange/taler-exchange-httpd_reserves_history.c
index aa3f8ab55..ffdc6eaa4 100644
--- a/src/exchange/taler-exchange-httpd_reserves_history.c
+++ b/src/exchange/taler-exchange-httpd_reserves_history.c
@@ -159,7 +159,7 @@ reserve_history_transaction (void *cls,
{
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_CONFLICT,
- TALER_EC_EXCHANGE_WITHDRAW_HISTORY_ERROR_INSUFFICIENT_FUNDS,
+ TALER_EC_EXCHANGE_GET_RESERVE_HISTORY_ERROR_INSUFFICIENT_BALANCE,
NULL);
}
if (idempotent)
diff --git a/src/exchange/taler-exchange-httpd_reserves_open.c b/src/exchange/taler-exchange-httpd_reserves_open.c
index ced291d77..6909c862a 100644
--- a/src/exchange/taler-exchange-httpd_reserves_open.c
+++ b/src/exchange/taler-exchange-httpd_reserves_open.c
@@ -288,6 +288,7 @@ reserve_open_transaction (void *cls,
*mhd_ret
= TEH_RESPONSE_reply_reserve_insufficient_balance (
connection,
+ TALER_EC_EXCHANGE_RESERVES_OPEN_INSUFFICIENT_FUNDS,
&rsc->reserve_payment,
rsc->reserve_pub);
return GNUNET_DB_STATUS_HARD_ERROR;
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index ca110ad45..4120405fd 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -1000,8 +1000,9 @@ TEH_RESPONSE_compile_reserve_history (
* @return MHD result code
*/
static MHD_RESULT
-reply_withdraw_insufficient_funds (
+reply_reserve_insufficient_funds (
struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
const struct TALER_Amount *ebalance,
const struct TALER_Amount *withdraw_amount,
const struct TALER_EXCHANGEDB_ReserveHistory *rh)
@@ -1012,12 +1013,12 @@ reply_withdraw_insufficient_funds (
if (NULL == json_history)
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_EXCHANGE_WITHDRAW_HISTORY_ERROR_INSUFFICIENT_FUNDS,
+ TALER_EC_EXCHANGE_RESERVE_HISTORY_ERROR_INSUFFICIENT_FUNDS,
NULL);
return TALER_MHD_REPLY_JSON_PACK (
connection,
MHD_HTTP_CONFLICT,
- TALER_JSON_pack_ec (TALER_EC_EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS),
+ TALER_JSON_pack_ec (ec),
TALER_JSON_pack_amount ("balance",
ebalance),
TALER_JSON_pack_amount ("requested_amount",
@@ -1030,6 +1031,7 @@ reply_withdraw_insufficient_funds (
MHD_RESULT
TEH_RESPONSE_reply_reserve_insufficient_balance (
struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
const struct TALER_Amount *balance_required,
const struct TALER_ReservePublicKeyP *reserve_pub)
{
@@ -1063,8 +1065,9 @@ TEH_RESPONSE_reply_reserve_insufficient_balance (
TALER_EC_GENERIC_DB_FETCH_FAILED,
"reserve history");
}
- mhd_ret = reply_withdraw_insufficient_funds (
+ mhd_ret = reply_reserve_insufficient_funds (
connection,
+ ec,
&balance,
balance_required,
rh);
diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h
index 3eebf0274..ba6577b29 100644
--- a/src/exchange/taler-exchange-httpd_responses.h
+++ b/src/exchange/taler-exchange-httpd_responses.h
@@ -63,6 +63,7 @@ TEH_RESPONSE_reply_unknown_denom_pub_hash (
* an insufficient balance for the given operation.
*
* @param connection connection to the client
+ * @param ec specific error code to return with the reserve history
* @param balance_required the balance required for the operation
* @param reserve_pub the reserve with insufficient balance
* @return MHD result code
@@ -70,6 +71,7 @@ TEH_RESPONSE_reply_unknown_denom_pub_hash (
MHD_RESULT
TEH_RESPONSE_reply_reserve_insufficient_balance (
struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
const struct TALER_Amount *balance_required,
const struct TALER_ReservePublicKeyP *reserve_pub);
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c
index 57020ee87..27b176722 100644
--- a/src/exchange/taler-exchange-httpd_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -217,6 +217,7 @@ withdraw_transaction (void *cls,
TEH_plugin->rollback (TEH_plugin->cls);
*mhd_ret = TEH_RESPONSE_reply_reserve_insufficient_balance (
connection,
+ TALER_EC_EXCHANGE_WITHDRAW_INSUFFICIENT_FUNDS,
&wc->collectable.amount_with_fee,
&wc->collectable.reserve_pub);
return GNUNET_DB_STATUS_HARD_ERROR;