diff options
Diffstat (limited to 'src/lib/merchant_api_tip_authorize.c')
-rw-r--r-- | src/lib/merchant_api_tip_authorize.c | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/src/lib/merchant_api_tip_authorize.c b/src/lib/merchant_api_tip_authorize.c index d45f61a9..0a9c3d86 100644 --- a/src/lib/merchant_api_tip_authorize.c +++ b/src/lib/merchant_api_tip_authorize.c @@ -256,26 +256,19 @@ TALER_MERCHANT_tip_authorize2 ( GNUNET_free (tao); return NULL; } - te_obj = json_pack ("{" - " s:o," /* amount */ - " s:s," /* justification */ - " s:s," /* next_url */ - "}", - "amount", TALER_JSON_from_amount (amount), - "justification", justification, - "next_url", next_url); - if (NULL == te_obj) - { - GNUNET_break (0); - GNUNET_free (tao->url); - GNUNET_free (tao); - return NULL; - } - + te_obj = GNUNET_JSON_PACK ( + TALER_JSON_pack_amount ("amount", + amount), + GNUNET_JSON_pack_string ("justification", + justification), + GNUNET_JSON_pack_string ("next_url", + next_url)); eh = curl_easy_init (); - if (GNUNET_OK != TALER_curl_easy_post (&tao->post_ctx, - eh, - te_obj)) + GNUNET_assert (NULL != eh); + if (GNUNET_OK != + TALER_curl_easy_post (&tao->post_ctx, + eh, + te_obj)) { GNUNET_break (0); json_decref (te_obj); @@ -329,23 +322,15 @@ TALER_MERCHANT_tip_authorize (struct GNUNET_CURL_Context *ctx, GNUNET_free (tao); return NULL; } - te_obj = json_pack ("{" - " s:o," /* amount */ - " s:s," /* justification */ - " s:s," /* next_url */ - "}", - "amount", TALER_JSON_from_amount (amount), - "justification", justification, - "next_url", next_url); - if (NULL == te_obj) - { - GNUNET_break (0); - GNUNET_free (tao->url); - GNUNET_free (tao); - return NULL; - } - + te_obj = GNUNET_JSON_PACK ( + TALER_JSON_pack_amount ("amount", + amount), + GNUNET_JSON_pack_string ("justification", + justification), + GNUNET_JSON_pack_string ("next_url", + next_url)); eh = curl_easy_init (); + GNUNET_assert (NULL != eh); if (GNUNET_OK != TALER_curl_easy_post (&tao->post_ctx, eh, te_obj)) |