-fix kyc test

This commit is contained in:
Christian Grothoff 2022-03-04 00:30:43 +01:00
parent 1643b745af
commit f9a2808ed0
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
6 changed files with 46 additions and 39 deletions

View File

@ -59,11 +59,6 @@ struct KycPoller
*/
struct GNUNET_DB_EventHandler *eh;
/**
* UUID found based on @e h_payto.
*/
uint64_t payment_target_uuid;
/**
* UUID being checked.
*/
@ -80,6 +75,11 @@ struct KycPoller
*/
struct TALER_PaytoHashP h_payto;
/**
* Payto URL as a string, as given to us by t
*/
const char *hps;
/**
* When will this request time out?
*/
@ -183,9 +183,6 @@ kyc_check (void *cls,
"inselect_wallet_status");
return qs;
}
// FIXME: avoid duplicating this...
kyp->payment_target_uuid = kyp->kyc.payment_target_uuid;
return qs;
}
@ -293,32 +290,28 @@ TEH_handler_kyc_check (
tms));
}
}
kyp->hps = MHD_lookup_connection_value (rc->connection,
MHD_GET_ARGUMENT_KIND,
"h_payto");
if (NULL == kyp->hps)
{
const char *hps;
hps = MHD_lookup_connection_value (rc->connection,
MHD_GET_ARGUMENT_KIND,
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MISSING,
"h_payto");
}
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (kyp->hps,
strlen (kyp->hps),
&kyp->h_payto,
sizeof (kyp->h_payto)))
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
"h_payto");
if (NULL == hps)
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MISSING,
"h_payto");
}
if (GNUNET_OK !=
GNUNET_STRINGS_string_to_data (hps,
strlen (hps),
&kyp->h_payto,
sizeof (kyp->h_payto)))
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
"h_payto");
}
}
}
@ -360,8 +353,13 @@ TEH_handler_kyc_check (
return res;
if (kyp->auth_payment_target_uuid !=
kyp->payment_target_uuid)
kyp->kyc.payment_target_uuid)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Account %llu provided, but payto %s is for %llu\n",
(unsigned long long) kyp->auth_payment_target_uuid,
kyp->hps,
(unsigned long long) kyp->kyc.payment_target_uuid);
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_UNAUTHORIZED,
@ -391,9 +389,9 @@ TEH_handler_kyc_check (
GNUNET_assert (TEH_KYC_OAUTH2 == TEH_kyc_config.mode);
GNUNET_asprintf (&redirect_uri,
"%s/kyc-proof/%llu",
"%s/kyc-proof/%s",
TEH_base_url,
(unsigned long long) kyp->payment_target_uuid);
kyp->hps);
redirect_uri_encoded = TALER_urlencode (redirect_uri);
GNUNET_free (redirect_uri);
GNUNET_asprintf (&url,

View File

@ -3970,7 +3970,7 @@ postgres_select_kyc_status (void *cls,
{
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&h_payto),
GNUNET_PQ_query_param_auto_from_type (h_payto),
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
@ -9668,8 +9668,10 @@ postgres_get_denomination_revocation (
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("master_sig", master_sig),
GNUNET_PQ_result_spec_uint64 ("denom_revocations_serial_id", rowid),
GNUNET_PQ_result_spec_auto_from_type ("master_sig",
master_sig),
GNUNET_PQ_result_spec_uint64 ("denom_revocations_serial_id",
rowid),
GNUNET_PQ_result_spec_end
};

View File

@ -125,7 +125,7 @@ run (void *cls,
0, /* age restriction off */
MHD_HTTP_ACCEPTED),
TALER_TESTING_cmd_proof_kyc ("proof-kyc",
"withdraw-coin-1-lacking-kyc",
"create-reserve-1",
"pass",
"state",
MHD_HTTP_SEE_OTHER),

View File

@ -427,6 +427,7 @@ admin_add_incoming_traits (void *cls,
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_bank_row (&fts->serial_id),
TALER_TESTING_make_trait_debit_payto_uri (&fts->payto_debit_account),
TALER_TESTING_make_trait_payto_uri (&fts->payto_debit_account),
/* Used as a marker, content does not matter */
TALER_TESTING_make_trait_credit_payto_uri (&void_uri),
TALER_TESTING_make_trait_exchange_bank_account_url (

View File

@ -157,6 +157,9 @@ check_kyc_run (void *cls,
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,

View File

@ -153,6 +153,9 @@ proof_kyc_run (void *cls,
TALER_TESTING_interpreter_fail (kps->is);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Triggering KYC proof for %s\n",
*payto_uri);
TALER_payto_hash (*payto_uri,
&h_payto);
kps->kph = TALER_EXCHANGE_kyc_proof (is->exchange,