summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-get-instances-ID.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-instances-ID.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-get-instances-ID.c91
1 files changed, 43 insertions, 48 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID.c b/src/backend/taler-merchant-httpd_private-get-instances-ID.c
index 2e63995f..95a3e5ea 100644
--- a/src/backend/taler-merchant-httpd_private-get-instances-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-instances-ID.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2019, 2020 Taler Systems SA
+ (C) 2019-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
@@ -35,6 +35,7 @@ get_instances_ID (struct TMH_MerchantInstance *mi,
struct MHD_Connection *connection)
{
json_t *ja;
+ json_t *auth;
GNUNET_assert (NULL != mi);
ja = json_array ();
@@ -47,57 +48,51 @@ get_instances_ID (struct TMH_MerchantInstance *mi,
0 ==
json_array_append_new (
ja,
- json_pack (
- "{s:O, s:o, s:O, s:b}",
- "payto_uri",
- json_object_get (wm->j_wire,
- "payto_uri"),
- "h_wire",
- GNUNET_JSON_from_data_auto (&wm->h_wire),
- "salt",
- json_object_get (wm->j_wire,
- "salt"),
- "active",
- (wm->active) ? 1 : 0)));
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string (
+ "payto_uri",
+ json_string_value (json_object_get (wm->j_wire,
+ "payto_uri"))),
+ GNUNET_JSON_pack_data_auto ("h_wire",
+ &wm->h_wire),
+ GNUNET_JSON_pack_string (
+ "salt",
+ json_string_value (json_object_get (wm->j_wire,
+ "salt"))),
+ GNUNET_JSON_pack_bool ("active",
+ wm->active))));
}
- return TALER_MHD_reply_json_pack (
+ auth = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("method",
+ GNUNET_is_zero (mi->auth.auth_hash.bits)
+ ? "external"
+ : "token"));
+ return TALER_MHD_REPLY_JSON_PACK (
connection,
MHD_HTTP_OK,
- "{s:o, s:s, s:o, s:O, s:O,"
- " s:o, s:o, s:I, s:o, s:o,"
- " s:{ s:s } }",
- "accounts",
- ja,
- "name",
- mi->settings.name,
- "merchant_pub",
- GNUNET_JSON_from_data_auto (
- &mi->merchant_pub),
- "address",
- mi->settings.address,
- "jurisdiction",
- mi->settings.jurisdiction,
- /* end of first group of 5 */
- "default_max_wire_fee",
- TALER_JSON_from_amount (
- &mi->settings.default_max_wire_fee),
- "default_max_deposit_fee",
- TALER_JSON_from_amount (
- &mi->settings.default_max_deposit_fee),
- "default_wire_fee_amortization",
- (json_int_t)
- mi->settings.default_wire_fee_amortization,
- "default_wire_transfer_delay",
- GNUNET_JSON_from_time_rel (
- mi->settings.default_wire_transfer_delay),
- "default_pay_delay",
- GNUNET_JSON_from_time_rel (
- mi->settings.default_pay_delay),
- /* end of second group of 5 */
- "auth",
- "method",
- GNUNET_is_zero (mi->auth.auth_hash.bits) ? "external" : "token");
+ GNUNET_JSON_pack_array_steal ("accounts",
+ ja),
+ GNUNET_JSON_pack_string ("name",
+ mi->settings.name),
+ GNUNET_JSON_pack_data_auto ("merchant_pub",
+ &mi->merchant_pub),
+ GNUNET_JSON_pack_object_incref ("address",
+ mi->settings.address),
+ GNUNET_JSON_pack_object_incref ("jurisdiction",
+ mi->settings.jurisdiction),
+ TALER_JSON_pack_amount ("default_max_wire_fee",
+ &mi->settings.default_max_wire_fee),
+ TALER_JSON_pack_amount ("default_max_deposit_fee",
+ &mi->settings.default_max_deposit_fee),
+ GNUNET_JSON_pack_uint64 ("default_wire_fee_amortization",
+ mi->settings.default_wire_fee_amortization),
+ GNUNET_JSON_pack_time_rel ("default_wire_transfer_delay",
+ mi->settings.default_wire_transfer_delay),
+ GNUNET_JSON_pack_time_rel ("default_pay_delay",
+ mi->settings.default_pay_delay),
+ GNUNET_JSON_pack_object_steal ("auth",
+ auth));
}