summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_post_orders.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_post_orders.c')
-rw-r--r--src/testing/testing_api_cmd_post_orders.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/testing/testing_api_cmd_post_orders.c b/src/testing/testing_api_cmd_post_orders.c
index b9ea27e9..b4a56ee3 100644
--- a/src/testing/testing_api_cmd_post_orders.c
+++ b/src/testing/testing_api_cmd_post_orders.c
@@ -68,7 +68,7 @@ struct OrdersState
/**
* The /orders operation handle.
*/
- struct TALER_MERCHANT_PostOrdersOperation *po;
+ struct TALER_MERCHANT_PostOrdersHandle *po;
/**
* The (initial) POST /orders/$ID/claim operation handle.
@@ -243,26 +243,20 @@ orders_claim_cb (void *cls,
* method.
*
* @param cls closure.
- * @param hr HTTP response
- * @param order_id order id of the orders.
- * @param claim_token claim token
+ * @param por details about the response
*/
static void
order_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const char *order_id,
- const struct TALER_ClaimTokenP *claim_token)
+ const struct TALER_MERCHANT_PostOrdersReply *por)
{
struct OrdersState *ps = cls;
ps->po = NULL;
- if (NULL != claim_token)
- ps->claim_token = *claim_token;
- if (ps->http_status != hr->http_status)
+ if (ps->http_status != por->hr.http_status)
{
TALER_LOG_ERROR ("Given vs expected: %u(%d) vs %u\n",
- hr->http_status,
- (int) hr->ec,
+ por->hr.http_status,
+ (int) por->hr.ec,
ps->http_status);
TALER_TESTING_FAIL (ps->is);
}
@@ -272,12 +266,14 @@ order_cb (void *cls,
TALER_TESTING_interpreter_next (ps->is);
return;
}
- switch (hr->http_status)
+ switch (por->hr.http_status)
{
case MHD_HTTP_OK:
- ps->order_id = GNUNET_strdup (order_id);
+ if (NULL != por->details.ok.token)
+ ps->claim_token = *por->details.ok.token;
+ ps->order_id = GNUNET_strdup (por->details.ok.order_id);
if ((NULL != ps->expected_order_id) &&
- (0 != strcmp (order_id,
+ (0 != strcmp (por->details.ok.order_id,
ps->expected_order_id)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -290,6 +286,7 @@ order_cb (void *cls,
const struct TALER_TESTING_Command *order_cmd;
const struct TALER_ClaimTokenP *prev_token;
struct TALER_ClaimTokenP zero_token = {0};
+
order_cmd = TALER_TESTING_interpreter_lookup_command (
ps->is,
ps->duplicate_of);
@@ -303,10 +300,10 @@ order_cb (void *cls,
TALER_TESTING_interpreter_fail (ps->is);
return;
}
- if (NULL == claim_token)
+ if (NULL == por->details.ok.token)
prev_token = &zero_token;
if (0 != GNUNET_memcmp (prev_token,
- claim_token))
+ por->details.ok.token))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Claim tokens for identical requests do not match\n");
@@ -315,17 +312,20 @@ order_cb (void *cls,
}
}
break;
+ case MHD_HTTP_GONE:
+ TALER_TESTING_interpreter_next (ps->is);
+ return;
case MHD_HTTP_CONFLICT:
TALER_TESTING_interpreter_next (ps->is);
return;
default:
{
- char *s = json_dumps (hr->reply,
+ char *s = json_dumps (por->hr.reply,
JSON_COMPACT);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected status code from /orders: %u (%d) at %s; JSON: %s\n",
- hr->http_status,
- hr->ec,
+ por->hr.http_status,
+ (int) por->hr.ec,
TALER_TESTING_interpreter_get_current_label (ps->is),
s);
GNUNET_free (s);