summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-01-25 19:12:43 +0100
committerChristian Grothoff <christian@grothoff.org>2016-01-25 19:12:43 +0100
commit7c4f6fe437ff99eb3e5994c5136ff0724bd0aac7 (patch)
tree498a3c900c806b4b211ffe95f37e59efc7940c60
parentdf738bfc20cf487315ae929547553a595c830187 (diff)
downloadmerchant-7c4f6fe437ff99eb3e5994c5136ff0724bd0aac7.tar.gz
merchant-7c4f6fe437ff99eb3e5994c5136ff0724bd0aac7.tar.bz2
merchant-7c4f6fe437ff99eb3e5994c5136ff0724bd0aac7.zip
fixing 152
-rw-r--r--src/backend/taler-merchant-httpd_pay.c28
1 files 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;