From 234b0cd56f69305f27ac5f6cd3828c0d115dcd0f Mon Sep 17 00:00:00 2001 From: Özgür Kesim Date: Sat, 23 Dec 2023 23:33:22 +0100 Subject: Added appropriate response on contract-conflict during deposit In case of a detected conflict during deposit, because (merchant_pub, h_contract_terms) already existed, with different other field values, we now provide the client an error response that contains the h_wire. This way, the client can retrieve further details about the conflicting transaction via /deposits/$H_WIRE/$MERCHANT_PUB/$H_CONTRACT_TERMS/$COIN_PUB Fixes #8002 --- src/exchange/taler-exchange-httpd_responses.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/exchange/taler-exchange-httpd_responses.c') diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index a6d2c7ffc..8993ea50f 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -179,6 +179,21 @@ TEH_RESPONSE_reply_coin_insufficient_funds ( } +MHD_RESULT +TEH_RESPONSE_reply_coin_conflicting_contract ( + struct MHD_Connection *connection, + enum TALER_ErrorCode ec, + const struct TALER_MerchantWireHashP *h_wire) +{ + return TALER_MHD_REPLY_JSON_PACK ( + connection, + TALER_ErrorCode_get_http_status_safe (ec), + GNUNET_JSON_pack_data_auto ("h_wire", + h_wire), + TALER_JSON_pack_ec (ec)); +} + + MHD_RESULT TEH_RESPONSE_reply_coin_denomination_conflict ( struct MHD_Connection *connection, -- cgit v1.2.3