summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/offer_refund.en.must2
-rw-r--r--contrib/show_order_details.en.must64
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c39
3 files changed, 95 insertions, 10 deletions
diff --git a/contrib/offer_refund.en.must b/contrib/offer_refund.en.must
index aaa4e349..49a7dce7 100644
--- a/contrib/offer_refund.en.must
+++ b/contrib/offer_refund.en.must
@@ -22,7 +22,7 @@
<noscript>
<meta http-equiv="refresh" content="1">
</noscript>
- <title>Payment required for {{order_summary}}</title>
+ <title>Refund available for {{order_summary}}</title>
<!-- FIXME: inline this? How to best serve this without using 3rd party? -->
<link rel="stylesheet"
href="https://unpkg.com/purecss@2.0.3/build/pure-min.css"
diff --git a/contrib/show_order_details.en.must b/contrib/show_order_details.en.must
new file mode 100644
index 00000000..c114ee9b
--- /dev/null
+++ b/contrib/show_order_details.en.must
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<!--
+ This file is part of GNU TALER.
+ Copyright (C) 2014-2020 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+-->
+
+<html data-taler-nojs="true">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <noscript>
+ <meta http-equiv="refresh" content="1">
+ </noscript>
+ <title>Status of your order for {{order_summary}}</title>
+ <!-- FIXME: inline this? How to best serve this without using 3rd party? -->
+ <link rel="stylesheet"
+ href="https://unpkg.com/purecss@2.0.3/build/pure-min.css"
+ integrity="sha384-cg6SkqEOCV1NbJoCu11+bm0NvBRc8IYLRGXkmNrqUBfTjmMYwNKPWBTIKyw9mHNJ"
+ crossorigin="anonymous">
+ <style>
+.content {
+ overflow-x: auto;
+ padding-left: 15%;
+ padding-right: 15%;
+}
+#main a:link, #main a:visited, #main a:hover, #main a:active {
+ color: black;
+}
+ </style>
+</head>
+
+<body>
+<h1>Order details</h1>
+
+<div>
+This is the default status page for your order for <b>{{order_summary}}</b>.
+</div>
+
+
+<h2>Refund status</h2>
+<div>
+The merchant has granted you refunds on the purchase of <b>{{refund_amount}}</b>.
+</div>
+
+<h2>Full contract details</h2>
+
+!-- FIXME #6459: expand the contract JSON in all its glory here -->
+<pre>
+ {{{contract}}}
+</pre>
+
+</body>
+</html>
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)
{