diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-01 22:48:29 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-01 22:48:29 +0200 |
commit | a74c2c8ef4bbfec172381f2d9c225d7ccb8bd855 (patch) | |
tree | 0f8dad3980e215dbf22c4e87470d4fb83a9caab6 | |
parent | 118c2bb48f2ebc13734df9d208c285934622a475 (diff) | |
download | sync-a74c2c8ef4bbfec172381f2d9c225d7ccb8bd855.tar.gz sync-a74c2c8ef4bbfec172381f2d9c225d7ccb8bd855.tar.bz2 sync-a74c2c8ef4bbfec172381f2d9c225d7ccb8bd855.zip |
-replace json_pack
-rw-r--r-- | src/sync/sync-httpd_backup_post.c | 33 | ||||
-rw-r--r-- | src/sync/sync-httpd_config.c | 14 | ||||
-rw-r--r-- | src/sync/sync-httpd_terms.c | 18 |
3 files changed, 32 insertions, 33 deletions
diff --git a/src/sync/sync-httpd_backup_post.c b/src/sync/sync-httpd_backup_post.c index 8dd1fc2..962142d 100644 --- a/src/sync/sync-httpd_backup_post.c +++ b/src/sync/sync-httpd_backup_post.c @@ -320,19 +320,15 @@ proposal_cb (void *cls, por->hr.http_status, (unsigned int) por->hr.ec); GNUNET_break_op (0); - bc->resp = TALER_MHD_make_json_pack ( - "{s:I, s:s, s:I, s:I, s:O?}", - "code", - (json_int_t) TALER_EC_SYNC_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 != bc->resp); + bc->resp = TALER_MHD_MAKE_JSON_PACK ( + TALER_JSON_pack_ec (TALER_EC_SYNC_PAYMENT_CREATE_BACKEND_ERROR), + 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))); bc->response_code = MHD_HTTP_BAD_GATEWAY; return; } @@ -554,10 +550,13 @@ begin_payment (struct BackupContext *bc, "Suspending connection while creating order at `%s'\n", SH_backend_url); MHD_suspend_connection (bc->con); - order = json_pack ("{s:o, s:s, s:s}", - "amount", TALER_JSON_from_amount (&SH_annual_fee), - "summary", "annual fee for sync service", - "fulfillment_url", SH_fulfillment_url); + order = GNUNET_JSON_PACK ( + TALER_JSON_pack_amount ("amount", + &SH_annual_fee), + GNUNET_JSON_pack_string ("summary", + "annual fee for sync service"), + GNUNET_JSON_pack_string ("fulfillment_url", + SH_fulfillment_url)); bc->po = TALER_MERCHANT_orders_post2 (SH_ctx, SH_backend_url, order, diff --git a/src/sync/sync-httpd_config.c b/src/sync/sync-httpd_config.c index 23ea24b..065bbdd 100644 --- a/src/sync/sync-httpd_config.c +++ b/src/sync/sync-httpd_config.c @@ -49,13 +49,13 @@ SH_handler_config (struct SH_RequestHandler *rh, const char *upload_data, size_t *upload_data_size) { - return TALER_MHD_reply_json_pack (connection, - MHD_HTTP_OK, - "{s:s, s:s}", - "name", - "sync", - "version", - "1:0:1"); + return TALER_MHD_REPLY_JSON_PACK ( + connection, + MHD_HTTP_OK, + GNUNET_JSON_pack_string ("name", + "sync"), + GNUNET_JSON_pack_string ("version", + "1:0:1")); } diff --git a/src/sync/sync-httpd_terms.c b/src/sync/sync-httpd_terms.c index c2d32aa..2ff0101 100644 --- a/src/sync/sync-httpd_terms.c +++ b/src/sync/sync-httpd_terms.c @@ -40,13 +40,13 @@ SH_handler_terms (struct SH_RequestHandler *rh, const char *upload_data, size_t *upload_data_size) { - return TALER_MHD_reply_json_pack (connection, - MHD_HTTP_OK, - "{s:I, s:o, s:s}", - "storage_limit_in_megabytes", - (json_int_t) SH_upload_limit_mb, - "annual_fee", - TALER_JSON_from_amount (&SH_annual_fee), - "version", - "0.0"); + return TALER_MHD_REPLY_JSON_PACK ( + connection, + MHD_HTTP_OK, + GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes", + SH_upload_limit_mb), + TALER_JSON_pack_amount ("annual_fee", + &SH_annual_fee), + GNUNET_JSON_pack_string ("version", + "0.0")); } |