diff options
Diffstat (limited to 'src/testing/testing_api_cmd_kyc_check_get.c')
-rw-r--r-- | src/testing/testing_api_cmd_kyc_check_get.c | 68 |
1 files changed, 28 insertions, 40 deletions
diff --git a/src/testing/testing_api_cmd_kyc_check_get.c b/src/testing/testing_api_cmd_kyc_check_get.c index 03b2321d1..25c7e98b8 100644 --- a/src/testing/testing_api_cmd_kyc_check_get.c +++ b/src/testing/testing_api_cmd_kyc_check_get.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2021 Taler Systems SA + Copyright (C) 2021-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 @@ -73,19 +73,13 @@ check_kyc_cb (void *cls, { struct KycCheckGetState *kcg = cls; struct TALER_TESTING_Interpreter *is = kcg->is; - struct TALER_TESTING_Command *cmd = &is->commands[is->ip]; kcg->kwh = NULL; if (kcg->expected_response_code != ks->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u/%d to command %s in %s:%u\n", - ks->http_status, - (int) ks->ec, - cmd->label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (is); + TALER_TESTING_unexpected_status (is, + ks->http_status, + kcg->expected_response_code); return; } switch (ks->http_status) @@ -93,7 +87,7 @@ check_kyc_cb (void *cls, case MHD_HTTP_OK: break; case MHD_HTTP_ACCEPTED: - kcg->kyc_url = GNUNET_strdup (ks->details.kyc_url); + kcg->kyc_url = GNUNET_strdup (ks->details.accepted.kyc_url); break; case MHD_HTTP_NO_CONTENT: break; @@ -119,15 +113,14 @@ check_kyc_run (void *cls, { struct KycCheckGetState *kcg = cls; const struct TALER_TESTING_Command *res_cmd; - const char **payto_uri; - const uint64_t *payment_target; - struct TALER_PaytoHashP h_payto; + const uint64_t *requirement_row; + const struct TALER_PaytoHashP *h_payto; (void) cmd; kcg->is = is; - res_cmd = TALER_TESTING_interpreter_lookup_command (kcg->is, - kcg-> - payment_target_reference); + res_cmd = TALER_TESTING_interpreter_lookup_command ( + kcg->is, + kcg->payment_target_reference); if (NULL == res_cmd) { GNUNET_break (0); @@ -135,39 +128,37 @@ check_kyc_run (void *cls, return; } if (GNUNET_OK != - TALER_TESTING_get_trait_payto_uri (res_cmd, - &payto_uri)) + TALER_TESTING_get_trait_legi_requirement_row (res_cmd, + &requirement_row)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (kcg->is); 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 (kcg->is); return; } - if ( (NULL == *payto_uri) || - (0 == *payment_target) ) + if (0 == *requirement_row) { GNUNET_break (0); TALER_TESTING_interpreter_fail (kcg->is); return; } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Running KYC check for payto URI: %s\n", - *payto_uri); - TALER_payto_hash (*payto_uri, - &h_payto); - kcg->kwh = TALER_EXCHANGE_kyc_check (is->exchange, - *payment_target, - &h_payto, - GNUNET_TIME_UNIT_SECONDS, - &check_kyc_cb, - kcg); + kcg->kwh = TALER_EXCHANGE_kyc_check ( + TALER_TESTING_interpreter_get_context (is), + TALER_TESTING_get_exchange_url (is), + TALER_TESTING_get_keys (is), + *requirement_row, + h_payto, + TALER_KYCLOGIC_KYC_UT_INDIVIDUAL, + GNUNET_TIME_UNIT_SECONDS, + &check_kyc_cb, + kcg); GNUNET_assert (NULL != kcg->kwh); } @@ -187,10 +178,8 @@ check_kyc_cleanup (void *cls, if (NULL != kcg->kwh) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Command %u (%s) did not complete\n", - kcg->is->ip, - cmd->label); + TALER_TESTING_command_incomplete (kcg->is, + cmd->label); TALER_EXCHANGE_kyc_check_cancel (kcg->kwh); kcg->kwh = NULL; } @@ -216,8 +205,7 @@ check_kyc_traits (void *cls, { struct KycCheckGetState *kcg = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_kyc_url ( - (const char **) &kcg->kyc_url), + TALER_TESTING_make_trait_kyc_url (kcg->kyc_url), TALER_TESTING_trait_end () }; |