diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c b/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c index 2181f1eb..da5a315e 100644 --- a/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c +++ b/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c @@ -81,37 +81,31 @@ authorize_tip (const struct TMH_RequestHandler *rh, /* handle errors */ if (TALER_EC_NONE != ec) { - unsigned int rc; - const char *msg; + unsigned int http_status; switch (ec) { case TALER_EC_TIP_AUTHORIZE_INSUFFICIENT_FUNDS: - rc = MHD_HTTP_PRECONDITION_FAILED; - msg = "Failed to approve tip: merchant has insufficient tipping funds"; + http_status = MHD_HTTP_PRECONDITION_FAILED; break; case TALER_EC_TIP_AUTHORIZE_RESERVE_EXPIRED: - msg = "Failed to approve tip: merchant's tipping reserve expired"; - rc = MHD_HTTP_GONE; + http_status = MHD_HTTP_GONE; break; case TALER_EC_TIP_AUTHORIZE_RESERVE_UNKNOWN: - msg = "Failed to approve tip: merchant's tipping reserve does not exist"; - rc = MHD_HTTP_SERVICE_UNAVAILABLE; + http_status = MHD_HTTP_SERVICE_UNAVAILABLE; break; case TALER_EC_TIP_AUTHORIZE_DB_RESERVE_NOT_FOUND: - msg = "Failed to approve tip: merchant's tipping reserve does not exist"; - rc = MHD_HTTP_NOT_FOUND; + http_status = MHD_HTTP_NOT_FOUND; break; default: - rc = MHD_HTTP_INTERNAL_SERVER_ERROR; - msg = "Failed to approve tip: internal server error"; + http_status = MHD_HTTP_INTERNAL_SERVER_ERROR; break; } return TALER_MHD_reply_with_error (connection, - rc, + http_status, ec, - msg); + NULL); } /* generate success response */ @@ -173,7 +167,7 @@ TMH_private_post_reserves_ID_authorize_tip (const struct TMH_RequestHandler *rh, return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_RESERVES_INVALID_RESERVE_PUB, - "reserve public key malformed"); + hc->infix); } return authorize_tip (rh, connection, |