From dce723087df51954c04d75509e6e872f5778aea2 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Fri, 9 Dec 2016 12:07:37 +0100 Subject: 45% of /map/in handler --- src/backend/taler-merchant-httpd.c | 2 +- src/backend/taler-merchant-httpd_map.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/backend') diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index fd41c614..95ac4b32 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -192,7 +192,7 @@ url_handler (void *cls, { "/history", MHD_HTTP_METHOD_GET, "text/plain", "Only GET is allowed", 0, &MH_handler_history, MHD_HTTP_OK}, - { "/map/in", MHD_HTTP_METHOD_POST, "text/plain", + { "/map/in", MHD_HTTP_METHOD_POST, NULL, "Only POST is allowed", 0, &MH_handler_map_in, MHD_HTTP_OK}, { "/map/out", MHD_HTTP_METHOD_GET, "text/plain", diff --git a/src/backend/taler-merchant-httpd_map.c b/src/backend/taler-merchant-httpd_map.c index 5c69fe41..d6e7f36f 100644 --- a/src/backend/taler-merchant-httpd_map.c +++ b/src/backend/taler-merchant-httpd_map.c @@ -85,6 +85,7 @@ MH_handler_map_in (struct TMH_RequestHandler *rh, json_t *root; json_t *contract; struct GNUNET_HashCode h_contract; + struct GNUNET_HashCode tmp; struct TMH_JsonParseContext *ctx; /* Fetch body */ @@ -117,8 +118,23 @@ MH_handler_map_in (struct TMH_RequestHandler *rh, if ((GNUNET_NO == res) || (NULL == root)) return MHD_YES; - -/* Store body */ + /* Sanity checks */ + GNUNET_assert (GNUNET_OK == + TALER_JSON_hash (contract, + &tmp)); + /* Check hashes match */ + + + /* Store body */ + + /* Test */ + json_t *hello; + + hello = json_pack ("{ss}", "ok", "computer"); + return TMH_RESPONSE_reply_json (connection, + hello, + MHD_HTTP_OK); + } -- cgit v1.2.3