summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-12-09 12:07:37 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-12-09 12:07:37 +0100
commitdce723087df51954c04d75509e6e872f5778aea2 (patch)
tree36c60edcbc0db7f917f535bf828d93e4ec4666ba /src/backend
parent4ad2955683e0dec164cb6034bf7900d56b749f98 (diff)
downloadmerchant-dce723087df51954c04d75509e6e872f5778aea2.tar.gz
merchant-dce723087df51954c04d75509e6e872f5778aea2.tar.bz2
merchant-dce723087df51954c04d75509e6e872f5778aea2.zip
45% of /map/in handler
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd.c2
-rw-r--r--src/backend/taler-merchant-httpd_map.c20
2 files changed, 19 insertions, 3 deletions
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);
+
}