summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_get-orders-ID.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_get-orders-ID.c')
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c62
1 files changed, 32 insertions, 30 deletions
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c
index 5c6949bb..c0922f67 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -694,7 +694,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"token");
}
}
@@ -714,7 +714,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"h_contract");
}
}
@@ -738,7 +738,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"timeout_ms (must be non-negative number)");
}
god->sc.long_poll_timeout
@@ -783,7 +783,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"refund");
}
god->sc.awaiting_refund = true;
@@ -815,8 +815,8 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "contract terms");
}
}
@@ -834,8 +834,8 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_free (god);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_INTERNAL_LOGIC_ERROR,
- "could not hash contract terms");
+ TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH,
+ "contract terms");
}
contract_match = (0 ==
GNUNET_memcmp (&h,
@@ -845,10 +845,11 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
(! contract_match) )
{
GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_FORBIDDEN,
- TALER_EC_GET_ORDER_WRONG_CONTRACT,
- NULL);
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER,
+ NULL);
}
}
@@ -874,8 +875,8 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "order");
}
god->unclaimed = (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) &&
! contract_available;
@@ -887,7 +888,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
order_id);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
- TALER_EC_GET_ORDERS_ID_UNKNOWN,
+ TALER_EC_MERCHANT_GENERIC_ORDER_UNKNOWN,
order_id);
}
token_match = (0 == GNUNET_memcmp (&db_claim_token,
@@ -901,7 +902,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_CONTRACT_CONTENT_INVALID,
+ TALER_EC_MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID,
order_id);
}
@@ -921,7 +922,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_FORBIDDEN,
- TALER_EC_MERCHANT_GET_ORDER_INVALID_TOKEN,
+ TALER_EC_MERCHANT_GET_ORDERS_ID_INVALID_TOKEN,
NULL);
}
if ( ( (! token_match) ||
@@ -932,13 +933,14 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
{
if (GNUNET_NO ==
GNUNET_is_zero (&god->h_contract_terms))
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_FORBIDDEN,
- TALER_EC_GET_ORDER_WRONG_CONTRACT,
- NULL);
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_FORBIDDEN,
+ TALER_EC_MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER,
+ NULL);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_FORBIDDEN,
- TALER_EC_MERCHANT_GET_ORDER_INVALID_TOKEN,
+ TALER_EC_MERCHANT_GET_ORDERS_ID_INVALID_TOKEN,
NULL);
}
if (god->generate_html)
@@ -1014,8 +1016,8 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "order by fulfillment");
}
if ( (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) ||
(0 != strcmp (order_id,
@@ -1052,8 +1054,8 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "order status");
}
GNUNET_break (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
GNUNET_break (0 ==
@@ -1084,8 +1086,8 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "refunds, detailed");
}
if ( ((god->sc.awaiting_refund) &&
@@ -1134,7 +1136,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_break (0);
return TALER_MHD_reply_with_error (god->sc.con,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_ALLOCATION_FAILURE,
+ TALER_EC_GENERIC_ALLOCATION_FAILURE,
"refund URI");
}
qr = TMH_create_qrcode (uri);
@@ -1144,7 +1146,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
GNUNET_free (uri);
return TALER_MHD_reply_with_error (god->sc.con,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_ALLOCATION_FAILURE,
+ TALER_EC_GENERIC_ALLOCATION_FAILURE,
"qr code");
}
{