summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-get-orders-ID.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-11-08 00:50:16 +0100
committerChristian Grothoff <christian@grothoff.org>2020-11-08 00:50:16 +0100
commite42cf1a738aef2c2aee32997d157965b02e2fe0d (patch)
tree0332ba70640210f1e4119927e2e5b72005f57163 /src/backend/taler-merchant-httpd_private-get-orders-ID.c
parent579938a29e1d1d4ada49ca4c1a8b0d18878974a9 (diff)
downloadmerchant-e42cf1a738aef2c2aee32997d157965b02e2fe0d.tar.gz
merchant-e42cf1a738aef2c2aee32997d157965b02e2fe0d.tar.bz2
merchant-e42cf1a738aef2c2aee32997d157965b02e2fe0d.zip
adjust error codes in merchant
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-orders-ID.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c82
1 files changed, 48 insertions, 34 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index 9f0b9fef..6d4d625c 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -376,7 +376,7 @@ exchange_timeout_cb (void *cls)
gorc->tt = NULL;
gorc_resume (gorc,
MHD_HTTP_REQUEST_TIMEOUT,
- TALER_EC_GET_ORDERS_EXCHANGE_TIMEOUT);
+ TALER_EC_GENERIC_TIMEOUT);
}
@@ -401,7 +401,7 @@ deposit_get_cb (void *cls,
if (NULL == dd)
{
gorc_report (gorc,
- TALER_EC_GET_ORDERS_EXCHANGE_TRACKING_FAILURE,
+ TALER_EC_MERCHANT_GET_ORDERS_EXCHANGE_TRACKING_FAILURE,
&tq->coin_pub,
hr);
GNUNET_free (tq);
@@ -421,7 +421,7 @@ deposit_get_cb (void *cls,
if (qs < 0)
{
gorc_report (gorc,
- TALER_EC_GET_ORDERS_DB_STORE_TRACKING_FAILURE,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
&tq->coin_pub,
NULL);
GNUNET_free (tq);
@@ -438,7 +438,7 @@ deposit_get_cb (void *cls,
&dd->coin_contribution))
{
gorc_report (gorc,
- TALER_EC_GET_ORDERS_AMOUNT_ARITHMETIC_FAILURE,
+ TALER_EC_MERCHANT_PRIVATE_GET_ORDERS_ID_AMOUNT_ARITHMETIC_FAILURE,
&tq->coin_pub,
NULL);
GNUNET_free (tq);
@@ -454,7 +454,7 @@ deposit_get_cb (void *cls,
&tq->deposit_fee))
{
gorc_report (gorc,
- TALER_EC_GET_ORDERS_AMOUNT_ARITHMETIC_FAILURE,
+ TALER_EC_MERCHANT_PRIVATE_GET_ORDERS_ID_AMOUNT_ARITHMETIC_FAILURE,
&tq->coin_pub,
NULL);
GNUNET_free (tq);
@@ -506,6 +506,18 @@ exchange_found_cb (void *cls,
struct GetOrderRequestContext *gorc = tq->gorc;
tq->fo = NULL;
+ if (NULL == hr)
+ {
+ /* failed */
+ GNUNET_CONTAINER_DLL_remove (gorc->tq_head,
+ gorc->tq_tail,
+ tq);
+ GNUNET_free (tq);
+ gorc_resume (gorc,
+ MHD_HTTP_GATEWAY_TIMEOUT,
+ TALER_EC_MERCHANT_GENERIC_EXCHANGE_TIMEOUT);
+ return;
+ }
if (NULL == eh)
{
/* failed */
@@ -516,8 +528,8 @@ exchange_found_cb (void *cls,
gorc->exchange_hc = hr->http_status;
gorc->exchange_ec = hr->ec;
gorc_resume (gorc,
- MHD_HTTP_FAILED_DEPENDENCY,
- TALER_EC_GET_ORDERS_EXCHANGE_LOOKUP_FAILURE);
+ MHD_HTTP_BAD_GATEWAY,
+ TALER_EC_MERCHANT_GENERIC_EXCHANGE_CONNECT_FAILURE);
return;
}
tq->dgh = TALER_EXCHANGE_deposits_get (eh,
@@ -535,7 +547,7 @@ exchange_found_cb (void *cls,
GNUNET_free (tq);
gorc_resume (gorc,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_EXCHANGE_REQUEST_FAILURE);
+ TALER_EC_MERCHANT_GET_ORDERS_ID_EXCHANGE_REQUEST_FAILURE);
}
}
@@ -587,7 +599,7 @@ deposit_cb (void *cls,
{
gorc_resume (gorc,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_EXCHANGE_LOOKUP_START_FAILURE);
+ TALER_EC_MERCHANT_GET_ORDERS_ID_EXCHANGE_LOOKUP_START_FAILURE);
}
}
@@ -783,7 +795,7 @@ TMH_private_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");
}
gorc->sc.long_poll_timeout
@@ -847,8 +859,8 @@ TMH_private_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_FETCH_CONTRACT_TERMS_ERROR,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "contract terms");
}
{
@@ -873,14 +885,14 @@ TMH_private_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_FETCH_CONTRACT_TERMS_ERROR,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "order");
}
if (order_only && (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) )
{
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
- TALER_EC_GET_ORDERS_ORDER_NOT_FOUND,
+ TALER_EC_MERCHANT_GENERIC_ORDER_UNKNOWN,
hc->infix);
}
if (order_only)
@@ -909,7 +921,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_DB_FETCH_CONTRACT_TERMS_ERROR,
+ TALER_EC_MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID,
hc->infix);
}
if (0 !=
@@ -920,7 +932,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_DB_FETCH_CONTRACT_TERMS_ERROR,
+ TALER_EC_MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID,
gorc->contract_amount.currency);
}
}
@@ -936,7 +948,7 @@ TMH_private_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_FAILED_COMPUTE_PROPOSAL_HASH,
+ TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH,
NULL);
}
}
@@ -973,8 +985,8 @@ TMH_private_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_FETCH_PAYMENT_STATUS,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "payment status");
}
}
if ( (! paid) &&
@@ -999,8 +1011,8 @@ TMH_private_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_FETCH_PAYMENT_STATUS,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "order by fulfillment");
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
@@ -1155,8 +1167,8 @@ TMH_private_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_FETCH_TRANSACTION_ERROR,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "detailed refunds");
}
/* Generate final reply, including wire details if we have them */
@@ -1179,8 +1191,8 @@ TMH_private_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_PAY_DB_FETCH_TRANSACTION_ERROR,
- NULL);
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "transfer details");
}
if (! wired)
@@ -1195,10 +1207,11 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
&gorc->refund_amount))
{
GNUNET_break (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_CONTRACT_CONTENT_INVALID,
- "refund exceeds contract value");
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID,
+ "refund exceeds contract value");
}
if (0 >
TALER_amount_subtract (&expect_total,
@@ -1206,10 +1219,11 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
&gorc->deposit_fees_total))
{
GNUNET_break (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GET_ORDERS_CONTRACT_CONTENT_INVALID,
- "deposit fees exceed total minus refunds");
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_MERCHANT_GENERIC_DB_CONTRACT_CONTENT_INVALID,
+ "deposit fees exceed total minus refunds");
}
if (0 >=
TALER_amount_cmp (&expect_total,