summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c b/src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c
index 1c33d840..ce79037e 100644
--- a/src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c
+++ b/src/backend/taler-merchant-httpd_private-patch-orders-ID-forget.c
@@ -66,6 +66,7 @@ TMH_private_patch_orders_ID_forget (const struct TMH_RequestHandler *rh,
json_t *contract_terms;
uint64_t order_serial;
+ // FIXME: should be a transaction with the update!
qs = TMH_db->lookup_contract_terms (TMH_db->cls,
hc->instance->settings.id,
order_id,
@@ -77,17 +78,17 @@ TMH_private_patch_orders_ID_forget (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_ORDERS_CLAIM_HARD_DB_ERROR,
- "Failed to run DB transaction to lookup order");
+ NULL);
case GNUNET_DB_STATUS_SOFT_ERROR:
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_ORDERS_CLAIM_SOFT_DB_ERROR,
- "Failed to serialize DB transaction to lookup order");
+ NULL);
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_FORGET_ORDER_NOT_FOUND,
- "unknown order id");
+ order_id);
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
GNUNET_assert (NULL != contract_terms);
break;
@@ -116,7 +117,7 @@ TMH_private_patch_orders_ID_forget (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_PARAMETER_MALFORMED,
- "paths");
+ "fields");
}
{
@@ -125,6 +126,7 @@ TMH_private_patch_orders_ID_forget (const struct TMH_RequestHandler *rh,
json_array_foreach (fields, index, value) {
int forget_status = GNUNET_OK;
int expand_status;
+
if (! (json_is_string (value)))
{
json_decref (contract_terms);
@@ -132,7 +134,7 @@ TMH_private_patch_orders_ID_forget (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_FORGET_PATH_SYNTAX_INCORRECT,
- "field isn't a string");
+ "field is not a string");
}
expand_status = TALER_JSON_expand_path (contract_terms,
json_string_value (value),
@@ -146,7 +148,7 @@ TMH_private_patch_orders_ID_forget (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_CONFLICT,
TALER_EC_FORGET_PATH_NOT_FORGETTABLE,
- "field isn't forgettable");
+ json_string_value (value));
}
if (GNUNET_SYSERR == expand_status)
{
@@ -156,7 +158,7 @@ TMH_private_patch_orders_ID_forget (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_FORGET_PATH_SYNTAX_INCORRECT,
- "malformed path");
+ json_string_value (value));
}
}
}
@@ -172,21 +174,22 @@ TMH_private_patch_orders_ID_forget (const struct TMH_RequestHandler *rh,
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_ORDERS_CLAIM_HARD_DB_ERROR,
- "Failed to run DB transaction to update contract terms");
+ NULL);
case GNUNET_DB_STATUS_SOFT_ERROR:
+ // FIXME: We should not re-try a few times AND make this a larger transaction!
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_ORDERS_CLAIM_SOFT_DB_ERROR,
- "Failed to serialize DB transaction to update contract terms");
+ NULL);
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ GNUNET_break (0);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_FORGET_ORDER_NOT_FOUND,
- "unknown order id");
+ order_id);
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
-
json_decref (contract_terms);
json_decref (fields);