summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_refund_order.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_refund_order.c')
-rw-r--r--src/testing/testing_api_cmd_refund_order.c62
1 files changed, 21 insertions, 41 deletions
diff --git a/src/testing/testing_api_cmd_refund_order.c b/src/testing/testing_api_cmd_refund_order.c
index 0f94622c..7cc71e21 100644
--- a/src/testing/testing_api_cmd_refund_order.c
+++ b/src/testing/testing_api_cmd_refund_order.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2019 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
@@ -76,39 +76,34 @@ struct RefundState
* if the HTTP response code is the one expected.
*
* @param cls closure
- * @param hr HTTP response
- * @param taler_refund_uri the refund uri offered to the wallet
- * @param h_contract hash of the contract a Browser may need to authorize
- * obtaining the HTTP response.
+ * @param rr response
*/
static void
refund_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const char *taler_refund_uri,
- const struct TALER_PrivateContractHashP *h_contract)
+ const struct TALER_MERCHANT_RefundResponse *rr)
{
struct RefundState *ris = cls;
- (void) h_contract;
ris->orh = NULL;
- if (ris->http_code != hr->http_status)
+ if (ris->http_code != rr->hr.http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Expected status %u, got %u(%d) for refund increase\n",
ris->http_code,
- hr->http_status,
- (int) hr->ec);
+ rr->hr.http_status,
+ (int) rr->hr.ec);
TALER_TESTING_FAIL (ris->is);
}
- switch (hr->http_status)
+ switch (rr->hr.http_status)
{
case MHD_HTTP_OK:
{
struct TALER_MERCHANT_RefundUriData rud;
if (GNUNET_OK !=
- TALER_MERCHANT_parse_refund_uri (taler_refund_uri,
- &rud))
+ TALER_MERCHANT_parse_refund_uri (
+ rr->details.ok.taler_refund_uri,
+ &rud))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Taler refund uri is malformed\n");
@@ -116,25 +111,9 @@ refund_cb (void *cls,
return;
}
{
- char *port;
char *host;
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (ris->is->cfg,
- "merchant",
- "PORT",
- &port))
- {
- /* How did we get here without a configured port? */
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (ris->is);
- TALER_MERCHANT_parse_refund_uri_free (&rud);
- return;
- }
- GNUNET_asprintf (&host,
- "localhost:%s",
- port);
- GNUNET_free (port);
+ host = TALER_MERCHANT_TESTING_extract_host (ris->merchant_url);
if ((0 != strcmp (host,
rud.merchant_host)) ||
(NULL != rud.merchant_prefix_path) ||
@@ -165,7 +144,7 @@ refund_cb (void *cls,
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Unhandled HTTP status %u for refund order.\n",
- hr->http_status);
+ rr->hr.http_status);
}
TALER_TESTING_interpreter_next (ris->is);
}
@@ -186,13 +165,14 @@ refund_increase_run (void *cls,
struct RefundState *ris = cls;
ris->is = is;
- ris->orh = TALER_MERCHANT_post_order_refund (is->ctx,
- ris->merchant_url,
- ris->order_id,
- &ris->refund_amount,
- ris->reason,
- &refund_cb,
- ris);
+ ris->orh = TALER_MERCHANT_post_order_refund (
+ TALER_TESTING_interpreter_get_context (is),
+ ris->merchant_url,
+ ris->order_id,
+ &ris->refund_amount,
+ ris->reason,
+ &refund_cb,
+ ris);
if (NULL == ris->orh)
TALER_TESTING_FAIL (is);
}
@@ -217,7 +197,7 @@ refund_increase_traits (void *cls,
struct RefundState *ris = cls;
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_amount (&ris->refund_amount),
- TALER_TESTING_make_trait_reason (&ris->reason),
+ TALER_TESTING_make_trait_reason (ris->reason),
TALER_TESTING_trait_end ()
};