merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit dce723087df51954c04d75509e6e872f5778aea2
parent 4ad2955683e0dec164cb6034bf7900d56b749f98
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Fri,  9 Dec 2016 12:07:37 +0100

45% of /map/in handler

Diffstat:
Msrc/backend/taler-merchant-httpd.c | 2+-
Msrc/backend/taler-merchant-httpd_map.c | 20++++++++++++++++++--
2 files changed, 19 insertions(+), 3 deletions(-)

diff --git 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 @@ -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); + }