commit 141b6bb6d8388133ea96202d1d6b8c08b069c42c
parent 64d52a6e9543fd1d2ffd0176261db5bb0aa89d09
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 7 Oct 2025 20:59:28 +0200
distinguish better between internal and external errors when handling donations (#10478)
Diffstat:
1 file changed, 23 insertions(+), 8 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
@@ -3367,21 +3367,34 @@ handle_output_token (struct PayContext *pc,
*
* @param pc context for the pay request
* @param output the contract output describing the donation receipt requirement
- * @return #GNUNET_OK unconditionally (placeholder)
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO if an error was already queued
*/
static enum GNUNET_GenericReturnValue
handle_output_donation_receipt (
struct PayContext *pc,
const struct TALER_MERCHANT_ContractOutput *output)
{
- if (GNUNET_OK !=
- DONAU_get_donation_amount_from_bkps (
- pc->parse_wallet_data.donau_keys,
- pc->parse_wallet_data.bkps,
- pc->parse_wallet_data.num_bkps,
- pc->parse_wallet_data.donau.donation_year,
- &pc->parse_wallet_data.donation_amount) )
+ enum GNUNET_GenericReturnValue ret;
+
+ ret = DONAU_get_donation_amount_from_bkps (
+ pc->parse_wallet_data.donau_keys,
+ pc->parse_wallet_data.bkps,
+ pc->parse_wallet_data.num_bkps,
+ pc->parse_wallet_data.donau.donation_year,
+ &pc->parse_wallet_data.donation_amount);
+ switch (ret)
{
+ case GNUNET_SYSERR:
+ GNUNET_break (0);
+ pay_end (pc,
+ TALER_MHD_reply_with_error (
+ pc->connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
+ NULL));
+ return GNUNET_NO;
+ case GNUNET_NO:
GNUNET_break_op (0);
pay_end (pc,
TALER_MHD_reply_with_error (
@@ -3390,6 +3403,8 @@ handle_output_donation_receipt (
TALER_EC_GENERIC_PARAMETER_MALFORMED,
"inconsistent bkps / donau keys"));
return GNUNET_NO;
+ case GNUNET_OK:
+ break;
}
if (GNUNET_OK !=