From 7c4f6fe437ff99eb3e5994c5136ff0724bd0aac7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 25 Jan 2016 19:12:43 +0100 Subject: fixing 152 --- src/backend/taler-merchant-httpd_pay.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index ea59bd7d..ac1be901 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c @@ -723,7 +723,7 @@ MH_handler_pay (struct TMH_RequestHandler *rh, json_decref (root); return (GNUNET_NO == res) ? MHD_YES : MHD_NO; } - + { char *s; s = TALER_amount_to_string (&dc->percoin_amount); @@ -738,10 +738,30 @@ MH_handler_pay (struct TMH_RequestHandler *rh, } /* Check if this payment attempt has already taken place */ - if (GNUNET_OK == db->check_payment (db->cls, pc->transaction_id)) - return TMH_RESPONSE_reply_external_error (connection, "payment already attempted"); + if (GNUNET_OK == db->check_payment (db->cls, + pc->transaction_id)) + { + struct MHD_Response *resp; + int ret; + + /* Payment succeeded in the past; take short cut + and accept immediately */ + resp = MHD_create_response_from_buffer (0, + NULL, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + resp); + MHD_destroy_response (resp); + return ret; + } + + return TMH_RESPONSE_reply_external_error (connection, + "payment already attempted"); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up chosen mint '%s'\n", pc->chosen_mint); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Looking up chosen mint '%s'\n", + pc->chosen_mint); /* Find the responsible mint, this may take a while... */ pc->pending = pc->coins_cnt; -- cgit v1.2.3