merchant

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

commit e486247621e71d4f7586b9439fc98f6dbc8b6fd2
parent b98a6a4501c8333a5bf025ea60a38e45512048ff
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Wed, 14 Jun 2017 10:21:28 +0200

add /refund route

Diffstat:
Msrc/backend/taler-merchant-httpd.c | 18+++++++++++++-----
Msrc/backend/taler-merchant-httpd_mhd.c | 8++++----
2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c @@ -175,9 +175,6 @@ url_handler (void *cls, { "/", MHD_HTTP_METHOD_GET, "text/plain", "Hello, I'm a merchant's Taler backend. This HTTP server is not for humans.\n", 0, &TMH_MHD_handler_static_response, MHD_HTTP_OK }, - { "/proposal", MHD_HTTP_METHOD_POST, "application/json", - NULL, 0, - &MH_handler_proposal_put, MHD_HTTP_OK }, { "/pay", MHD_HTTP_METHOD_POST, "application/json", NULL, 0, &MH_handler_pay, MHD_HTTP_OK }, @@ -199,13 +196,24 @@ url_handler (void *cls, { "/history", MHD_HTTP_METHOD_GET, "text/plain", "Only GET is allowed", 0, &MH_handler_history, MHD_HTTP_OK}, + { "/proposal", MHD_HTTP_METHOD_POST, "application/json", + NULL, 0, + &MH_handler_proposal_put, MHD_HTTP_OK }, { "/proposal", MHD_HTTP_METHOD_GET, "text/plain", - "Only GET is allowed", 0, + NULL, 0, &MH_handler_proposal_lookup, MHD_HTTP_OK}, { "/proposal", NULL, "text/plain", "Only GET/POST are allowed", 0, &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED }, - + { "/refund", MHD_HTTP_METHOD_POST, "application/json", + NULL, 0, + &MH_handler_refund_increase, MHD_HTTP_OK}, + { "/refund", MHD_HTTP_METHOD_GET, "text/plain", + NULL, 0, + &MH_handler_refund_lookup, MHD_HTTP_OK}, + { "/refund", NULL, "application/json", + "Only POST/GET are allowed", 0, + &TMH_MHD_handler_send_json_pack_error, MHD_HTTP_METHOD_NOT_ALLOWED}, {NULL, NULL, NULL, NULL, 0, 0 } }; static struct TMH_RequestHandler h404 = diff --git a/src/backend/taler-merchant-httpd_mhd.c b/src/backend/taler-merchant-httpd_mhd.c @@ -146,10 +146,10 @@ TMH_MHD_handler_send_json_pack_error (struct TMH_RequestHandler *rh, size_t *upload_data_size) { return TMH_RESPONSE_reply_json_pack (connection, - rh->response_code, - "{s:s}", - "error", - rh->data); + rh->response_code, + "{s:s}", + "error", + rh->data); }