diff options
| author | Christian Grothoff <christian@grothoff.org> | 2023-01-28 17:08:51 +0100 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2023-01-28 17:08:51 +0100 | 
| commit | 92f16aad515cd15834ece7bad4d526d38dd3e4fb (patch) | |
| tree | b6e5950ea805675b55851605ee3a13135b05eddb /src/kyclogic | |
| parent | 2aff69e7ec687c60a056f7d577cf95b66030ac0f (diff) | |
-misc fixes
Diffstat (limited to 'src/kyclogic')
| -rw-r--r-- | src/kyclogic/plugin_kyclogic_kycaid.c | 31 | ||||
| -rw-r--r-- | src/kyclogic/taler-exchange-kyc-tester.c | 41 | 
2 files changed, 49 insertions, 23 deletions
| diff --git a/src/kyclogic/plugin_kyclogic_kycaid.c b/src/kyclogic/plugin_kyclogic_kycaid.c index 9d0bc526..6ea1740e 100644 --- a/src/kyclogic/plugin_kyclogic_kycaid.c +++ b/src/kyclogic/plugin_kyclogic_kycaid.c @@ -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_string ("status", -                             &status), -    GNUNET_JSON_spec_bool ("verified", -                           &verified), -    GNUNET_JSON_spec_json ("verifications", -                           &verifications), +    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. */ diff --git a/src/kyclogic/taler-exchange-kyc-tester.c b/src/kyclogic/taler-exchange-kyc-tester.c index 6ae78f5b..652d498c 100644 --- a/src/kyclogic/taler-exchange-kyc-tester.c +++ b/src/kyclogic/taler-exchange-kyc-tester.c @@ -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)); - -    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); +    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); | 
