diff options
Diffstat (limited to 'src/testing/testing_api_cmd_kyc_proof.c')
-rw-r--r-- | src/testing/testing_api_cmd_kyc_proof.c | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/src/testing/testing_api_cmd_kyc_proof.c b/src/testing/testing_api_cmd_kyc_proof.c index fdd3affdc..b079fffce 100644 --- a/src/testing/testing_api_cmd_kyc_proof.c +++ b/src/testing/testing_api_cmd_kyc_proof.c @@ -44,9 +44,9 @@ struct KycProofGetState const char *code; /** - * State to pass. + * Logic section name to pass to `/kyc-proof/` handler. */ - const char *state; + const char *logic; /** * Expected HTTP response code. @@ -83,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) @@ -131,13 +126,21 @@ proof_kyc_run (void *cls, { struct KycProofGetState *kps = cls; const struct TALER_TESTING_Command *res_cmd; - const uint64_t *payment_target; + const struct TALER_PaytoHashP *h_payto; + char *uargs; + const char *exchange_url; (void) cmd; kps->is = is; - res_cmd = TALER_TESTING_interpreter_lookup_command (kps->is, - kps-> - payment_target_reference); + 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); if (NULL == res_cmd) { GNUNET_break (0); @@ -145,19 +148,28 @@ proof_kyc_run (void *cls, return; } if (GNUNET_OK != - TALER_TESTING_get_trait_payment_target_uuid (res_cmd, - &payment_target)) + TALER_TESTING_get_trait_h_payto (res_cmd, + &h_payto)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (kps->is); return; } - kps->kph = TALER_EXCHANGE_kyc_proof (is->exchange, - *payment_target, - kps->code, - kps->state, - &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); } @@ -177,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; } @@ -206,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 () }; @@ -219,17 +228,18 @@ proof_kyc_traits (void *cls, struct TALER_TESTING_Command -TALER_TESTING_cmd_proof_kyc (const char *label, - const char *payment_target_reference, - const char *code, - const char *state, - unsigned int expected_response_code) +TALER_TESTING_cmd_proof_kyc_oauth2 ( + const char *label, + const char *payment_target_reference, + const char *logic_section, + const char *code, + 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; { |