diff options
Diffstat (limited to 'src/lib/merchant_api_post_instances.c')
-rw-r--r-- | src/lib/merchant_api_post_instances.c | 71 |
1 files changed, 31 insertions, 40 deletions
diff --git a/src/lib/merchant_api_post_instances.c b/src/lib/merchant_api_post_instances.c index 8aede243..6101e192 100644 --- a/src/lib/merchant_api_post_instances.c +++ b/src/lib/merchant_api_post_instances.c @@ -191,17 +191,17 @@ TALER_MERCHANT_instances_post ( RFC_8959_PREFIX); return NULL; } - auth_obj = json_pack ("{s:s, s:s}", - "method", - "token", - "token", - auth_token); + auth_obj = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("method", + "token"), + GNUNET_JSON_pack_string ("token", + auth_token)); } else { - auth_obj = json_pack ("{s:s}", - "method", - "external"); + auth_obj = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("method", + "external")); } if (NULL == auth_obj) { @@ -227,38 +227,29 @@ TALER_MERCHANT_instances_post ( return NULL; } } - req_obj = json_pack ("{s:o, s:s, s:s, s:O, s:O" - ",s:o, s:I: s:o, s:o, s:o" - ",s:o}", - "payto_uris", - jpayto_uris, - "id", - instance_id, - "name", - name, - "address", - address, - "jurisdiction", - jurisdiction, - /* end of group of 5 */ - "default_max_wire_fee", - TALER_JSON_from_amount (default_max_wire_fee), - "default_wire_fee_amortization", - (json_int_t) default_wire_fee_amortization, - "default_max_deposit_fee", - TALER_JSON_from_amount (default_max_deposit_fee), - "default_wire_transfer_delay", - GNUNET_JSON_from_time_rel (default_wire_transfer_delay), - "default_pay_delay", - GNUNET_JSON_from_time_rel (default_pay_delay), - "auth", - auth_obj); - if (NULL == req_obj) - { - json_decref (auth_obj); - GNUNET_break (0); - return NULL; - } + req_obj = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_array_steal ("payto_uris", + jpayto_uris), + GNUNET_JSON_pack_string ("id", + instance_id), + GNUNET_JSON_pack_string ("name", + name), + GNUNET_JSON_pack_object_incref ("address", + (json_t *) address), + GNUNET_JSON_pack_object_incref ("jurisdiction", + (json_t *) jurisdiction), + TALER_JSON_pack_amount ("default_max_wire_fee", + default_max_wire_fee), + GNUNET_JSON_pack_uint64 ("default_wire_fee_amortization", + default_wire_fee_amortization), + TALER_JSON_pack_amount ("default_max_deposit_fee", + default_max_deposit_fee), + GNUNET_JSON_pack_time_rel ("default_wire_transfer_delay", + default_wire_transfer_delay), + GNUNET_JSON_pack_time_rel ("default_pay_delay", + default_pay_delay), + GNUNET_JSON_pack_object_steal ("auth", + auth_obj)); iph = GNUNET_new (struct TALER_MERCHANT_InstancesPostHandle); iph->ctx = ctx; iph->cb = cb; |