summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-12 23:41:41 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-12 23:41:41 +0530
commit7031acff3354875128eb240a5a2201cb1428364c (patch)
treed5bb0e3f77fd63379cde4ae26216c980cafad8fd
parent326d73d050f371b1e7f995d9184aabd5b9baac94 (diff)
downloadmerchant-7031acff3354875128eb240a5a2201cb1428364c.tar.gz
merchant-7031acff3354875128eb240a5a2201cb1428364c.tar.bz2
merchant-7031acff3354875128eb240a5a2201cb1428364c.zip
pass current session ID to order status URL
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c18
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.h2
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c3
3 files changed, 23 insertions, 0 deletions
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);