From e42cf1a738aef2c2aee32997d157965b02e2fe0d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 8 Nov 2020 00:50:16 +0100 Subject: adjust error codes in merchant --- ...-merchant-httpd_private-post-orders-ID-refund.c | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c') diff --git a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c index 59b82752..49bc1b6e 100644 --- a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c +++ b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c @@ -145,10 +145,11 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, GNUNET_break (0); GNUNET_JSON_parse_free (spec); json_decref (contract_terms); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_INTERNAL_LOGIC_ERROR, - "Failed to parse contract terms from DB"); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID, + "mandatory fields missing"); } json_decref (contract_terms); if (timestamp.abs_value_us == refund_deadline.abs_value_us) @@ -175,7 +176,7 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, { return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_REFUND_ORDER_ID_UNKNOWN, + TALER_EC_MERCHANT_GENERIC_ORDER_UNKNOWN, hc->infix); } } @@ -202,7 +203,7 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REFUND_STORE_DB_ERROR, + TALER_EC_GENERIC_DB_START_FAILED, NULL); } rs = TMH_db->increase_refund (TMH_db->cls, @@ -242,13 +243,13 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, TALER_amount2s (&refund)); return TALER_MHD_reply_with_error (connection, MHD_HTTP_CONFLICT, - TALER_EC_REFUND_INCONSISTENT_AMOUNT, + TALER_EC_EXCHANGE_REFUND_INCONSISTENT_AMOUNT, "Amount above payment"); case TALER_MERCHANTDB_RS_SOFT_ERROR: case TALER_MERCHANTDB_RS_HARD_ERROR: return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REFUND_MERCHANT_DB_COMMIT_ERROR, + TALER_EC_GENERIC_DB_COMMIT_FAILED, NULL); case TALER_MERCHANTDB_RS_NO_SUCH_ORDER: { @@ -256,10 +257,11 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, "lookup_contract_terms" at the beginning; so if we get 'no such order' here, it must be read as "no PAID order" */ - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_CONFLICT, - TALER_EC_REFUND_ORDER_ID_UNPAID, - hc->infix); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_CONFLICT, + TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_ID_REFUND_ORDER_UNPAID, + hc->infix); } case TALER_MERCHANTDB_RS_SUCCESS: { @@ -276,7 +278,7 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, { return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_REFUND_ORDER_ID_UNKNOWN, + TALER_EC_MERCHANT_GENERIC_ORDER_UNKNOWN, hc->infix); } if (GNUNET_OK != @@ -287,7 +289,7 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, json_decref (contract_terms); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_INTERNAL_LOGIC_ERROR, + TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH, "Could not hash contract terms"); } json_decref (contract_terms); @@ -319,7 +321,7 @@ TMH_private_post_orders_ID_refund (const struct TMH_RequestHandler *rh, GNUNET_break (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_REFUND_DB_INCONSISTENT, + TALER_EC_GENERIC_DB_INVARIANT_FAILURE, NULL); } TMH_notify_order_change (hc->instance, -- cgit v1.2.3