diff options
author | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-08-13 03:58:53 -0400 |
---|---|---|
committer | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-08-13 03:58:53 -0400 |
commit | f0d70571fe4cece208d133d10e2dbea0d82b8b0f (patch) | |
tree | 38c3e0450a69c97cd2a3b13563f62943d1ebad98 /src | |
parent | 452f20d71ef5c659c269389a4156f462521737ed (diff) | |
download | merchant-f0d70571fe4cece208d133d10e2dbea0d82b8b0f.tar.gz merchant-f0d70571fe4cece208d133d10e2dbea0d82b8b0f.tar.bz2 merchant-f0d70571fe4cece208d133d10e2dbea0d82b8b0f.zip |
fix infinite loop in GET /orders/ if exchange refund returns error
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd_get-orders-ID.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c index 25e96310..f2ce62e0 100644 --- 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; |