summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-post-orders.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-orders.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c57
1 files changed, 30 insertions, 27 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
index bac98d43..b0bfa30f 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -400,7 +400,7 @@ execute_order (struct MHD_Connection *connection,
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_CONFLICT,
- TALER_EC_PROPOSAL_ORDER_BAD_CURRENCY,
+ TALER_EC_GENERIC_CURRENCY_MISMATCH,
TMH_currency);
}
@@ -415,7 +415,7 @@ execute_order (struct MHD_Connection *connection,
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"order:wire_transfer_deadline;order:refund_deadline");
}
@@ -426,7 +426,7 @@ execute_order (struct MHD_Connection *connection,
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"order:products");
}
@@ -477,10 +477,11 @@ execute_order (struct MHD_Connection *connection,
/* This request is not idempotent */
MHD_RESULT ret;
- ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_CONFLICT,
- TALER_EC_PROPOSAL_STORE_DB_ERROR_ALREADY_EXISTS,
- order_id);
+ ret = TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_CONFLICT,
+ TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_ALREADY_EXISTS,
+ order_id);
GNUNET_JSON_parse_free (spec);
return ret;
}
@@ -515,7 +516,7 @@ execute_order (struct MHD_Connection *connection,
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PROPOSAL_STORE_DB_ERROR_SOFT,
+ TALER_EC_GENERIC_DB_SOFT_FAILURE,
NULL);
}
@@ -523,10 +524,11 @@ execute_order (struct MHD_Connection *connection,
{
/* should be: contract (!) with same order ID
already exists */
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_CONFLICT,
- TALER_EC_PROPOSAL_STORE_DB_ERROR_ALREADY_EXISTS,
- order_id);
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_CONFLICT,
+ TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_ALREADY_EXISTS,
+ order_id);
}
/* If we have a product that has insufficient quantities,
@@ -563,7 +565,7 @@ execute_order (struct MHD_Connection *connection,
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PROPOSAL_STORE_DB_ERROR_HARD,
+ TALER_EC_GENERIC_DB_COMMIT_FAILED,
NULL);
}
/* DB transaction succeeded, generate positive response */
@@ -696,7 +698,7 @@ patch_order (struct MHD_Connection *connection,
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_PROPOSAL_NO_LOCALTIME,
+ TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_NO_LOCALTIME,
NULL);
}
off = strftime (buf,
@@ -755,7 +757,7 @@ patch_order (struct MHD_Connection *connection,
{
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
-
+
(void) GNUNET_TIME_round_abs (&now);
/* Add timestamp if it doesn't exist (or is zero) */
if (0 == timestamp.abs_value_us)
@@ -767,7 +769,8 @@ patch_order (struct MHD_Connection *connection,
}
/* If no refund_deadline given, set one based on refund_delay. */
- if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == refund_deadline.abs_value_us)
+ if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us ==
+ refund_deadline.abs_value_us)
{
struct GNUNET_TIME_Absolute rd =
GNUNET_TIME_relative_to_absolute (refund_delay);
@@ -858,7 +861,7 @@ patch_order (struct MHD_Connection *connection,
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PROPOSAL_ORDER_PARSE_ERROR,
+ TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_PROPOSAL_PARSE_ERROR,
"'merchant' field already set, but must be provided by backend");
}
else
@@ -986,7 +989,7 @@ add_payment_details (struct MHD_Connection *connection,
hc->instance->settings.id);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
- TALER_EC_PROPOSAL_INSTANCE_CONFIGURATION_LACKS_WIRE,
+ TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_INSTANCE_CONFIGURATION_LACKS_WIRE,
payment_target);
}
GNUNET_assert (0 ==
@@ -1067,23 +1070,23 @@ merge_inventory (struct MHD_Connection *connection,
&pd);
if (qs <= 0)
{
- enum TALER_ErrorCode ec = TALER_EC_INTERNAL_INVARIANT_FAILURE;
+ enum TALER_ErrorCode ec = TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
unsigned int http_status = 0;
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
http_status = MHD_HTTP_INTERNAL_SERVER_ERROR;
- ec = TALER_EC_ORDERS_LOOKUP_PRODUCT_DB_HARD_FAILURE;
+ ec = TALER_EC_GENERIC_DB_FETCH_FAILED;
break;
case GNUNET_DB_STATUS_SOFT_ERROR:
GNUNET_break (0);
http_status = MHD_HTTP_INTERNAL_SERVER_ERROR;
- ec = TALER_EC_ORDERS_LOOKUP_PRODUCT_DB_SOFT_FAILURE;
+ ec = TALER_EC_GENERIC_DB_SOFT_FAILURE;
break;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
http_status = MHD_HTTP_NOT_FOUND;
- ec = TALER_EC_ORDERS_LOOKUP_PRODUCT_NOT_FOUND;
+ ec = TALER_EC_MERCHANT_GENERIC_PRODUCT_UNKNOWN;
break;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
/* case listed to make compilers happy */
@@ -1253,7 +1256,7 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_ALLOCATION_FAILURE,
+ TALER_EC_GENERIC_ALLOCATION_FAILURE,
"request body normalization for hashing");
}
/* We include the full request: JSON body and the create_token and
@@ -1278,7 +1281,7 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"inventory_products");
}
GNUNET_array_grow (ips,
@@ -1315,7 +1318,7 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"inventory_products");
}
}
@@ -1332,7 +1335,7 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"lock_uuids");
}
GNUNET_array_grow (uuids,
@@ -1370,7 +1373,7 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
- TALER_EC_PARAMETER_MALFORMED,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
"lock_uuids");
}
}