summaryrefslogtreecommitdiff
path: root/src/backend/anastasis-httpd_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/anastasis-httpd_config.c')
-rw-r--r--src/backend/anastasis-httpd_config.c73
1 files changed, 34 insertions, 39 deletions
diff --git a/src/backend/anastasis-httpd_config.c b/src/backend/anastasis-httpd_config.c
index fff6bcb..14ed8db 100644
--- a/src/backend/anastasis-httpd_config.c
+++ b/src/backend/anastasis-httpd_config.c
@@ -1,6 +1,6 @@
/*
This file is part of Anastasis
- Copyright (C) 2020 Taler Systems SA
+ Copyright (C) 2020, 2021 Taler Systems SA
Anastasis is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free Software
@@ -63,12 +63,11 @@ add_methods (void *cls,
section);
return;
}
- method = json_pack ("{s:s, s:o}",
- "type",
- section,
- "cost",
- TALER_JSON_from_amount (&cost));
- GNUNET_assert (NULL != method);
+ method = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("type",
+ section),
+ TALER_JSON_pack_amount ("cost",
+ &cost));
GNUNET_assert (
0 ==
json_array_append_new (method_arr,
@@ -86,11 +85,11 @@ AH_handler_config (struct AH_RequestHandler *rh,
{
json_t *method;
- method = json_pack ("{s:s, s:o}",
- "type",
- "question",
- "cost",
- TALER_JSON_from_amount (&AH_question_cost));
+ method = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("type",
+ "question"),
+ TALER_JSON_pack_amount ("cost",
+ &AH_question_cost));
GNUNET_assert (
0 ==
json_array_append_new (method_arr,
@@ -99,33 +98,29 @@ AH_handler_config (struct AH_RequestHandler *rh,
GNUNET_CONFIGURATION_iterate_sections (AH_cfg,
&add_methods,
method_arr);
- return TALER_MHD_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:s, s:s, s:s, s:s, s:o, s:I,"
- " s:o, s:o, s:o, s:o }",
- "name",
- "anastasis",
- "version",
- "0:0:0",
- "business_name",
- AH_business_name,
- "currency",
- (char *) AH_currency,
- "methods",
- method_arr,
- "storage_limit_in_megabytes",
- (json_int_t) AH_upload_limit_mb,
- /* 6 */
- "annual_fee",
- TALER_JSON_from_amount (&AH_annual_fee),
- "truth_upload_fee",
- TALER_JSON_from_amount (
- &AH_truth_upload_fee),
- "liability_limit",
- TALER_JSON_from_amount (&AH_insurance),
- "server_salt",
- GNUNET_JSON_from_data_auto (
- &AH_server_salt));
+ return TALER_MHD_REPLY_JSON_PACK (
+ connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_string ("name",
+ "anastasis"),
+ GNUNET_JSON_pack_string ("version",
+ "0:0:0"),
+ GNUNET_JSON_pack_string ("business_name",
+ AH_business_name),
+ GNUNET_JSON_pack_string ("currency",
+ (char *) AH_currency),
+ GNUNET_JSON_pack_array_steal ("methods",
+ method_arr),
+ GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes",
+ AH_upload_limit_mb),
+ TALER_JSON_pack_amount ("annual_fee",
+ &AH_annual_fee),
+ TALER_JSON_pack_amount ("truth_upload_fee",
+ &AH_truth_upload_fee),
+ TALER_JSON_pack_amount ("liability_limit",
+ &AH_insurance),
+ GNUNET_JSON_pack_data_auto ("server_salt",
+ &AH_server_salt));
}