diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-07-31 22:50:16 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-07-31 22:50:21 +0200 |
commit | 1db139a7f3b74b2dc4135ab8b42d625415705d63 (patch) | |
tree | dbbd66f083001bdefc9b029c1f45a5c2cf93697e /src/backend/anastasis-httpd_truth_upload.c | |
parent | 812423c3872dce704ce9161127c7ebfbb7034fbe (diff) | |
download | anastasis-1db139a7f3b74b2dc4135ab8b42d625415705d63.tar.gz anastasis-1db139a7f3b74b2dc4135ab8b42d625415705d63.tar.bz2 anastasis-1db139a7f3b74b2dc4135ab8b42d625415705d63.zip |
-eliminating some legacy json_pack calls from Anastasis
Diffstat (limited to 'src/backend/anastasis-httpd_truth_upload.c')
-rw-r--r-- | src/backend/anastasis-httpd_truth_upload.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/src/backend/anastasis-httpd_truth_upload.c b/src/backend/anastasis-httpd_truth_upload.c index 9767087..130876f 100644 --- a/src/backend/anastasis-httpd_truth_upload.c +++ b/src/backend/anastasis-httpd_truth_upload.c @@ -264,19 +264,18 @@ proposal_cb (void *cls, por->hr.http_status, (int) por->hr.ec); GNUNET_break (0); - tuc->resp = TALER_MHD_make_json_pack ( - "{s:I, s:s, s:I, s:I, s:O?}", - "code", - (json_int_t) TALER_EC_ANASTASIS_GENERIC_ORDER_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 != tuc->resp); + tuc->resp = TALER_MHD_MAKE_JSON_PACK ( + GNUNET_JSON_pack_uint64 ("code", + TALER_EC_ANASTASIS_GENERIC_ORDER_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_incref ("backend-reply", + (json_t *) por->hr.reply))); tuc->response_code = MHD_HTTP_BAD_GATEWAY; return; } @@ -381,19 +380,19 @@ check_payment_cb (void *cls, case MHD_HTTP_UNAUTHORIZED: /* Configuration issue, complain! */ tuc->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; - tuc->resp = TALER_MHD_make_json_pack ( - "{s:I, s:s, s:I, s:I, s:O?}", - "code", - (json_int_t) TALER_EC_ANASTASIS_GENERIC_PAYMENT_CHECK_UNAUTHORIZED, - "hint", - TALER_ErrorCode_get_hint ( - TALER_EC_ANASTASIS_GENERIC_PAYMENT_CHECK_UNAUTHORIZED), - "backend-ec", - (json_int_t) hr->ec, - "backend-http-status", - (json_int_t) hr->http_status, - "backend-reply", - hr->reply); + tuc->resp = TALER_MHD_MAKE_JSON_PACK ( + GNUNET_JSON_pack_uint64 ("code", + TALER_EC_ANASTASIS_GENERIC_PAYMENT_CHECK_UNAUTHORIZED), + GNUNET_JSON_pack_string ("hint", + TALER_ErrorCode_get_hint ( + TALER_EC_ANASTASIS_GENERIC_PAYMENT_CHECK_UNAUTHORIZED)), + GNUNET_JSON_pack_uint64 ("backend-ec", + hr->ec), + GNUNET_JSON_pack_uint64 ("backend-http-status", + hr->http_status), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_object_incref ("backend-reply", + (json_t *) hr->reply))); GNUNET_assert (NULL != tuc->resp); break; case MHD_HTTP_NOT_FOUND: @@ -441,18 +440,19 @@ check_payment_cb (void *cls, default: /* Unexpected backend response */ tuc->response_code = MHD_HTTP_BAD_GATEWAY; - tuc->resp = TALER_MHD_make_json_pack ( - "{s:I, s:s, s:I, s:I, s:O?}", - "code", - (json_int_t) TALER_EC_ANASTASIS_GENERIC_BACKEND_ERROR, - "hint", - TALER_ErrorCode_get_hint (TALER_EC_ANASTASIS_GENERIC_BACKEND_ERROR), - "backend-ec", - (json_int_t) hr->ec, - "backend-http-status", - (json_int_t) hr->http_status, - "backend-reply", - hr->reply); + tuc->resp = TALER_MHD_MAKE_JSON_PACK ( + GNUNET_JSON_pack_uint64 ("code", + TALER_EC_ANASTASIS_GENERIC_BACKEND_ERROR), + GNUNET_JSON_pack_string ("hint", + TALER_ErrorCode_get_hint ( + TALER_EC_ANASTASIS_GENERIC_BACKEND_ERROR)), + GNUNET_JSON_pack_uint64 ("backend-ec", + (json_int_t) hr->ec), + GNUNET_JSON_pack_uint64 ("backend-http-status", + (json_int_t) hr->http_status), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_object_incref ("backend-reply", + (json_t *) hr->reply))); break; } GNUNET_CONTAINER_DLL_remove (tuc_head, |