aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-09-08 23:13:54 +0200
committerChristian Grothoff <christian@grothoff.org>2024-09-08 23:13:54 +0200
commit735574522eddea9f5c94f4c4922674d8fa9ba88d (patch)
tree895489af289f806c3c8347ceb661c5e42b31d4a4 /src/testing
parent4aa9f87fe66d02c65c652e1de4c25d93e5368d56 (diff)
fix /kyc-check long-polling logic
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_exchange_api_age_restriction.c1
-rw-r--r--src/testing/test_exchange_p2p.c2
-rw-r--r--src/testing/test_kyc_api.c8
-rw-r--r--src/testing/testing_api_cmd_kyc_check_get.c37
4 files changed, 35 insertions, 13 deletions
diff --git a/src/testing/test_exchange_api_age_restriction.c b/src/testing/test_exchange_api_age_restriction.c
index 4d42ac6a2..38e536d52 100644
--- a/src/testing/test_exchange_api_age_restriction.c
+++ b/src/testing/test_exchange_api_age_restriction.c
@@ -301,6 +301,7 @@ run (void *cls,
"check-kyc-withdraw",
"withdraw-coin-1-lacking-kyc",
"setup-account-key",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_get_kyc_info (
"get-kyc-info",
diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c
index 8fae0864e..2a21bb723 100644
--- a/src/testing/test_exchange_p2p.c
+++ b/src/testing/test_exchange_p2p.c
@@ -499,6 +499,7 @@ run (void *cls,
"check-kyc-close-pending",
"reserve-101-close-kyc",
"setup-account-key",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_get_kyc_info (
"get-kyc-info",
@@ -519,6 +520,7 @@ run (void *cls,
"check-kyc-close-ok",
"reserve-101-close-kyc",
"setup-account-key",
+ TALER_EXCHANGE_KLPT_KYC_OK,
MHD_HTTP_OK),
/* Now it should pass */
TALER_TESTING_cmd_reserve_close (
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index 3af972569..617f2ed2d 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -144,6 +144,7 @@ run (void *cls,
"check-kyc-withdraw",
"withdraw-coin-1-lacking-kyc",
"setup-account-key-withdraw",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_get_kyc_info (
"get-kyc-info-withdraw",
@@ -226,6 +227,7 @@ run (void *cls,
"check-kyc-deposit",
"track-deposit-kyc-ready",
"setup-account-key-deposit",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_get_kyc_info (
"get-kyc-info-deposit",
@@ -256,6 +258,7 @@ run (void *cls,
"check-kyc-deposit-again",
"track-deposit-kyc-ready",
"setup-account-key-deposit",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_get_kyc_info (
"get-kyc-info-deposit-again",
@@ -295,6 +298,7 @@ run (void *cls,
"check-kyc-wallet",
"wallet-kyc-fail",
"wallet-kyc-fail",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_get_kyc_info (
"get-kyc-info-kyc-wallet",
@@ -315,6 +319,7 @@ run (void *cls,
"wallet-kyc-check",
"wallet-kyc-fail",
"wallet-kyc-fail",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_OK),
TALER_TESTING_cmd_reserve_get_attestable (
"wallet-get-attestable",
@@ -429,6 +434,7 @@ run (void *cls,
"check-kyc-purse-merge",
"purse-merge-into-reserve",
"p2p_create-reserve-1",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_get_kyc_info (
"get-kyc-info-purse-merge-into-reserve",
@@ -482,6 +488,7 @@ run (void *cls,
"check-kyc-purse-create",
"purse-create-with-reserve",
"purse-create-with-reserve",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_get_kyc_info (
"get-kyc-info-purse-create",
@@ -722,6 +729,7 @@ run (void *cls,
"check-kyc-form",
"wallet-trigger-kyc-for-form-aml",
"wallet-trigger-kyc-for-form-aml",
+ TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER,
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_get_kyc_info (
"get-kyc-info-form",
diff --git a/src/testing/testing_api_cmd_kyc_check_get.c b/src/testing/testing_api_cmd_kyc_check_get.c
index 7d0ce06b1..fa0556d47 100644
--- a/src/testing/testing_api_cmd_kyc_check_get.c
+++ b/src/testing/testing_api_cmd_kyc_check_get.c
@@ -34,6 +34,22 @@ struct KycCheckGetState
{
/**
+ * Set to the KYC URL *if* the exchange replied with
+ * a request for KYC (#MHD_HTTP_ACCEPTED or #MHD_HTTP_OK).
+ */
+ struct TALER_AccountAccessTokenP access_token;
+
+ /**
+ * Handle to the "track transaction" pending operation.
+ */
+ struct TALER_EXCHANGE_KycCheckHandle *kwh;
+
+ /**
+ * Interpreter state.
+ */
+ struct TALER_TESTING_Interpreter *is;
+
+ /**
* Command to get a reserve private key from.
*/
const char *payment_target_reference;
@@ -49,20 +65,10 @@ struct KycCheckGetState
unsigned int expected_response_code;
/**
- * Set to the KYC URL *if* the exchange replied with
- * a request for KYC (#MHD_HTTP_ACCEPTED or #MHD_HTTP_OK).
- */
- struct TALER_AccountAccessTokenP access_token;
-
- /**
- * Handle to the "track transaction" pending operation.
+ * What are we waiting for when long-polling?
*/
- struct TALER_EXCHANGE_KycCheckHandle *kwh;
+ enum TALER_EXCHANGE_KycLongPollTarget lpt;
- /**
- * Interpreter state.
- */
- struct TALER_TESTING_Interpreter *is;
};
@@ -171,7 +177,10 @@ check_kyc_run (void *cls,
TALER_TESTING_get_exchange_url (is),
h_payto,
account_priv,
- GNUNET_TIME_UNIT_ZERO,
+ kcg->lpt,
+ TALER_EXCHANGE_KLPT_NONE == kcg->lpt
+ ? GNUNET_TIME_UNIT_ZERO
+ : GNUNET_TIME_UNIT_MINUTES,
&check_kyc_cb,
kcg);
GNUNET_assert (NULL != kcg->kwh);
@@ -235,6 +244,7 @@ TALER_TESTING_cmd_check_kyc_get (
const char *label,
const char *payment_target_reference,
const char *account_reference,
+ enum TALER_EXCHANGE_KycLongPollTarget lpt,
unsigned int expected_response_code)
{
struct KycCheckGetState *kcg;
@@ -243,6 +253,7 @@ TALER_TESTING_cmd_check_kyc_get (
kcg->payment_target_reference = payment_target_reference;
kcg->account_reference = account_reference;
kcg->expected_response_code = expected_response_code;
+ kcg->lpt = lpt;
{
struct TALER_TESTING_Command cmd = {
.cls = kcg,