exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit abf2f890754bcf1d6c11fc4b2b41adf4c18a70d7
parent 32531d99f47b6b390c1804a2a7d58d5fc2c6d9ae
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 11 Oct 2026 14:19:21 +0200

return meaningful coin-based hint, check refund_fee is covered by refund_amount

Diffstat:
Msrc/exchange/taler-exchange-httpd_post-coins-COIN_PUB-refund.c | 26++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_post-coins-COIN_PUB-refund.c b/src/exchange/taler-exchange-httpd_post-coins-COIN_PUB-refund.c @@ -257,18 +257,18 @@ verify_and_execute_refund (struct MHD_Connection *connection, case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: { enum MHD_Result res; - char *dhs; + char *cps; GNUNET_break_op (0); - dhs = GNUNET_STRINGS_data_to_string_alloc ( - &refund->coin.denom_pub_hash, - sizeof (refund->coin.denom_pub_hash)); + cps = GNUNET_STRINGS_data_to_string_alloc ( + &refund->coin.coin_pub, + sizeof (refund->coin.coin_pub)); res = TALER_MHD_reply_with_error ( connection, MHD_HTTP_NOT_FOUND, TALER_EC_EXCHANGE_REFUND_COIN_NOT_FOUND, - dhs); - GNUNET_free (dhs); + cps); + GNUNET_free (cps); return res; } case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: @@ -296,6 +296,20 @@ verify_and_execute_refund (struct MHD_Connection *connection, rctx.deposit_fee = dk->meta.fees.deposit; } + /* The refund fee is subtracted from the refunded amount, so the + client-chosen amount must cover it. */ + if (0 > + TALER_amount_cmp (&refund->details.refund_amount, + &refund->details.refund_fee)) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_EXCHANGE_REFUND_FEE_ABOVE_AMOUNT, + NULL); + } + /* Finally run the actual transaction logic */ { enum MHD_Result mhd_ret;