summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_get_transfers.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-06-03 23:24:31 +0200
committerChristian Grothoff <christian@grothoff.org>2023-06-03 23:24:31 +0200
commit7f8c111f1383805d64ab7f754cb6456d3dfb7250 (patch)
tree4b5561f5e7ed8a07be933ccd6bbd2c8ec29aa0f0 /src/testing/testing_api_cmd_get_transfers.c
parentcea5867be3735f7c418a456b93ba9a45535f8cbc (diff)
downloadmerchant-7f8c111f1383805d64ab7f754cb6456d3dfb7250.tar.gz
merchant-7f8c111f1383805d64ab7f754cb6456d3dfb7250.tar.bz2
merchant-7f8c111f1383805d64ab7f754cb6456d3dfb7250.zip
address more FIXMEs
Diffstat (limited to 'src/testing/testing_api_cmd_get_transfers.c')
-rw-r--r--src/testing/testing_api_cmd_get_transfers.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/src/testing/testing_api_cmd_get_transfers.c b/src/testing/testing_api_cmd_get_transfers.c
index 33c2d462..50544587 100644
--- a/src/testing/testing_api_cmd_get_transfers.c
+++ b/src/testing/testing_api_cmd_get_transfers.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2018, 2020 Taler Systems SA
+ Copyright (C) 2014-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
@@ -83,42 +83,40 @@ struct GetTransfersState
* Check the result of our GET /transfers request to a merchant
*
* @param cls closure
- * @param hr HTTP response details
- * @param transfers_length length of the @a transfers array
- * @param transfers array with details about the transfers we received
+ * @param gtr response details
*/
static void
get_transfers_cb (
void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- unsigned int transfers_length,
- const struct TALER_MERCHANT_TransferData transfers[])
+ const struct TALER_MERCHANT_GetTransfersResponse *gtr)
{
struct GetTransfersState *gts = cls;
gts->gth = NULL;
- if (gts->http_status != hr->http_status)
+ if (gts->http_status != gtr->hr.http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u (%d) to command %s\n",
- hr->http_status,
- (int) hr->ec,
+ gtr->hr.http_status,
+ (int) gtr->hr.ec,
TALER_TESTING_interpreter_get_current_label (gts->is));
TALER_TESTING_interpreter_fail (gts->is);
return;
}
- switch (hr->http_status)
+ switch (gtr->hr.http_status)
{
case MHD_HTTP_OK:
- if (transfers_length != gts->transfers_length)
+ if (gtr->details.ok.transfers_length != gts->transfers_length)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Transfers length does not match\n");
TALER_TESTING_interpreter_fail (gts->is);
return;
}
- for (unsigned int i = 0; i < transfers_length; ++i)
+ for (unsigned int i = 0; i < gtr->details.ok.transfers_length; ++i)
{
+ const struct TALER_MERCHANT_TransferData *transfer
+ = &gtr->details.ok.transfers[i];
const struct TALER_TESTING_Command *transfer_cmd;
transfer_cmd = TALER_TESTING_interpreter_lookup_command (
@@ -145,7 +143,7 @@ get_transfers_cb (
return;
}
if (0 != GNUNET_memcmp (wtid,
- &transfers[i].wtid))
+ &transfer->wtid))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transfer id does not match\n");
@@ -154,7 +152,7 @@ get_transfers_cb (
}
TALER_TESTING_cmd_merchant_post_transfer_set_serial (
(struct TALER_TESTING_Command *) transfer_cmd,
- transfers[i].credit_serial);
+ transfer->credit_serial);
}
{
const char **payto_uri;
@@ -169,12 +167,12 @@ get_transfers_cb (
return;
}
if (0 != strcmp (*payto_uri,
- transfers[i].payto_uri))
+ transfer->payto_uri))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transfer payto uri does not match: %s != %s\n",
*payto_uri,
- transfers[i].payto_uri);
+ transfer->payto_uri);
TALER_TESTING_interpreter_fail (gts->is);
return;
}
@@ -193,9 +191,9 @@ get_transfers_cb (
}
if ( (GNUNET_OK !=
TALER_amount_cmp_currency (credit_amount,
- &transfers[i].credit_amount)) ||
+ &transfer->credit_amount)) ||
(0 != TALER_amount_cmp (credit_amount,
- &transfers[i].credit_amount)))
+ &transfer->credit_amount)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transfer credit amount does not match\n");
@@ -216,7 +214,7 @@ get_transfers_cb (
return;
}
if (0 != strcmp (*exchange_url,
- transfers[i].exchange_url))
+ transfer->exchange_url))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Wire transfer exchange url does not match\n");
@@ -228,7 +226,9 @@ get_transfers_cb (
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Unhandled HTTP status.\n");
+ "Unhandled HTTP status %u.\n",
+ gtr->hr.http_status);
+ break;
}
TALER_TESTING_interpreter_next (gts->is);
}
@@ -290,11 +290,12 @@ get_transfers_cleanup (void *cls,
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_get_transfers (const char *label,
- const char *merchant_url,
- const char *payto_uri,
- unsigned int http_code,
- ...)
+TALER_TESTING_cmd_merchant_get_transfers (
+ const char *label,
+ const char *merchant_url,
+ const char *payto_uri,
+ unsigned int http_code,
+ ...)
{
struct GetTransfersState *gts;