diff options
Diffstat (limited to 'src/lib/merchant_api_post_order_abort.c')
-rw-r--r-- | src/lib/merchant_api_post_order_abort.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/src/lib/merchant_api_post_order_abort.c b/src/lib/merchant_api_post_order_abort.c index f8cdaab4..47df8ec4 100644 --- a/src/lib/merchant_api_post_order_abort.c +++ b/src/lib/merchant_api_post_order_abort.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014, 2015, 2016, 2017, 2020 Taler Systems SA + Copyright (C) 2014-2021 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -348,34 +348,27 @@ TALER_MERCHANT_order_abort (struct GNUNET_CURL_Context *ctx, json_t *j_coin; /* create JSON for this coin */ - j_coin = json_pack ( - "{s:o, s:o,s:s}", - "coin_pub", - GNUNET_JSON_from_data_auto (&ac->coin_pub), - "contribution", - TALER_JSON_from_amount (&ac->amount_with_fee), - "exchange_url", - ac->exchange_url); - if ( (NULL == j_coin) || - (0 != - json_array_append_new (j_coins, - j_coin)) ) + j_coin = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_data_auto ("coin_pub", + &ac->coin_pub), + TALER_JSON_pack_amount ("contribution", + &ac->amount_with_fee), + GNUNET_JSON_pack_string ("exchange_url", + ac->exchange_url)); + if (0 != + json_array_append_new (j_coins, + j_coin)) { GNUNET_break (0); json_decref (j_coins); return NULL; } } - abort_obj = json_pack ("{s:o,s:o}", - "coins", - j_coins, /* reference consumed! */ - "h_contract", - GNUNET_JSON_from_data_auto (h_contract)); - if (NULL == abort_obj) - { - GNUNET_break (0); - return NULL; - } + abort_obj = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_array_steal ("coins", + j_coins), + GNUNET_JSON_pack_data_auto ("h_contract", + h_contract)); oah = GNUNET_new (struct TALER_MERCHANT_OrderAbortHandle); oah->h_contract_terms = *h_contract; oah->merchant_pub = *merchant_pub; |