-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;
wh->task = NULL;
wh->cb (wh->cb_cls,
wh->process_row,
(0 == wh->process_row)
@ -1248,9 +1249,10 @@ kycaid_webhook (void *cls,
const char *type;
const char *verification_id;
const char *applicant_id;
const char *status;
bool verified;
json_t *verifications;
const char *status = NULL;
bool verified = false;
bool no_verified = true;
json_t *verifications = NULL;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("request_id",
&request_id),
@ -1260,12 +1262,18 @@ kycaid_webhook (void *cls,
&verification_id),
GNUNET_JSON_spec_string ("applicant_id",
&applicant_id),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("status",
&status),
NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("verified",
&verified),
&no_verified),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("verifications",
&verifications),
NULL),
GNUNET_JSON_spec_end ()
};
enum GNUNET_DB_QueryStatus qs;
@ -1340,7 +1348,10 @@ kycaid_webhook (void *cls,
}
wh->verification_id = GNUNET_strdup (verification_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
asking the API again. */

View File

@ -459,21 +459,26 @@ webhook_finished_cb (
(void) expiration;
(void) provider_section;
kwh->wh = NULL;
if (0 != GNUNET_memcmp (account_id,
&cmd_line_h_payto))
if ( (NULL != account_id) &&
(0 != GNUNET_memcmp (account_id,
&cmd_line_h_payto)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Received webhook for unexpected account\n");
}
if (0 != strcmp (provider_user_id,
cmd_provider_user_id))
if ( (NULL != provider_user_id) &&
(NULL != cmd_provider_user_id) &&
(0 != strcmp (provider_user_id,
cmd_provider_user_id)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Received webhook for unexpected provider user ID (%s)\n",
provider_user_id);
}
if (0 != strcmp (provider_legitimization_id,
cmd_provider_legitimization_id))
if ( (NULL != provider_legitimization_id) &&
(NULL != cmd_provider_legitimization_id) &&
(0 != strcmp (provider_legitimization_id,
cmd_provider_legitimization_id)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"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,
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",
redirect_url,
provider_user_id,
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 (cmd_provider_user_id);