commit cecafaab58860d7b49ce72d139270f8517ea6025
parent f8c01f4b46a8391f3196889e5df7f8ebdfb6475d
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 23 Jun 2020 19:51:47 +0200
use and handle all /pay status codes
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -848,7 +848,7 @@ process_pay_with_exchange (void *cls,
GNUNET_break_op (0);
resume_pay_with_response (
pc,
- MHD_HTTP_UNAUTHORIZED,
+ MHD_HTTP_FORBIDDEN,
TALER_MHD_make_json_pack (
"{s:s, s:I, s:i}",
"hint", "deposit signature invalid",
diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c
@@ -245,7 +245,6 @@ handle_pay_finished (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"/pay completed with response code %u\n",
(unsigned int) response_code);
- // FIXME: check response codes here match documentation match what service generates!
switch (response_code)
{
case 0:
@@ -306,6 +305,11 @@ handle_pay_finished (void *cls,
* or the merchant is buggy (or API version conflict);
* just pass JSON reply to the application */
break;
+ case MHD_HTTP_PAYMENT_REQUIRED:
+ /* was originally paid, but then refunded */
+ hr.ec = TALER_JSON_get_error_code (json);
+ hr.hint = TALER_JSON_get_error_hint (json);
+ break;
case MHD_HTTP_FORBIDDEN:
hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json);