aboutsummaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_post-orders-ID-paid.c')
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-paid.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-paid.c b/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
index d274c1f6..52f233eb 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
@@ -23,6 +23,7 @@
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include <taler/taler_dbevents.h>
26#include <taler/taler_signatures.h> 27#include <taler/taler_signatures.h>
27#include <taler/taler_json_lib.h> 28#include <taler/taler_json_lib.h>
28#include <taler/taler_exchange_service.h> 29#include <taler/taler_exchange_service.h>
@@ -33,19 +34,19 @@
33 * Use database to notify other clients about the 34 * Use database to notify other clients about the
34 * session being captured. 35 * session being captured.
35 * 36 *
37 * @param hc http context
36 * @param session_id the captured session 38 * @param session_id the captured session
37 * @param fulfillment_url the URL that is now paid for by @a session_id 39 * @param fulfillment_url the URL that is now paid for by @a session_id
38 */ 40 */
39static void 41static void
40trigger_session_notification (const char *session_id, 42trigger_session_notification (struct TMH_HandlerContext *hc,
43 const char *session_id,
41 const char *fulfillment_url) 44 const char *fulfillment_url)
42{ 45{
43#ifndef TALER_API_VERSION 46 struct TMH_SessionEventP session_eh = {
44#define TALER_DBEVENT_MERCHANT_SESSION_CAPTURED 1103
45#endif
46 struct TMH_SessionEvent session_eh = {
47 .header.size = htons (sizeof (session_eh)), 47 .header.size = htons (sizeof (session_eh)),
48 .header.type = htons (TALER_DBEVENT_MERCHANT_SESSION_CAPTURED) 48 .header.type = htons (TALER_DBEVENT_MERCHANT_SESSION_CAPTURED),
49 .merchant_pub = hc->instance->merchant_pub
49 }; 50 };
50 51
51 GNUNET_CRYPTO_hash (session_id, 52 GNUNET_CRYPTO_hash (session_id,
@@ -201,21 +202,11 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler *rh,
201 /* Wake everybody up who waits for this fulfillment_url and session_id */ 202 /* Wake everybody up who waits for this fulfillment_url and session_id */
202 if ( (NULL != fulfillment_url) && 203 if ( (NULL != fulfillment_url) &&
203 (NULL != session_id) ) 204 (NULL != session_id) )
204 trigger_session_notification (session_id, 205 trigger_session_notification (hc,
206 session_id,
205 fulfillment_url); 207 fulfillment_url);
206 if (NULL != fulfillment_url)
207 TMH_long_poll_resume2 (session_id,
208 fulfillment_url);
209
210 /* fulfillment_url is part of the contract_terms */ 208 /* fulfillment_url is part of the contract_terms */
211 json_decref (contract_terms); 209 json_decref (contract_terms);
212 /* Resume clients waiting on the order
213 (NOTE: should never be needed, as /pay
214 would have triggered those, right?) */
215 TMH_long_poll_resume (order_id,
216 hc->instance,
217 NULL,
218 false);
219 return TALER_MHD_reply_static (connection, 210 return TALER_MHD_reply_static (connection,
220 MHD_HTTP_NO_CONTENT, 211 MHD_HTTP_NO_CONTENT,
221 NULL, 212 NULL,