From 7031acff3354875128eb240a5a2201cb1428364c Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 12 Aug 2020 23:41:41 +0530 Subject: pass current session ID to order status URL --- src/backend/taler-merchant-httpd_get-orders-ID.c | 18 ++++++++++++++++++ src/backend/taler-merchant-httpd_get-orders-ID.h | 2 ++ .../taler-merchant-httpd_private-get-orders-ID.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c index ffc9ac07..8532c983 100644 --- a/src/backend/taler-merchant-httpd_get-orders-ID.c +++ b/src/backend/taler-merchant-httpd_get-orders-ID.c @@ -376,6 +376,7 @@ make_taler_refund_uri (struct MHD_Connection *con, * * @param con HTTP connection * @param order_id the order id + * @param session_id the session id * @param instance_id instance, may be "default" * @param claim_token claim token for the order, may be NULL * @return corresponding http(s):// URL, or NULL on missing "host" @@ -383,6 +384,7 @@ make_taler_refund_uri (struct MHD_Connection *con, char * TMH_make_order_status_url (struct MHD_Connection *con, const char *order_id, + const char *session_id, const char *instance_id, struct TALER_ClaimTokenP *claim_token) { @@ -390,6 +392,7 @@ TMH_make_order_status_url (struct MHD_Connection *con, const char *forwarded_host; const char *uri_path; struct GNUNET_Buffer buf = { 0 }; + bool have_claim_token = false; host = MHD_lookup_connection_value (con, MHD_HEADER_KIND, @@ -445,6 +448,20 @@ TMH_make_order_status_url (struct MHD_Connection *con, GNUNET_buffer_write_data_encoded (&buf, (char *) claim_token, sizeof (struct TALER_ClaimTokenP)); + have_claim_token = true; + } + + if (NULL != session_id) + { + if (have_claim_token) + GNUNET_buffer_write_str (&buf, + "?session_id="); + else + GNUNET_buffer_write_str (&buf, + "&session_id="); + GNUNET_buffer_write_str (&buf, + session_id); + } return GNUNET_buffer_reap_str (&buf); @@ -572,6 +589,7 @@ send_pay_request (struct GetOrderData *god, &god->claim_token); order_status_url = TMH_make_order_status_url (god->sc.con, god->order_id, + god->session_id, god->hc->instance->settings.id, &god->claim_token); if (god->generate_html) diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.h b/src/backend/taler-merchant-httpd_get-orders-ID.h index d5d33fac..83a991b4 100644 --- a/src/backend/taler-merchant-httpd_get-orders-ID.h +++ b/src/backend/taler-merchant-httpd_get-orders-ID.h @@ -48,6 +48,7 @@ TMH_make_taler_pay_uri (struct MHD_Connection *con, * * @param con HTTP connection * @param order_id the order id + * @param session_id session, may be NULL * @param instance_id instance, may be "default" * @param claim_token claim token for the order, may be NULL * @return corresponding http(s):// URL, or NULL on missing "host" @@ -55,6 +56,7 @@ TMH_make_taler_pay_uri (struct MHD_Connection *con, char * TMH_make_order_status_url (struct MHD_Connection *con, const char *order_id, + const char *session_id, const char *instance_id, struct TALER_ClaimTokenP *claim_token); diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c index 230a240f..bc2a2d03 100644 --- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c @@ -976,6 +976,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, &claim_token); order_status_url = TMH_make_order_status_url (connection, hc->infix, + gorc->session_id, hc->instance->settings.id, &claim_token); ret = TALER_MHD_reply_json_pack (connection, @@ -1051,6 +1052,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, &claim_token); order_status_url = TMH_make_order_status_url (connection, hc->infix, + gorc->session_id, hc->instance->settings.id, &claim_token); ret = TALER_MHD_reply_json_pack (connection, @@ -1185,6 +1187,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, order_status_url = TMH_make_order_status_url (connection, hc->infix, + gorc->session_id, hc->instance->settings.id, &claim_token); -- cgit v1.2.3