summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-get-orders-ID.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-orders-ID.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c57
1 files changed, 30 insertions, 27 deletions
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 0e38b48c..5d471aa4 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -759,6 +759,8 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
bool wired;
bool order_only = false;
struct TALER_ClaimTokenP claim_token = { 0 };
+ const char *summary;
+ struct GNUNET_TIME_Absolute timestamp;
if (NULL == gorc)
{
@@ -904,11 +906,19 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
json_decref (ct);
}
}
- /* extract the fulfillment URL and total amount from the contract terms! */
+ /* extract the fulfillment URL, total amount, summary and timestamp
+ from the contract terms! */
{
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount ("amount",
&gorc->contract_amount),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_string ("fulfillment_url",
+ &gorc->fulfillment_url)),
+ GNUNET_JSON_spec_string ("summary",
+ &summary),
+ TALER_JSON_spec_absolute_time ("timestamp",
+ &timestamp),
GNUNET_JSON_spec_end ()
};
@@ -938,9 +948,6 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
gorc->contract_amount.currency);
}
}
- gorc->fulfillment_url
- = json_string_value (json_object_get (gorc->contract_terms,
- "fulfillment_url"));
if (! order_only)
{
if (GNUNET_OK !=
@@ -1040,7 +1047,8 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
NULL);
ret = TALER_MHD_reply_json_pack (connection,
MHD_HTTP_OK,
- "{s:s, s:s, s:s, s:s, s:s}",
+ "{s:s, s:s, s:s, s:s, s:s"
+ " s:o, s:s, s:o}",
"taler_pay_uri",
taler_pay_uri,
"order_status_url",
@@ -1050,7 +1058,14 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
"already_paid_order_id",
already_paid_order_id,
"already_paid_fulfillment_url",
- gorc->fulfillment_url);
+ gorc->fulfillment_url,
+ "total_amount",
+ TALER_JSON_from_amount (
+ &gorc->contract_amount),
+ "summary",
+ summary,
+ "creation_time",
+ GNUNET_JSON_from_time_abs (timestamp));
GNUNET_free (taler_pay_uri);
GNUNET_free (already_paid_order_id);
return ret;
@@ -1153,13 +1168,20 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
NULL);
ret = TALER_MHD_reply_json_pack (connection,
MHD_HTTP_OK,
- "{s:s, s:s, s:s}",
+ "{s:s, s:s, s:s, s:o, s:s, s:o}",
"taler_pay_uri",
taler_pay_uri,
"order_status_url",
order_status_url,
"order_status",
- "unpaid");
+ "unpaid",
+ "total_amount",
+ TALER_JSON_from_amount (
+ &gorc->contract_amount),
+ "summary",
+ summary,
+ "creation_time",
+ GNUNET_JSON_from_time_abs (timestamp));
GNUNET_free (taler_pay_uri);
GNUNET_free (order_status_url);
return ret;
@@ -1246,30 +1268,11 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
TALER_amount_cmp (&expect_total,
&gorc->deposits_total))
{
- struct GNUNET_TIME_Absolute timestamp;
-
/* expect_total <= gorc->deposits_total: good: we got paid */
wired = true;
qs = TMH_db->mark_order_wired (TMH_db->cls,
gorc->order_serial);
GNUNET_break (qs >= 0); /* just warn if transaction failed */
- {
- struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_absolute_time ("timestamp",
- &timestamp),
- GNUNET_JSON_spec_end ()
- };
- enum GNUNET_GenericReturnValue res;
-
- res = TALER_MHD_parse_internal_json_data (connection,
- gorc->contract_terms,
- spec);
- if (GNUNET_YES != res)
- {
- GNUNET_break (0);
- return res;
- }
- }
TMH_notify_order_change (hc->instance,
hc->infix,
true, /* paid */