summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_get_reserve.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_get_reserve.c')
-rw-r--r--src/testing/testing_api_cmd_get_reserve.c129
1 files changed, 65 insertions, 64 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;
+ }
}
}
}