summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-get-orders-ID.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-25 20:32:36 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-25 20:32:36 +0200
commitd354d119db7ca0195cb93140bf3160b11449fa92 (patch)
treeae96671396a0073d4416cb59d57a7a54f87bd20b /src/backend/taler-merchant-httpd_private-get-orders-ID.c
parent0acefc910ff1b86aa04300310d63e3ea88d509de (diff)
downloadmerchant-d354d119db7ca0195cb93140bf3160b11449fa92.tar.gz
merchant-d354d119db7ca0195cb93140bf3160b11449fa92.tar.bz2
merchant-d354d119db7ca0195cb93140bf3160b11449fa92.zip
fix #6432
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.c41
1 files changed, 17 insertions, 24 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 e7c4a2b2..09f9dc51 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -318,14 +318,12 @@ gorc_resume (struct GetOrderRequestContext *gorc,
*
* @param gorc request to add wire report to
* @param ec error code to add
- * @param hint human-readable hint
* @param coin_pub public key of the affected coin
* @param exchange_hr details from exchange, NULL if exchange is blameless
*/
static void
gorc_report (struct GetOrderRequestContext *gorc,
enum TALER_ErrorCode ec,
- const char *hint,
struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_EXCHANGE_HttpResponse *exchange_hr)
{
@@ -333,11 +331,11 @@ gorc_report (struct GetOrderRequestContext *gorc,
GNUNET_assert (0 ==
json_array_append_new (
gorc->wire_reports,
- json_pack ("{s:I, s:s, s:I, s:I, s:o}",
+ json_pack ("{s:I, s:s, s:I, s:I, s:o }",
"code",
(json_int_t) ec,
"hint",
- hint,
+ TALER_ErrorCode_get_hint (ec),
"exchange_ec",
(json_int_t) exchange_hr->ec,
"exchange_hc",
@@ -348,11 +346,11 @@ gorc_report (struct GetOrderRequestContext *gorc,
GNUNET_assert (0 ==
json_array_append_new (
gorc->wire_reports,
- json_pack ("{s:I, s:s, s:o}",
+ json_pack ("{s:I, s:s, s:o }",
"code",
(json_int_t) ec,
"hint",
- hint,
+ TALER_ErrorCode_get_hint (ec),
"coin_pub",
GNUNET_JSON_from_data_auto (coin_pub))));
}
@@ -398,7 +396,6 @@ deposit_get_cb (void *cls,
{
gorc_report (gorc,
TALER_EC_GET_ORDERS_EXCHANGE_TRACKING_FAILURE,
- "Exchange failed to return tracking data",
&tq->coin_pub,
hr);
GNUNET_free (tq);
@@ -419,7 +416,6 @@ deposit_get_cb (void *cls,
{
gorc_report (gorc,
TALER_EC_GET_ORDERS_DB_STORE_TRACKING_FAILURE,
- "Merchant backend failed to store transfer details in DB",
&tq->coin_pub,
NULL);
GNUNET_free (tq);
@@ -437,7 +433,6 @@ deposit_get_cb (void *cls,
{
gorc_report (gorc,
TALER_EC_GET_ORDERS_AMOUNT_ARITHMETIC_FAILURE,
- "Merchant backend could not sum up deposit total",
&tq->coin_pub,
NULL);
GNUNET_free (tq);
@@ -454,7 +449,6 @@ deposit_get_cb (void *cls,
{
gorc_report (gorc,
TALER_EC_GET_ORDERS_AMOUNT_ARITHMETIC_FAILURE,
- "Merchant backend could not sum up deposit fees",
&tq->coin_pub,
NULL);
GNUNET_free (tq);
@@ -470,7 +464,6 @@ deposit_get_cb (void *cls,
/* got a 'preliminary' reply from the exchange, simply skip */
gorc_report (gorc,
TALER_EC_NONE,
- "Exchange returned preliminary response",
&tq->coin_pub,
hr);
}
@@ -794,7 +787,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_PARAMETER_MALFORMED,
- "timeout must be non-negative number");
+ "timeout_ms must be non-negative number");
}
gorc->sc.long_poll_timeout
= GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply (
@@ -850,14 +843,14 @@ 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,
- "db error fetching contract terms");
+ NULL);
}
if (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,
- "Did not find contract terms for order in DB");
+ hc->infix);
}
/* extract the fulfillment URL and total amount from the contract terms! */
@@ -878,7 +871,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GET_ORDERS_DB_FETCH_CONTRACT_TERMS_ERROR,
- "Merchant database error (contract terms corrupted)");
+ hc->infix);
}
if (0 !=
strcasecmp (TMH_currency,
@@ -889,7 +882,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GET_ORDERS_DB_FETCH_CONTRACT_TERMS_ERROR,
- "Merchant database error (contract terms in wrong currency)");
+ gorc->contract_amount.currency);
}
}
gorc->fulfillment_url
@@ -906,7 +899,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_FAILED_COMPUTE_PROPOSAL_HASH,
- "Failed to hash contract terms");
+ NULL);
}
}
}
@@ -915,7 +908,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (connection,
gorc->wire_hc,
gorc->wire_ec,
- "Failed to obtain wire details");
+ NULL);
}
GNUNET_assert (NULL != gorc->contract_terms);
@@ -941,7 +934,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_PAYMENT_STATUS,
- "DB error fetching payment status");
+ NULL);
}
}
if ( (! paid) &&
@@ -963,7 +956,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_PAYMENT_STATUS,
- "DB error fetching payment status");
+ NULL);
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
{
@@ -1093,7 +1086,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_TRANSACTION_ERROR,
- "Merchant database error");
+ NULL);
}
/* Generate final reply, including wire details if we have them */
@@ -1117,7 +1110,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_PAY_DB_FETCH_TRANSACTION_ERROR,
- "Merchant database error");
+ NULL);
}
if (! wired)
@@ -1135,7 +1128,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_CONTRACT_CONTENT_INVALID,
- "Inconsistent contract terms in DB");
+ "refund exceeds contract value");
}
if (0 >
TALER_amount_subtract (&expect_total,
@@ -1146,7 +1139,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_CONTRACT_CONTENT_INVALID,
- "Inconsistent contract terms in DB");
+ "deposit fees exceed total minus refunds");
}
if (0 >=
TALER_amount_cmp (&expect_total,