From f23e2c2cdc8d2665d76a335f58a640763c9a425e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 24 Aug 2020 14:12:02 +0200 Subject: make fulfillment URL optional, fix #6498 as discussed --- .../taler-merchant-httpd_private-get-orders-ID.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/backend/taler-merchant-httpd_private-get-orders-ID.c') 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 bc2a2d03..e7c4a2b2 100644 --- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c @@ -125,7 +125,8 @@ struct GetOrderRequestContext /** * Fulfillment URL extracted from the contract. For repurchase detection. - * Only valid as long as @e contract_terms is valid! + * Only valid as long as @e contract_terms is valid! NULL if there is + * no fulfillment URL in the contract. */ const char *fulfillment_url; @@ -862,8 +863,6 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, /* extract the fulfillment URL and total amount from the contract terms! */ { struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_string ("fulfillment_url", - &gorc->fulfillment_url), TALER_JSON_spec_amount ("amount", &gorc->contract_amount), GNUNET_JSON_spec_end () @@ -893,6 +892,10 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, "Merchant database error (contract terms in wrong currency)"); } } + gorc->fulfillment_url + = json_string_value (json_object_get (gorc->contract_terms, + "fulfillment_url")); + if (! order_only) { if (GNUNET_OK != @@ -941,8 +944,9 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, "DB error fetching payment status"); } } - if ((! paid) && - (NULL != gorc->session_id)) + if ( (! paid) && + (NULL != gorc->fulfillment_url) && + (NULL != gorc->session_id) ) { char *already_paid_order_id; @@ -1057,13 +1061,11 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, &claim_token); ret = TALER_MHD_reply_json_pack (connection, MHD_HTTP_OK, - "{s:s, s:s, s:O, s:s}", + "{s:s, s:s, s:s}", "taler_pay_uri", taler_pay_uri, "order_status_url", order_status_url, - "contract_terms", - gorc->contract_terms, "order_status", "unpaid"); GNUNET_free (taler_pay_uri); @@ -1097,7 +1099,6 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, /* Generate final reply, including wire details if we have them */ { MHD_RESULT ret; - char *order_status_url; GNUNET_assert (GNUNET_OK == -- cgit v1.2.3