diff options
-rw-r--r-- | src/backend/taler-merchant-httpd_post-orders-ID-refund.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c index 18fca9ac..31d0a86c 100644 --- a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c +++ b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c @@ -436,6 +436,13 @@ process_refunds_cb (void *cls, struct PostRefundData *prd = cls; struct CoinRefund *cr; + for (cr = prd->cr_head; + NULL != cr; + cr = cr->next) + if (cr->refund_serial == refund_serial) + return; + /* already known */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found refund of %s for coin %s with reason `%s' in database\n", TALER_amount2s (refund_amount), @@ -598,17 +605,20 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler *rh, TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR, NULL); case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: - /* We need to talk to the exchange */ - /* Notify clients waiting for the refund to be obtained. */ - TMH_long_poll_resume (hc->infix, - hc->instance, - &prd->refund_amount, - true); - cr->fo = TMH_EXCHANGES_find_exchange (cr->exchange_url, - NULL, - GNUNET_NO, - &exchange_found_cb, - cr); + if (NULL == cr->exchange_reply) + { + /* We need to talk to the exchange */ + /* Notify clients waiting for the refund to be obtained. */ + TMH_long_poll_resume (hc->infix, + hc->instance, + &prd->refund_amount, + true); + cr->fo = TMH_EXCHANGES_find_exchange (cr->exchange_url, + NULL, + GNUNET_NO, + &exchange_found_cb, + cr); + } break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: /* We got a reply earlier, set status accordingly */ @@ -646,7 +656,7 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler *rh, { if (NULL == cr->exchange_reply) { - refund = json_pack ("{s:s, s:I,s:I,s:o,s:o,s:o}" + refund = json_pack ("{s:s,s:I,s:I,s:o,s:o,s:o}" "type", "failure", "exchange_status", |