diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-02-25 22:01:55 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-02-25 22:02:26 +0100 |
commit | 5b8db592ecf5409fe7682df7891703b95bfa3de9 (patch) | |
tree | 66bad61c7382ae3f95108551ab73b677fc1db259 | |
parent | 5e47723160feb1ea2c765bb392ed8ec1afd03a81 (diff) | |
download | merchant-5b8db592ecf5409fe7682df7891703b95bfa3de9.tar.gz merchant-5b8db592ecf5409fe7682df7891703b95bfa3de9.tar.bz2 merchant-5b8db592ecf5409fe7682df7891703b95bfa3de9.zip |
json_pack'ing data returned by /history.
-rw-r--r-- | src/backend/taler-merchant-httpd_history.c | 21 |
1 files 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); |