summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-get-reserves-ID.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-reserves-ID.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-get-reserves-ID.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-reserves-ID.c b/src/backend/taler-merchant-httpd_private-get-reserves-ID.c
index 8ad6e8de..e0cee3a7 100644
--- a/src/backend/taler-merchant-httpd_private-get-reserves-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-reserves-ID.c
@@ -94,41 +94,50 @@ handle_reserve_details (void *cls,
{
tips_json = json_array ();
GNUNET_assert (NULL != tips_json);
-
for (unsigned int i = 0; i<tips_length; i++)
{
GNUNET_assert (0 ==
json_array_append_new (
tips_json,
- json_pack ("{s:o,s:o,s:s}",
- "tip_id",
- GNUNET_JSON_from_data_auto (
- &tips[i].tip_id),
- "total_amount",
- TALER_JSON_from_amount (
- &tips[i].total_amount),
- "reason",
- tips[i].reason)));
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_data_auto ("tip_id",
+ &tips[i].tip_id),
+ TALER_JSON_pack_amount ("total_amount",
+ &tips[i].total_amount),
+ GNUNET_JSON_pack_string ("reason",
+ tips[i].reason))));
}
}
else
{
tips_json = NULL;
}
- ctx->res = TALER_MHD_reply_json_pack (
+ ctx->res = TALER_MHD_REPLY_JSON_PACK (
ctx->connection,
MHD_HTTP_OK,
- "{s:o, s:o, s:o, s:o, s:o, s:o, s:o?, s:b, s:s?, s:s?}",
- "creation_time", GNUNET_JSON_from_time_abs (creation_time_round),
- "expiration_time", GNUNET_JSON_from_time_abs (expiration_time_round),
- "merchant_initial_amount", TALER_JSON_from_amount (merchant_initial_amount),
- "exchange_initial_amount", TALER_JSON_from_amount (exchange_initial_amount),
- "pickup_amount", TALER_JSON_from_amount (picked_up_amount),
- "committed_amount", TALER_JSON_from_amount (committed_amount),
- "tips", tips_json,
- "active", active,
- "exchange_url", exchange_url,
- "payto_uri", payto_uri);
+ GNUNET_JSON_pack_time_abs ("creation_time",
+ creation_time_round),
+ GNUNET_JSON_pack_time_abs ("expiration_time",
+ expiration_time_round),
+ TALER_JSON_pack_amount ("merchant_initial_amount",
+ merchant_initial_amount),
+ TALER_JSON_pack_amount ("exchange_initial_amount",
+ exchange_initial_amount),
+ TALER_JSON_pack_amount ("pickup_amount",
+ picked_up_amount),
+ TALER_JSON_pack_amount ("committed_amount",
+ committed_amount),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_array_steal ("tips",
+ tips_json)),
+ GNUNET_JSON_pack_bool ("active",
+ active),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_string ("exchange_url",
+ exchange_url)),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_string ("payto_uri",
+ payto_uri)));
}