-misc fixes

This commit is contained in:
Christian Grothoff 2023-01-28 17:08:51 +01:00
parent 2aff69e7ec
commit 92f16aad51
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 49 additions and 23 deletions

View File

@ -1193,6 +1193,7 @@ async_webhook_reply (void *cls)
{ {
struct TALER_KYCLOGIC_WebhookHandle *wh = cls; struct TALER_KYCLOGIC_WebhookHandle *wh = cls;
wh->task = NULL;
wh->cb (wh->cb_cls, wh->cb (wh->cb_cls,
wh->process_row, wh->process_row,
(0 == wh->process_row) (0 == wh->process_row)
@ -1248,9 +1249,10 @@ kycaid_webhook (void *cls,
const char *type; const char *type;
const char *verification_id; const char *verification_id;
const char *applicant_id; const char *applicant_id;
const char *status; const char *status = NULL;
bool verified; bool verified = false;
json_t *verifications; bool no_verified = true;
json_t *verifications = NULL;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("request_id", GNUNET_JSON_spec_string ("request_id",
&request_id), &request_id),
@ -1260,12 +1262,18 @@ kycaid_webhook (void *cls,
&verification_id), &verification_id),
GNUNET_JSON_spec_string ("applicant_id", GNUNET_JSON_spec_string ("applicant_id",
&applicant_id), &applicant_id),
GNUNET_JSON_spec_string ("status", GNUNET_JSON_spec_mark_optional (
&status), GNUNET_JSON_spec_string ("status",
GNUNET_JSON_spec_bool ("verified", &status),
&verified), NULL),
GNUNET_JSON_spec_json ("verifications", GNUNET_JSON_spec_mark_optional (
&verifications), GNUNET_JSON_spec_bool ("verified",
&verified),
&no_verified),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("verifications",
&verifications),
NULL),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
enum GNUNET_DB_QueryStatus qs; enum GNUNET_DB_QueryStatus qs;
@ -1340,7 +1348,10 @@ kycaid_webhook (void *cls,
} }
wh->verification_id = GNUNET_strdup (verification_id); wh->verification_id = GNUNET_strdup (verification_id);
wh->applicant_id = GNUNET_strdup (applicant_id); wh->applicant_id = GNUNET_strdup (applicant_id);
if (! verified) if ( (0 != strcasecmp (type,
"VERIFICATION_COMPLETED")) ||
(no_verified) ||
(! verified) )
{ {
/* We don't need to re-confirm the failure by /* We don't need to re-confirm the failure by
asking the API again. */ asking the API again. */

View File

@ -459,21 +459,26 @@ webhook_finished_cb (
(void) expiration; (void) expiration;
(void) provider_section; (void) provider_section;
kwh->wh = NULL; kwh->wh = NULL;
if (0 != GNUNET_memcmp (account_id, if ( (NULL != account_id) &&
&cmd_line_h_payto)) (0 != GNUNET_memcmp (account_id,
&cmd_line_h_payto)) )
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Received webhook for unexpected account\n"); "Received webhook for unexpected account\n");
} }
if (0 != strcmp (provider_user_id, if ( (NULL != provider_user_id) &&
cmd_provider_user_id)) (NULL != cmd_provider_user_id) &&
(0 != strcmp (provider_user_id,
cmd_provider_user_id)) )
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Received webhook for unexpected provider user ID (%s)\n", "Received webhook for unexpected provider user ID (%s)\n",
provider_user_id); provider_user_id);
} }
if (0 != strcmp (provider_legitimization_id, if ( (NULL != provider_legitimization_id) &&
cmd_provider_legitimization_id)) (NULL != cmd_provider_legitimization_id) &&
(0 != strcmp (provider_legitimization_id,
cmd_provider_legitimization_id)) )
{ {
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Received webhook for unexpected provider legitimization ID (%s)\n", "Received webhook for unexpected provider legitimization ID (%s)\n",
@ -1379,13 +1384,23 @@ initiate_cb (
s = GNUNET_STRINGS_data_to_string_alloc (&cmd_line_h_payto, s = GNUNET_STRINGS_data_to_string_alloc (&cmd_line_h_payto,
sizeof (cmd_line_h_payto)); sizeof (cmd_line_h_payto));
if (NULL != provider_user_id)
fprintf (stdout, {
"Visit `%s' to begin KYC process.\nAlso use: taler-exchange-kyc-tester -w -u '%s' -U '%s' -p %s\n", fprintf (stdout,
redirect_url, "Visit `%s' to begin KYC process.\nAlso use: taler-exchange-kyc-tester -w -u '%s' -U '%s' -p %s\n",
provider_user_id, redirect_url,
provider_legitimization_id, provider_user_id,
s); provider_legitimization_id,
s);
}
else
{
fprintf (stdout,
"Visit `%s' to begin KYC process.\nAlso use: taler-exchange-kyc-tester -w -U '%s' -p %s\n",
redirect_url,
provider_legitimization_id,
s);
}
GNUNET_free (s); GNUNET_free (s);
} }
GNUNET_free (cmd_provider_user_id); GNUNET_free (cmd_provider_user_id);