aboutsummaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_get-tips-ID.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_get-tips-ID.c')
-rw-r--r--src/backend/taler-merchant-httpd_get-tips-ID.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/backend/taler-merchant-httpd_get-tips-ID.c b/src/backend/taler-merchant-httpd_get-tips-ID.c
index 09640bde..5b0abd89 100644
--- a/src/backend/taler-merchant-httpd_get-tips-ID.c
+++ b/src/backend/taler-merchant-httpd_get-tips-ID.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2014-2020 Taler Systems SA
+ (C) 2014-2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -244,15 +244,14 @@ TMH_get_tips_ID (const struct TMH_RequestHandler *rh,
else
{
json_t *context;
- context = json_pack ("{s:s, s:s, s:s}",
- "remaining_tip",
- TALER_amount2s (&remaining),
- "taler_tip_uri",
- uri,
- "taler_tip_qrcode_svg",
- qr);
- GNUNET_assert (NULL != context);
+ context = GNUNET_JSON_PACK (
+ TALER_JSON_pack_amount ("remaining_tip",
+ &remaining),
+ GNUNET_JSON_pack_string ("taler_tip_uri",
+ uri),
+ GNUNET_JSON_pack_string ("taler_tip_qrcode_svg",
+ qr));
ret = TMH_return_from_template (connection,
( (0 == remaining.value) &&
(0 == remaining.fraction) )
@@ -273,19 +272,18 @@ TMH_get_tips_ID (const struct TMH_RequestHandler *rh,
}
else
{
- ret = TALER_MHD_reply_json_pack (connection,
- ( (0 == remaining.value) &&
- (0 == remaining.fraction) )
- ? MHD_HTTP_GONE
- : MHD_HTTP_OK,
- "{s:s, s:o, s:o}",
- "exchange_url",
- exchange_url,
- "tip_amount",
- TALER_JSON_from_amount (&remaining),
- "expiration",
- GNUNET_JSON_from_time_abs (
- expiration_round));
+ ret = TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ ( (0 == remaining.value) &&
+ (0 == remaining.fraction) )
+ ? MHD_HTTP_GONE
+ : MHD_HTTP_OK,
+ GNUNET_JSON_pack_string ("exchange_url",
+ exchange_url),
+ TALER_JSON_pack_amount ("tip_amount",
+ &remaining),
+ GNUNET_JSON_pack_time_abs ("expiration",
+ expiration_round));
}
GNUNET_free (exchange_url);
return ret;