aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-03 14:12:24 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-03 14:12:24 +0200
commitc8347f5b77d1b4636613d05564fb70ad2878e95e (patch)
treed08646f966afeb495f6bd19a996a91f002c1b156 /src
parent8d200bb6cddc42cde096e374427311eac23cf3c3 (diff)
downloadmerchant-c8347f5b77d1b4636613d05564fb70ad2878e95e.tar.gz
merchant-c8347f5b77d1b4636613d05564fb70ad2878e95e.tar.bz2
merchant-c8347f5b77d1b4636613d05564fb70ad2878e95e.zip
add first template for show_order_details
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c
index 020eea0f..37dfd884 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -1336,6 +1336,11 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
}
{
struct KVC kvc[] = {
+ { "order_summary",
+ // FIXME #6458: implement logic to extract summary based on
+ // language preferences from summary_i18n if present.
+ json_string_value (json_object_get (god->contract_terms,
+ "summary")) },
{ "refund_amount",
TALER_amount2s (&god->refund_amount) },
{ "taler_refund_uri",
@@ -1356,15 +1361,31 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
}
else
{
- struct KVC kvc[] = {
- { NULL, NULL }
- };
-
- res = TMH_return_from_template (god->sc.con,
- MHD_HTTP_OK,
- "show_order_details",
- NULL,
- kvc);
+ char *j;
+
+ j = json_dumps (god->contract_terms,
+ JSON_COMPACT | JSON_SORT_KEYS); /* use most efficient encoding */
+ {
+ struct KVC kvc[] = {
+ { "order_summary",
+ // FIXME #6458: implement logic to extract summary based on
+ // language preferences from summary_i18n if present.
+ json_string_value (json_object_get (god->contract_terms,
+ "summary")) },
+ { "refund_amount",
+ TALER_amount2s (&god->refund_amount) },
+ { "contract",
+ j },
+ { NULL, NULL }
+ };
+
+ res = TMH_return_from_template (god->sc.con,
+ MHD_HTTP_OK,
+ "show_order_details",
+ NULL,
+ kvc);
+ }
+ free (j);
}
if (GNUNET_SYSERR == res)
{