summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing_api_cmd_get_reserve.c129
-rw-r--r--src/testing/testing_api_cmd_post_reserves.c21
-rw-r--r--src/testing/testing_api_cmd_post_transfers.c4
3 files changed, 76 insertions, 78 deletions
diff --git a/src/testing/testing_api_cmd_get_reserve.c b/src/testing/testing_api_cmd_get_reserve.c
index ef7f67e0..db6f2562 100644
--- a/src/testing/testing_api_cmd_get_reserve.c
+++ b/src/testing/testing_api_cmd_get_reserve.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2020 Taler Systems SA
+ Copyright (C) 2020-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -75,15 +75,10 @@ struct GetReserveState
static void
get_reserve_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const struct TALER_MERCHANT_ReserveSummary *rs,
- bool active,
- const char *exchange_url,
- const char *payto_uri,
- unsigned int tips_length,
- const struct TALER_MERCHANT_TipDetails tips[])
+ const struct TALER_MERCHANT_ReserveGetResponse *rgr)
{
struct GetReserveState *grs = cls;
+ const struct TALER_MERCHANT_HttpResponse *hr = &rgr->hr;
const struct TALER_TESTING_Command *reserve_cmd;
reserve_cmd = TALER_TESTING_interpreter_lookup_command (
@@ -105,6 +100,7 @@ get_reserve_cb (void *cls,
{
case MHD_HTTP_OK:
{
+ const struct TALER_MERCHANT_ReserveSummary *rs = &rgr->details.ok.rs;
const struct TALER_Amount *initial_amount;
if (GNUNET_OK !=
TALER_TESTING_get_trait_amount (reserve_cmd,
@@ -122,71 +118,76 @@ get_reserve_cb (void *cls,
return;
}
}
- if (tips_length != grs->tips_length)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Number of tips authorized does not match\n");
- TALER_TESTING_interpreter_fail (grs->is);
- return;
- }
- for (unsigned int i = 0; i < tips_length; ++i)
- {
- const struct TALER_TESTING_Command *tip_cmd;
+ unsigned int tips_length = rgr->details.ok.tips_length;
+ const struct TALER_MERCHANT_TipDetails *tips = rgr->details.ok.tips;
- tip_cmd = TALER_TESTING_interpreter_lookup_command (grs->is,
- grs->tips[i]);
+ if (tips_length != grs->tips_length)
{
- const struct TALER_TipIdentifierP *tip_id;
-
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_tip_id (tip_cmd,
- &tip_id))
- TALER_TESTING_interpreter_fail (grs->is);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Number of tips authorized does not match\n");
+ TALER_TESTING_interpreter_fail (grs->is);
+ return;
+ }
+ for (unsigned int i = 0; i < tips_length; ++i)
+ {
+ const struct TALER_TESTING_Command *tip_cmd;
- if (0 != GNUNET_memcmp (&tips[i].tip_id,
- tip_id))
+ tip_cmd = TALER_TESTING_interpreter_lookup_command (grs->is,
+ grs->tips[i]);
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Reserve tip id does not match\n");
- TALER_TESTING_interpreter_fail (grs->is);
- return;
+ const struct TALER_TipIdentifierP *tip_id;
+
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_tip_id (tip_cmd,
+ &tip_id))
+ TALER_TESTING_interpreter_fail (grs->is);
+
+ if (0 != GNUNET_memcmp (&tips[i].tip_id,
+ tip_id))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Reserve tip id does not match\n");
+ TALER_TESTING_interpreter_fail (grs->is);
+ return;
+ }
}
- }
- {
- const struct TALER_Amount *total_amount;
-
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_amount (tip_cmd,
- &total_amount))
- TALER_TESTING_interpreter_fail (grs->is);
-
- if ((GNUNET_OK !=
- TALER_amount_cmp_currency (&tips[i].amount,
- total_amount)) ||
- (0 != TALER_amount_cmp (&tips[i].amount,
- total_amount)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Reserve tip amount does not match\n");
- TALER_TESTING_interpreter_fail (grs->is);
- return;
+ const struct TALER_Amount *total_amount;
+
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_amount (tip_cmd,
+ &total_amount))
+ TALER_TESTING_interpreter_fail (grs->is);
+
+ if ((GNUNET_OK !=
+ TALER_amount_cmp_currency (&tips[i].amount,
+ total_amount)) ||
+ (0 != TALER_amount_cmp (&tips[i].amount,
+ total_amount)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Reserve tip amount does not match\n");
+ TALER_TESTING_interpreter_fail (grs->is);
+ return;
+ }
}
- }
- {
- const char **reason;
-
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_reason (tip_cmd,
- &reason))
- TALER_TESTING_interpreter_fail (grs->is);
-
- if (0 != strcmp (tips[i].reason,
- *reason))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Reserve tip reason does not match\n");
- TALER_TESTING_interpreter_fail (grs->is);
- return;
+ const char **reason;
+
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_reason (tip_cmd,
+ &reason))
+ TALER_TESTING_interpreter_fail (grs->is);
+
+ if (0 != strcmp (tips[i].reason,
+ *reason))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Reserve tip reason does not match\n");
+ TALER_TESTING_interpreter_fail (grs->is);
+ return;
+ }
}
}
}
diff --git a/src/testing/testing_api_cmd_post_reserves.c b/src/testing/testing_api_cmd_post_reserves.c
index b2167534..fe3de9ed 100644
--- a/src/testing/testing_api_cmd_post_reserves.c
+++ b/src/testing/testing_api_cmd_post_reserves.c
@@ -79,32 +79,29 @@ struct PostReservesState
* POST /reserves request to a merchant
*
* @param cls closure
- * @param hr HTTP response details
- * @param reserve_pub public key of the created reserve, NULL on error
- * @param payto_uri where to make the payment to for filling the reserve, NULL on error
+ * @param prr response details
*/
static void
post_reserves_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const struct TALER_ReservePublicKeyP *reserve_pub,
- const char *payto_uri)
+ const struct TALER_MERCHANT_PostReservesResponse *prr)
{
struct PostReservesState *prs = cls;
prs->prh = NULL;
- if (prs->http_status != hr->http_status)
+ if (prs->http_status != prr->hr.http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u (%d) to command %s\n",
- hr->http_status,
- (int) hr->ec,
+ prr->hr.http_status,
+ (int) prr->hr.ec,
TALER_TESTING_interpreter_get_current_label (prs->is));
TALER_TESTING_interpreter_fail (prs->is);
return;
}
- switch (hr->http_status)
+ switch (prr->hr.http_status)
{
case MHD_HTTP_OK:
+ prs->reserve_pub = prr->details.ok.reserve_pub;
break;
case MHD_HTTP_ACCEPTED:
break;
@@ -116,9 +113,9 @@ post_reserves_cb (void *cls,
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Unhandled HTTP status %u for POST /reserves.\n",
- hr->http_status);
+ prr->hr.http_status);
+ break;
}
- prs->reserve_pub = *reserve_pub;
TALER_TESTING_interpreter_next (prs->is);
}
diff --git a/src/testing/testing_api_cmd_post_transfers.c b/src/testing/testing_api_cmd_post_transfers.c
index 9a01d2d5..b73c6b15 100644
--- a/src/testing/testing_api_cmd_post_transfers.c
+++ b/src/testing/testing_api_cmd_post_transfers.c
@@ -404,10 +404,10 @@ debit_cb (
TALER_TESTING_interpreter_fail (pts->is);
return;
}
- for (unsigned int i = 0; i<reply->details.success.details_length; i++)
+ for (unsigned int i = 0; i<reply->details.ok.details_length; i++)
{
const struct TALER_BANK_DebitDetails *details
- = &reply->details.success.details[i];
+ = &reply->details.ok.details[i];
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Bank reports transfer of %s to %s\n",