commit 7c4f6fe437ff99eb3e5994c5136ff0724bd0aac7
parent df738bfc20cf487315ae929547553a595c830187
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 25 Jan 2016 19:12:43 +0100
fixing 152
Diffstat:
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
@@ -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;