diff options
Diffstat (limited to 'src/lib/merchant_api_post_orders.c')
-rw-r--r-- | src/lib/merchant_api_post_orders.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/lib/merchant_api_post_orders.c b/src/lib/merchant_api_post_orders.c index a79b9904..ae804ddf 100644 --- a/src/lib/merchant_api_post_orders.c +++ b/src/lib/merchant_api_post_orders.c @@ -260,9 +260,12 @@ TALER_MERCHANT_orders_post2 ( po->url = TALER_url_join (backend_url, "private/orders", NULL); - req = json_pack ("{s:O}", - "order", (json_t *) order); - GNUNET_assert (NULL != req); + req = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_object_incref ("order", + (json_t *) order), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_string ("payment_target", + payment_target))); if (0 != refund_delay.rel_value_us) { GNUNET_assert (0 == @@ -271,13 +274,6 @@ TALER_MERCHANT_orders_post2 ( GNUNET_JSON_from_time_rel ( refund_delay))); } - if (NULL != payment_target) - { - GNUNET_assert (0 == - json_object_set_new (req, - "payment_target", - json_string (payment_target))); - } if (0 != inventory_products_length) { json_t *ipa = json_array (); @@ -287,11 +283,11 @@ TALER_MERCHANT_orders_post2 ( { json_t *ip; - ip = json_pack ("{s:s, s:I}", - "product_id", - inventory_products[i].product_id, - "quantity", - (json_int_t) inventory_products[i].quantity); + ip = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("product_id", + inventory_products[i].product_id), + GNUNET_JSON_pack_uint64 ("quantity", + inventory_products[i].quantity)); GNUNET_assert (NULL != ip); GNUNET_assert (0 == json_array_append_new (ipa, @@ -311,10 +307,9 @@ TALER_MERCHANT_orders_post2 ( { json_t *u; - u = json_pack ("{s:o}", - "uuid", - GNUNET_JSON_from_data_auto (&uuids[i])); - GNUNET_assert (NULL != u); + u = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_data_auto ("uuid", + &uuids[i])); GNUNET_assert (0 == json_array_append_new (ua, u)); |