aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_post_using_templates.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_post_using_templates.c')
-rw-r--r--src/testing/testing_api_cmd_post_using_templates.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/testing/testing_api_cmd_post_using_templates.c b/src/testing/testing_api_cmd_post_using_templates.c
index da45135b..7aeec33d 100644
--- a/src/testing/testing_api_cmd_post_using_templates.c
+++ b/src/testing/testing_api_cmd_post_using_templates.c
@@ -133,14 +133,19 @@ struct PostUsingTemplatesState
const char *duplicate_of;
/**
+ * Label of command creating/updating OTP device, or NULL.
+ */
+ const char *otp_ref;
+
+ /**
* Encoded key for the payment verification.
*/
- const char *template_pos_key;
+ const char *otp_key;
/**
* Option that add amount of the order
*/
- const enum TALER_MerchantConfirmationAlgorithm *template_pos_alg;
+ const enum TALER_MerchantConfirmationAlgorithm *otp_alg;
/**
* Expected HTTP response code.
@@ -358,16 +363,19 @@ post_using_templates_run (void *cls,
TALER_TESTING_get_trait_template_id (ref,
&template_id))
TALER_TESTING_FAIL (is);
-
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_template_pos_key (ref,
- &tis->template_pos_key))
- TALER_TESTING_FAIL (is);
-
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_template_pos_alg (ref,
- &tis->template_pos_alg))
- TALER_TESTING_FAIL (is);
+ if (NULL != tis->otp_ref)
+ {
+ ref = TALER_TESTING_interpreter_lookup_command (is,
+ tis->otp_ref);
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_otp_key (ref,
+ &tis->otp_key))
+ TALER_TESTING_FAIL (is);
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_otp_alg (ref,
+ &tis->otp_alg))
+ TALER_TESTING_FAIL (is);
+ }
tis->iph = TALER_MERCHANT_using_templates_post (
TALER_TESTING_interpreter_get_context (is),
tis->merchant_url,
@@ -408,8 +416,8 @@ post_using_templates_traits (void *cls,
TALER_TESTING_make_trait_merchant_pub (&pts->merchant_pub),
TALER_TESTING_make_trait_claim_nonce (&pts->nonce),
TALER_TESTING_make_trait_claim_token (&pts->claim_token),
- TALER_TESTING_make_trait_template_pos_key (pts->template_pos_key),
- TALER_TESTING_make_trait_template_pos_alg (pts->template_pos_alg),
+ TALER_TESTING_make_trait_otp_key (pts->otp_key),
+ TALER_TESTING_make_trait_otp_alg (pts->otp_alg),
TALER_TESTING_trait_end (),
};
@@ -554,6 +562,7 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_post_using_templates (
const char *label,
const char *template_ref,
+ const char *otp_ref,
const char *merchant_url,
const char *using_template_id,
const char *summary,
@@ -566,6 +575,7 @@ TALER_TESTING_cmd_merchant_post_using_templates (
tis = GNUNET_new (struct PostUsingTemplatesState);
tis->template_ref = template_ref;
+ tis->otp_ref = otp_ref;
tis->merchant_url = merchant_url;
tis->using_template_id = using_template_id;
tis->http_status = http_status;