merchant

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

commit f0d70571fe4cece208d133d10e2dbea0d82b8b0f
parent 452f20d71ef5c659c269389a4156f462521737ed
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
Date:   Thu, 13 Aug 2020 03:58:53 -0400

fix infinite loop in GET /orders/ if exchange refund returns error

Diffstat:
Msrc/backend/taler-merchant-httpd_get-orders-ID.c | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c @@ -816,8 +816,8 @@ process_refunds_cb (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found refund of %s for coin %s with reason `%s' in database\n", - TALER_B2S (coin_pub), TALER_amount2s (refund_amount), + TALER_B2S (coin_pub), reason); cr = GNUNET_new (struct CoinRefund); cr->refund_serial = refund_serial; @@ -1225,6 +1225,16 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh, } } + /* Before we reset the refunds, make sure we notify the client in the case + of a non-200 status from the exchange. */ + for (struct CoinRefund *cr = god->cr_head; + NULL != cr; + cr = cr->next) + { + if (MHD_HTTP_OK != cr->exchange_status) + goto REPLY; + } + /* At this point, we know the contract was paid. Let's check for refunds. First, clear away refunds found from previous invocations. */ rf_cleanup (god); @@ -1315,6 +1325,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh, } /* All operations done, build final response */ +REPLY: { json_t *ra;