From 1db139a7f3b74b2dc4135ab8b42d625415705d63 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 31 Jul 2021 22:50:16 +0200 Subject: -eliminating some legacy json_pack calls from Anastasis --- src/backend/anastasis-httpd_truth.c | 44 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'src/backend/anastasis-httpd_truth.c') diff --git a/src/backend/anastasis-httpd_truth.c b/src/backend/anastasis-httpd_truth.c index 164c33a..b0b6530 100644 --- a/src/backend/anastasis-httpd_truth.c +++ b/src/backend/anastasis-httpd_truth.c @@ -520,19 +520,18 @@ proposal_cb (void *cls, por->hr.http_status, (int) por->hr.ec); GNUNET_break (0); - gc->resp = TALER_MHD_make_json_pack ( - "{s:I, s:s, s:I, s:I, s:O?}", - "code", - (json_int_t) TALER_EC_ANASTASIS_TRUTH_PAYMENT_CREATE_BACKEND_ERROR, - "hint", - "Failed to setup order with merchant backend", - "backend-ec", - (json_int_t) por->hr.ec, - "backend-http-status", - (json_int_t) por->hr.http_status, - "backend-reply", - por->hr.reply); - GNUNET_assert (NULL != gc->resp); + gc->resp = TALER_MHD_MAKE_JSON_PACK ( + GNUNET_JSON_pack_uint64 ("code", + TALER_EC_ANASTASIS_TRUTH_PAYMENT_CREATE_BACKEND_ERROR), + GNUNET_JSON_pack_string ("hint", + "Failed to setup order with merchant backend"), + GNUNET_JSON_pack_uint64 ("backend-ec", + por->hr.ec), + GNUNET_JSON_pack_uint64 ("backend-http-status", + por->hr.http_status), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_object_steal ("backend-reply", + (json_t *) por->hr.reply))); gc->response_code = MHD_HTTP_BAD_GATEWAY; return; } @@ -727,14 +726,17 @@ begin_payment (struct GetContext *gc) pay_deadline = GNUNET_TIME_relative_to_absolute ( ANASTASIS_CHALLENGE_OFFER_LIFETIME); GNUNET_TIME_round_abs (&pay_deadline); - order = json_pack ("{s:o, s:s, s:s, s:o, s:o}", - "amount", TALER_JSON_from_amount (&gc->challenge_cost), - "summary", "challenge fee for anastasis service", - "order_id", order_id, - "auto_refund", GNUNET_JSON_from_time_rel ( - AUTO_REFUND_TIMEOUT), - "pay_deadline", GNUNET_JSON_from_time_abs ( - pay_deadline)); + order = GNUNET_JSON_PACK ( + TALER_JSON_pack_amount ("amount", + &gc->challenge_cost), + GNUNET_JSON_pack_string ("summary", + "challenge fee for anastasis service"), + GNUNET_JSON_pack_string ("order_id", + order_id), + GNUNET_JSON_pack_time_rel ("auto_refund", + AUTO_REFUND_TIMEOUT), + GNUNET_JSON_pack_time_abs ("pay_deadline", + pay_deadline)); gc->po = TALER_MERCHANT_orders_post2 (AH_ctx, AH_backend_url, order, -- cgit v1.2.3