merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit ceb62f87b444d6c57fc34c5c2c4ed4295e499648
parent 666c52a90321b201682db6aa6e568b28f5cb42d0
Author: Florian Dold <florian@dold.me>
Date:   Mon, 25 Apr 2022 23:18:16 +0200

don't confuse GNUnet and MHD error codes

Diffstat:
Msrc/backend/taler-merchant-httpd_post-orders-ID-pay.c | 49++++++++++++++++++++++++++++++++-----------------
1 file changed, 32 insertions(+), 17 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -2084,8 +2084,8 @@ parse_pay (struct MHD_Connection *connection, MHD_HTTP_BAD_REQUEST, TALER_EC_GENERIC_PARAMETER_MALFORMED, "duplicate coin in list")) - ? GNUNET_NO - : GNUNET_SYSERR; + ? GNUNET_NO + : GNUNET_SYSERR; } } @@ -2099,10 +2099,12 @@ parse_pay (struct MHD_Connection *connection, { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (connection, + return (MHD_YES == TALER_MHD_reply_with_error (connection, MHD_HTTP_CONFLICT, TALER_EC_GENERIC_CURRENCY_MISMATCH, - TMH_currency); + TMH_currency)) + ? GNUNET_NO + : GNUNET_SYSERR; } { @@ -2114,11 +2116,15 @@ parse_pay (struct MHD_Connection *connection, { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error ( - connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "inconsistency: 'mininum_age_sig' vs. 'age_commitment'"); + return (MHD_YES == + TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "inconsistency: 'mininum_age_sig' vs. 'age_commitment'") + ) + ? GNUNET_NO + : GNUNET_SYSERR; } /* Parse the AgeCommitment, i. e. the public keys */ @@ -2134,10 +2140,14 @@ parse_pay (struct MHD_Connection *connection, { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "'age_commitment' too large"); + return (MHD_YES == + TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "'age_commitment' too large" + )) + ? GNUNET_NO + : GNUNET_SYSERR; } dc->age_commitment = GNUNET_new (struct TALER_AgeCommitment); @@ -2164,10 +2174,14 @@ parse_pay (struct MHD_Connection *connection, { GNUNET_break_op (0); GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "age_commitment"); + return (MHD_YES == + TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + "age_commitment")) + ? GNUNET_NO + : GNUNET_SYSERR; } } } @@ -2443,6 +2457,7 @@ TMH_post_orders_ID_pay (const struct TMH_RequestHandler *rh, = GNUNET_SCHEDULER_add_delayed (get_pay_timeout (pc->coins_cnt), &handle_pay_timeout, pc); + GNUNET_assert (NULL != pc->wm); execute_pay_transaction (pc); return MHD_YES; }