From 5b8db592ecf5409fe7682df7891703b95bfa3de9 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Sat, 25 Feb 2017 22:01:55 +0100 Subject: json_pack'ing data returned by /history. --- src/backend/taler-merchant-httpd_history.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/backend/taler-merchant-httpd_history.c b/src/backend/taler-merchant-httpd_history.c index 7af8c553..79dd179a 100644 --- a/src/backend/taler-merchant-httpd_history.c +++ b/src/backend/taler-merchant-httpd_history.c @@ -45,14 +45,23 @@ pd_cb (void *cls, { json_t *response = cls; json_t *entry; + json_t *amount; + json_t *timestamp; + GNUNET_assert (NULL != (amount = json_object_get (proposal_data, "amount"))); + GNUNET_assert (NULL != (timestamp = json_object_get (proposal_data, "timestamp"))); - /*FIXME: more details to be returned*/ GNUNET_break (NULL != - (entry = json_pack ("{s:s}", - "order_id", order_id))); + (entry = json_pack ("{s:s, s:o, s:s}", + "order_id", order_id, + "amount", amount, + "timestamp", json_string_value (timestamp)))); - GNUNET_break (0 == json_array_append (response, entry)); + GNUNET_break (0 == json_array_append_new (response, entry)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "growing history data: %s\nptr: %p\n", + json_dumps (response, JSON_INDENT (1)), + response); } /** @@ -124,6 +133,10 @@ MH_handler_history (struct TMH_RequestHandler *rh, TALER_EC_HISTORY_DB_FETCH_ERROR, "db error to get history"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "history data: %s\n", + json_dumps (response, JSON_INDENT (1))); + return TMH_RESPONSE_reply_json (connection, response, MHD_HTTP_OK); -- cgit v1.2.3