summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_kyc_proof.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_kyc_proof.c')
-rw-r--r--src/testing/testing_api_cmd_kyc_proof.c58
1 files changed, 27 insertions, 31 deletions
diff --git a/src/testing/testing_api_cmd_kyc_proof.c b/src/testing/testing_api_cmd_kyc_proof.c
index ed0df5564..b079fffce 100644
--- a/src/testing/testing_api_cmd_kyc_proof.c
+++ b/src/testing/testing_api_cmd_kyc_proof.c
@@ -44,11 +44,6 @@ struct KycProofGetState
const char *code;
/**
- * State to pass.
- */
- const char *state;
-
- /**
* Logic section name to pass to `/kyc-proof/` handler.
*/
const char *logic;
@@ -88,18 +83,13 @@ proof_kyc_cb (void *cls,
{
struct KycProofGetState *kcg = cls;
struct TALER_TESTING_Interpreter *is = kcg->is;
- struct TALER_TESTING_Command *cmd = &is->commands[is->ip];
kcg->kph = NULL;
if (kcg->expected_response_code != kpr->http_status)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s in %s:%u\n",
- kpr->http_status,
- cmd->label,
- __FILE__,
- __LINE__);
- TALER_TESTING_interpreter_fail (is);
+ TALER_TESTING_unexpected_status (is,
+ kpr->http_status,
+ kcg->expected_response_code);
return;
}
switch (kpr->http_status)
@@ -138,9 +128,16 @@ proof_kyc_run (void *cls,
const struct TALER_TESTING_Command *res_cmd;
const struct TALER_PaytoHashP *h_payto;
char *uargs;
+ const char *exchange_url;
(void) cmd;
kps->is = is;
+ exchange_url = TALER_TESTING_get_exchange_url (is);
+ if (NULL == exchange_url)
+ {
+ GNUNET_break (0);
+ return;
+ }
res_cmd = TALER_TESTING_interpreter_lookup_command (
kps->is,
kps->payment_target_reference);
@@ -158,16 +155,20 @@ proof_kyc_run (void *cls,
TALER_TESTING_interpreter_fail (kps->is);
return;
}
- GNUNET_asprintf (&uargs,
- "?code=%s&state=%s",
- kps->code,
- kps->state);
- kps->kph = TALER_EXCHANGE_kyc_proof (is->exchange,
- h_payto,
- kps->logic,
- uargs,
- &proof_kyc_cb,
- kps);
+ if (NULL == kps->code)
+ uargs = NULL;
+ else
+ GNUNET_asprintf (&uargs,
+ "&code=%s",
+ kps->code);
+ kps->kph = TALER_EXCHANGE_kyc_proof (
+ TALER_TESTING_interpreter_get_context (is),
+ exchange_url,
+ h_payto,
+ kps->logic,
+ uargs,
+ &proof_kyc_cb,
+ kps);
GNUNET_free (uargs);
GNUNET_assert (NULL != kps->kph);
}
@@ -188,10 +189,8 @@ proof_kyc_cleanup (void *cls,
if (NULL != kps->kph)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Command %u (%s) did not complete\n",
- kps->is->ip,
- cmd->label);
+ TALER_TESTING_command_incomplete (kps->is,
+ cmd->label);
TALER_EXCHANGE_kyc_proof_cancel (kps->kph);
kps->kph = NULL;
}
@@ -217,8 +216,7 @@ proof_kyc_traits (void *cls,
{
struct KycProofGetState *kps = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_web_url (
- (const char **) &kps->redirect_url),
+ TALER_TESTING_make_trait_web_url (kps->redirect_url),
TALER_TESTING_trait_end ()
};
@@ -235,14 +233,12 @@ TALER_TESTING_cmd_proof_kyc_oauth2 (
const char *payment_target_reference,
const char *logic_section,
const char *code,
- const char *state,
unsigned int expected_response_code)
{
struct KycProofGetState *kps;
kps = GNUNET_new (struct KycProofGetState);
kps->code = code;
- kps->state = state;
kps->logic = logic_section;
kps->payment_target_reference = payment_target_reference;
kps->expected_response_code = expected_response_code;