summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_post_instances.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_post_instances.c')
-rw-r--r--src/testing/testing_api_cmd_post_instances.c147
1 files changed, 34 insertions, 113 deletions
diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c
index 4d1f0d26..0d081026 100644
--- a/src/testing/testing_api_cmd_post_instances.c
+++ b/src/testing/testing_api_cmd_post_instances.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
@@ -55,16 +55,6 @@ struct PostInstancesState
const char *instance_id;
/**
- * Length of the @payto_uris array
- */
- unsigned int payto_uris_length;
-
- /**
- * Array of payto URIs.
- */
- const char **payto_uris;
-
- /**
* Name of the instance.
*/
const char *name;
@@ -85,19 +75,9 @@ struct PostInstancesState
const char *auth_token;
/**
- * Wire fee to use.
- */
- struct TALER_Amount default_max_wire_fee;
-
- /**
- * Amortization to use.
+ * Use STEFAN curves?
*/
- uint32_t default_wire_fee_amortization;
-
- /**
- * Deposit fee ceiling to use.
- */
- struct TALER_Amount default_max_deposit_fee;
+ bool use_stefan;
/**
* Wire transfer delay to use.
@@ -132,11 +112,10 @@ post_instances_cb (void *cls,
pis->iph = NULL;
if (pis->http_status != hr->http_status)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u (%d) to command %s\n",
- hr->http_status,
- (int) hr->ec,
- TALER_TESTING_interpreter_get_current_label (pis->is));
+ TALER_TESTING_unexpected_status_with_body (pis->is,
+ hr->http_status,
+ pis->http_status,
+ hr->reply);
TALER_TESTING_interpreter_fail (pis->is);
return;
}
@@ -180,22 +159,20 @@ post_instances_run (void *cls,
struct PostInstancesState *pis = cls;
pis->is = is;
- pis->iph = TALER_MERCHANT_instances_post (is->ctx,
- pis->merchant_url,
- pis->instance_id,
- pis->payto_uris_length,
- pis->payto_uris,
- pis->name,
- pis->address,
- pis->jurisdiction,
- &pis->default_max_wire_fee,
- pis->default_wire_fee_amortization,
- &pis->default_max_deposit_fee,
- pis->default_wire_transfer_delay,
- pis->default_pay_delay,
- pis->auth_token,
- &post_instances_cb,
- pis);
+ pis->iph = TALER_MERCHANT_instances_post (
+ TALER_TESTING_interpreter_get_context (is),
+ pis->merchant_url,
+ pis->instance_id,
+ pis->name,
+ TALER_KYCLOGIC_KYC_UT_BUSINESS,
+ pis->address,
+ pis->jurisdiction,
+ pis->use_stefan,
+ pis->default_wire_transfer_delay,
+ pis->default_pay_delay,
+ pis->auth_token,
+ &post_instances_cb,
+ pis);
if (NULL == pis->iph)
{
GNUNET_break (0);
@@ -222,37 +199,16 @@ post_instances_traits (void *cls,
unsigned int index)
{
struct PostInstancesState *pis = cls;
- #define NUM_TRAITS (pis->payto_uris_length) + 11
- struct TALER_TESTING_Trait traits[NUM_TRAITS];
- traits[0] =
- TALER_TESTING_make_trait_instance_name (&pis->name);
- traits[1] =
- TALER_TESTING_make_trait_instance_id (&pis->instance_id);
- traits[2] =
- TALER_TESTING_make_trait_address (pis->address);
- traits[3] =
- TALER_TESTING_make_trait_jurisdiction (pis->jurisdiction);
- traits[4] =
- TALER_TESTING_make_trait_max_wire_fee (&pis->default_max_wire_fee);
- traits[5] =
- TALER_TESTING_make_trait_wire_fee_amortization (
- &pis->default_wire_fee_amortization);
- traits[6] =
- TALER_TESTING_make_trait_max_deposit_fee (&pis->default_max_deposit_fee);
- traits[7] =
- TALER_TESTING_make_trait_wire_delay (&pis->default_wire_transfer_delay);
- traits[8] =
- TALER_TESTING_make_trait_pay_delay (&pis->default_pay_delay);
- traits[9] =
- TALER_TESTING_make_trait_payto_length (&pis->payto_uris_length);
- traits[NUM_TRAITS - 1] =
- TALER_TESTING_trait_end ();
- for (unsigned int i = 0; i < pis->payto_uris_length; ++i)
- {
- traits[10 + i] =
- TALER_TESTING_make_trait_payto_uris (i,
- &pis->payto_uris[i]);
- }
+ struct TALER_TESTING_Trait traits[] = {
+ TALER_TESTING_make_trait_instance_name (pis->name),
+ TALER_TESTING_make_trait_instance_id (pis->instance_id),
+ TALER_TESTING_make_trait_address (pis->address),
+ TALER_TESTING_make_trait_jurisdiction (pis->jurisdiction),
+ TALER_TESTING_make_trait_use_stefan (&pis->use_stefan),
+ TALER_TESTING_make_trait_wire_delay (&pis->default_wire_transfer_delay),
+ TALER_TESTING_make_trait_pay_delay (&pis->default_pay_delay),
+ TALER_TESTING_trait_end ()
+ };
return TALER_TESTING_get_trait (traits,
ret,
@@ -282,7 +238,6 @@ post_instances_cleanup (void *cls,
}
json_decref (pis->address);
json_decref (pis->jurisdiction);
- GNUNET_free (pis->payto_uris);
GNUNET_free (pis);
}
@@ -292,14 +247,10 @@ TALER_TESTING_cmd_merchant_post_instances2 (
const char *label,
const char *merchant_url,
const char *instance_id,
- unsigned int payto_uris_length,
- const char *payto_uris[],
const char *name,
json_t *address,
json_t *jurisdiction,
- const char *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const char *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
const char *auth_token,
@@ -311,22 +262,10 @@ TALER_TESTING_cmd_merchant_post_instances2 (
pis->merchant_url = merchant_url;
pis->instance_id = instance_id;
pis->http_status = http_status;
- pis->payto_uris_length = payto_uris_length;
- pis->payto_uris = GNUNET_new_array (payto_uris_length,
- const char *);
- memcpy (pis->payto_uris,
- payto_uris,
- sizeof (const char *) * payto_uris_length);
pis->name = name;
pis->address = address; /* ownership transfer! */
pis->jurisdiction = jurisdiction; /* ownership transfer! */
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (default_max_wire_fee,
- &pis->default_max_wire_fee));
- pis->default_wire_fee_amortization = default_wire_fee_amortization;
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (default_max_deposit_fee,
- &pis->default_max_deposit_fee));
+ pis->use_stefan = use_stefan;
pis->default_wire_transfer_delay = default_wire_transfer_delay;
pis->default_pay_delay = default_pay_delay;
pis->auth_token = auth_token;
@@ -348,34 +287,16 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_instances (const char *label,
const char *merchant_url,
const char *instance_id,
- const char *payto_uri,
- const char *currency,
unsigned int http_status)
{
- const char *payto_uris[] = {
- payto_uri
- };
- struct TALER_Amount default_max_fee;
- const char *default_max_fee_s;
-
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (currency,
- &default_max_fee));
- default_max_fee.value = 1;
- default_max_fee_s = TALER_amount2s (&default_max_fee);
-
return TALER_TESTING_cmd_merchant_post_instances2 (
label,
merchant_url,
instance_id,
- 1,
- payto_uris,
instance_id,
json_pack ("{s:s}", "city", "shopcity"),
json_pack ("{s:s}", "city", "lawyercity"),
- default_max_fee_s,
- 10,
- default_max_fee_s,
+ true,
GNUNET_TIME_UNIT_ZERO, /* no wire transfer delay */
GNUNET_TIME_UNIT_MINUTES,
NULL,