summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_wallet_post_orders_refund.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_wallet_post_orders_refund.c')
-rw-r--r--src/testing/testing_api_cmd_wallet_post_orders_refund.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/src/testing/testing_api_cmd_wallet_post_orders_refund.c b/src/testing/testing_api_cmd_wallet_post_orders_refund.c
index b9e7981f..617d33fb 100644
--- a/src/testing/testing_api_cmd_wallet_post_orders_refund.c
+++ b/src/testing/testing_api_cmd_wallet_post_orders_refund.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
@@ -76,44 +76,39 @@ struct WalletRefundState
* if the HTTP response code is the one expected.
*
* @param cls closure
- * @param hr HTTP response
- * @param refund_amount refund amount
- * @param merchant_pub public key of the merchant giving the refund
- * @param refunds the given refunds
- * @param refunds_length how many refunds were given
+ * @param wrr response
*/
static void
refund_cb (
void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const struct TALER_Amount *refund_amount,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- struct TALER_MERCHANT_RefundDetail refunds[],
- unsigned int refunds_length)
+ const struct TALER_MERCHANT_WalletRefundResponse *wrr)
{
struct WalletRefundState *wrs = cls;
wrs->orh = NULL;
- if (wrs->http_code != hr->http_status)
+ if (wrs->http_code != wrr->hr.http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Expected status %u, got %u(%d) for refund increase\n",
wrs->http_code,
- hr->http_status,
- (int) hr->ec);
+ wrr->hr.http_status,
+ (int) wrr->hr.ec);
TALER_TESTING_FAIL (wrs->is);
}
- switch (hr->http_status)
+ switch (wrr->hr.http_status)
{
case MHD_HTTP_OK:
{
struct TALER_Amount refunded_total;
- if (refunds_length > 0)
+ if (wrr->details.ok.refunds_length > 0)
GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (refunds[0].refund_amount.currency,
- &refunded_total));
- for (unsigned int i = 0; i < refunds_length; ++i)
+ TALER_amount_set_zero (
+ wrr->details.ok.refunds[0].refund_amount.currency,
+ &refunded_total));
+ for (unsigned int i = 0; i < wrr->details.ok.refunds_length; ++i)
{
+ const struct TALER_MERCHANT_RefundDetail *refund
+ = &wrr->details.ok.refunds[wrr->details.ok.refunds_length - 1 - i];
const struct TALER_TESTING_Command *refund_cmd;
const struct TALER_Amount *expected_amount;
@@ -133,13 +128,12 @@ refund_cb (
/* The most recent refunds are returned first */
GNUNET_assert (0 <= TALER_amount_add (&refunded_total,
&refunded_total,
- &refunds[refunds_length - 1
- - i].refund_amount));
- if ((GNUNET_OK !=
- TALER_amount_cmp_currency (expected_amount,
- &refunded_total)) ||
- (0 != TALER_amount_cmp (expected_amount,
- &refunded_total)))
+ &refund->refund_amount));
+ if ( (GNUNET_OK !=
+ TALER_amount_cmp_currency (expected_amount,
+ &refunded_total)) ||
+ (0 != TALER_amount_cmp (expected_amount,
+ &refunded_total)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Refund amounts do not match\n");
@@ -150,7 +144,6 @@ refund_cb (
}
break;
default:
-
break;
}
TALER_TESTING_interpreter_next (wrs->is);
@@ -224,7 +217,7 @@ obtain_refunds_run (void *cls,
wrs->is = is;
wrs->orh = TALER_MERCHANT_wallet_post_order_refund (
- is->ctx,
+ TALER_TESTING_interpreter_get_context (is),
wrs->merchant_url,
order_id,
h_contract_terms,