aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-07-31 23:54:44 +0200
committerChristian Grothoff <christian@grothoff.org>2024-07-31 23:54:44 +0200
commitda23d8c94bfe894b9ad3575ec0254a44a03ae9e7 (patch)
tree60ab3542a63a0610537e162d0af8dc20c69b5e13
parentc10874a858745b4205feabb38ed8f5e8bd11acc1 (diff)
get basic merchant kyc test to pass again
-rw-r--r--src/testing/test_kyc_api.c19
-rw-r--r--src/testing/testing_api_cmd_kyc_get.c70
2 files changed, 23 insertions, 66 deletions
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index a7d9c7f9..759296fc 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -269,14 +269,19 @@ run (void *cls,
EXCHANGE_URL,
MHD_HTTP_ACCEPTED,
true),
- // FIXME: need new endpoint here to tell the
- // merchant backend to actually start the KYC
- // process (using merchant_priv!)
-#if FUTURE_WORK
+ TALER_TESTING_cmd_get_kyc_info (
+ "get-kyc-info-deposit",
+ "kyc-pending",
+ MHD_HTTP_OK),
+ TALER_TESTING_cmd_post_kyc_start (
+ "start-kyc-process-withdraw",
+ "get-kyc-info-deposit",
+ 0,
+ MHD_HTTP_OK),
TALER_TESTING_cmd_proof_kyc_oauth2 (
"kyc-do",
"kyc-pending",
- "kyc-provider-test-oauth2",
+ "test-oauth2",
"pass",
MHD_HTTP_SEE_OTHER),
CMD_EXEC_AGGREGATOR ("run-aggregator"),
@@ -307,7 +312,6 @@ run (void *cls,
NULL),
TALER_TESTING_cmd_check_bank_empty (
"check_bank_empty-3"),
-#endif
TALER_TESTING_cmd_end ()
};
struct TALER_TESTING_Command aml[] = {
@@ -478,8 +482,9 @@ run (void *cls,
NULL,
true,
true),
- TALER_TESTING_cmd_oauth (
+ TALER_TESTING_cmd_oauth_with_birthdate (
"start-oauth-service",
+ "2005-00-00",
6666),
TALER_TESTING_cmd_merchant_post_instances (
"instance-create-default-setup",
diff --git a/src/testing/testing_api_cmd_kyc_get.c b/src/testing/testing_api_cmd_kyc_get.c
index 58be93e9..bca4fbd8 100644
--- a/src/testing/testing_api_cmd_kyc_get.c
+++ b/src/testing/testing_api_cmd_kyc_get.c
@@ -146,68 +146,18 @@ kyc_get_cb (void *cls,
}
for (unsigned int i = 0; i<kr->details.kyc_status.pending_kycs_length; i++)
{
- const char *url;
- const char *tok;
- const char *end;
- char *dec;
- const char *eq;
- const char *nq;
- size_t toklen;
-
- url = kr->details.kyc_status.pending_kycs[i].kyc_url;
- if (NULL == url)
- {
- continue;
- }
- tok = strstr (url, "&redirect_uri=");
- if (NULL == tok)
- TALER_TESTING_FAIL (cs->is);
- tok += strlen ("&redirect_uri=");
- end = strchr (tok, '&');
- if (NULL == end)
- toklen = strlen (tok);
- else
- toklen = end - tok;
- (void) GNUNET_STRINGS_urldecode (tok,
- toklen,
- &dec);
- eq = strstr (dec, "/kyc-proof/");
- if (NULL == eq)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Received unexpected KYC URL `%s' (%s)\n",
- url,
- dec);
- GNUNET_free (dec);
- TALER_TESTING_FAIL (cs->is);
- }
- GNUNET_free (dec);
+ const char *payto_uri;
- eq = strstr (url, "&state=");
- if (NULL == eq)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Received unexpected 'state'-less KYC URL `%s' (%s)\n",
- url,
- dec);
- TALER_TESTING_FAIL (cs->is);
- }
- eq += strlen ("&state=");
- nq = strchr (eq, '&');
- if (NULL == nq)
- nq = eq + strlen (eq);
- if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (eq,
- nq - eq,
- &cs->h_payto,
- sizeof (cs->h_payto)))
+ payto_uri = kr->details.kyc_status.pending_kycs[i].payto_uri;
+ if (NULL == payto_uri)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Received unexpected KYC URL `%s' (%s) - no h_payto in state\n",
- url,
- eq);
- TALER_TESTING_FAIL (cs->is);
+ continue;
}
+ TALER_payto_hash (payto_uri,
+ &cs->h_payto);
+ cs->access_token
+ = kr->details.kyc_status.pending_kycs[i].access_token;
+ break;
}
break;
}
@@ -296,6 +246,8 @@ kyc_get_traits (void *cls,
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_h_payto (
&cs->h_payto),
+ TALER_TESTING_make_trait_account_access_token (
+ &cs->access_token),
TALER_TESTING_trait_end ()
};