diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-11-29 12:30:51 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-11-29 12:30:51 +0100 |
commit | 98af8406d8f06262a09aa40ab04a88ea25e6d3a8 (patch) | |
tree | 46541d8c718602bdcc65cef27391c7573eded9b7 /src/backend/taler-merchant-httpd_pay.c | |
parent | 099152cf92ba8c5c676dbc2379a57422a55622d3 (diff) | |
download | merchant-98af8406d8f06262a09aa40ab04a88ea25e6d3a8.tar.gz merchant-98af8406d8f06262a09aa40ab04a88ea25e6d3a8.tar.bz2 merchant-98af8406d8f06262a09aa40ab04a88ea25e6d3a8.zip |
implement #4075
Diffstat (limited to 'src/backend/taler-merchant-httpd_pay.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_pay.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index 31675921..b287bdd1 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c @@ -27,6 +27,7 @@ #include "taler-merchant-httpd.h" #include "taler-merchant-httpd_parsing.h" #include "taler-merchant-httpd_responses.h" +#include "taler-merchant-httpd_auditors.h" #include "taler-merchant-httpd_mints.h" #include "taler_merchantdb_lib.h" @@ -111,6 +112,13 @@ struct PayContext struct MHD_Connection *connection; /** + * Handle for operation to lookup /keys (and auditors) from + * the mint used for this transaction; NULL if no operation is + * pending. + */ + struct TMH_MINTS_FindOperation *fo; + + /** * Placeholder for #TMH_PARSE_post_json() to keep its internal state. */ void *json_parse_context; @@ -300,6 +308,11 @@ pay_context_cleanup (struct TM_HandlerContext *hc) } } GNUNET_free_non_null (pc->dc); + if (NULL != pc->fo) + { + TMH_MINTS_find_mint_cancel (pc->fo); + pc->fo = NULL; + } if (NULL != pc->response) { MHD_destroy_response (pc->response); @@ -325,6 +338,7 @@ process_pay_with_mint (void *cls, const struct TALER_MINT_Keys *keys; unsigned int i; + pc->fo = NULL; if (NULL == mh) { /* The mint on offer is not in the set of our (trusted) @@ -364,8 +378,8 @@ process_pay_with_mint (void *cls, return; } if (GNUNET_OK != - TMH_AUDITOR_check_dk (mh, - denom_details)) + TMH_AUDITORS_check_dk (mh, + denom_details)) { resume_pay_with_response (pc, MHD_HTTP_BAD_REQUEST, @@ -395,19 +409,19 @@ process_pay_with_mint (void *cls, &acc_fee)) { /* acc_fee > max_fee, customer needs to cover difference */ - struct Amount excess_fee; - struct Amount total_needed; + struct TALER_Amount excess_fee; + struct TALER_Amount total_needed; /* compute fee amount to be covered by customer */ GNUNET_assert (GNUNET_OK == TALER_amount_subtract (&excess_fee, - acc_fee, + &acc_fee, &pc->max_fee)); /* add that to the total */ if (GNUNET_OK != TALER_amount_add (&total_needed, &excess_fee, - pc->amount)) + &pc->amount)) { GNUNET_break (0); resume_pay_with_response (pc, @@ -612,9 +626,9 @@ MH_handler_pay (struct TMH_RequestHandler *rh, /* Find the responsible mint, this may take a while... */ pc->pending = pc->coins_cnt; - TMH_MINTS_find_mint (pc->chosen_mint, - &process_pay_with_mint, - pc); + pc->fo = TMH_MINTS_find_mint (pc->chosen_mint, + &process_pay_with_mint, + pc); /* ... so we suspend connection until the last coin has been ack'd or until we have encountered a hard error. Eventually, we will |