diff options
| author | Christian Grothoff <christian@grothoff.org> | 2023-01-27 16:09:25 +0100 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2023-01-27 16:09:25 +0100 | 
| commit | 59716ffdc48ad71a0f047f7e68f04b64d449d408 (patch) | |
| tree | 8f913d7c24140df6ea6c2b46e389ffdf4363f618 /src/kyclogic | |
| parent | d79c23aaabb5dc1c9073555d574bea01b75668cd (diff) | |
add logic to store attributes
Diffstat (limited to 'src/kyclogic')
| -rw-r--r-- | src/kyclogic/plugin_kyclogic_kycaid.c | 17 | ||||
| -rw-r--r-- | src/kyclogic/plugin_kyclogic_oauth2.c | 1 | ||||
| -rw-r--r-- | src/kyclogic/plugin_kyclogic_persona.c | 7 | ||||
| -rw-r--r-- | src/kyclogic/taler-exchange-kyc-tester.c | 3 | 
4 files changed, 28 insertions, 0 deletions
| diff --git a/src/kyclogic/plugin_kyclogic_kycaid.c b/src/kyclogic/plugin_kyclogic_kycaid.c index 6926135c..e3479554 100644 --- a/src/kyclogic/plugin_kyclogic_kycaid.c +++ b/src/kyclogic/plugin_kyclogic_kycaid.c @@ -811,6 +811,7 @@ handle_webhook_finished (void *cls,                  wh->verification_id,                  TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,                  GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +                NULL,                  MHD_HTTP_BAD_GATEWAY,                  resp);          break; @@ -824,6 +825,11 @@ handle_webhook_finished (void *cls,                                                MHD_RESPMEM_PERSISTENT);        if (verified)        { +        json_t *attr; + +        attr = json_object (); +        // FIXME: initialize attributes! +        GNUNET_assert (NULL != attr);          expiration = GNUNET_TIME_relative_to_absolute (wh->pd->validity);          wh->cb (wh->cb_cls,                  wh->process_row, @@ -833,8 +839,10 @@ handle_webhook_finished (void *cls,                  wh->verification_id,                  TALER_KYCLOGIC_STATUS_SUCCESS,                  expiration, +                attr,                  MHD_HTTP_NO_CONTENT,                  resp); +        json_decref (attr);        }        else        { @@ -846,6 +854,7 @@ handle_webhook_finished (void *cls,                  wh->verification_id,                  TALER_KYCLOGIC_STATUS_USER_ABORTED,                  GNUNET_TIME_UNIT_ZERO_ABS, +                NULL,                  MHD_HTTP_NO_CONTENT,                  resp);        } @@ -872,6 +881,7 @@ handle_webhook_finished (void *cls,              wh->verification_id,              TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,              GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +            NULL,              MHD_HTTP_INTERNAL_SERVER_ERROR,              resp);      break; @@ -893,6 +903,7 @@ handle_webhook_finished (void *cls,              wh->verification_id,              TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,              GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +            NULL,              MHD_HTTP_NETWORK_AUTHENTICATION_REQUIRED,              resp);      break; @@ -910,6 +921,7 @@ handle_webhook_finished (void *cls,              wh->verification_id,              TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,              GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +            NULL,              MHD_HTTP_GATEWAY_TIMEOUT,              resp);      break; @@ -933,6 +945,7 @@ handle_webhook_finished (void *cls,              wh->verification_id,              TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,              GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +            NULL,              MHD_HTTP_BAD_GATEWAY,              resp);      break; @@ -950,6 +963,7 @@ handle_webhook_finished (void *cls,              wh->verification_id,              TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,              GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +            NULL,              MHD_HTTP_SERVICE_UNAVAILABLE,              resp);      break; @@ -967,6 +981,7 @@ handle_webhook_finished (void *cls,              wh->verification_id,              TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,              GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +            NULL,              MHD_HTTP_BAD_GATEWAY,              resp);      break; @@ -990,6 +1005,7 @@ handle_webhook_finished (void *cls,              wh->verification_id,              TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,              GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +            NULL,              MHD_HTTP_BAD_GATEWAY,              resp);      break; @@ -1018,6 +1034,7 @@ async_webhook_reply (void *cls)            wh->verification_id, /* provider legi ID */            TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,            GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +          NULL,            wh->response_code,            wh->resp);    kycaid_webhook_cancel (wh); diff --git a/src/kyclogic/plugin_kyclogic_oauth2.c b/src/kyclogic/plugin_kyclogic_oauth2.c index f5a08e92..d4aaf449 100644 --- a/src/kyclogic/plugin_kyclogic_oauth2.c +++ b/src/kyclogic/plugin_kyclogic_oauth2.c @@ -1211,6 +1211,7 @@ wh_return_not_found (void *cls)            NULL,            TALER_KYCLOGIC_STATUS_KEEP,            GNUNET_TIME_UNIT_ZERO_ABS, +          NULL,            MHD_HTTP_NOT_FOUND,            response);    GNUNET_free (wh); diff --git a/src/kyclogic/plugin_kyclogic_persona.c b/src/kyclogic/plugin_kyclogic_persona.c index 9f395255..b833f795 100644 --- a/src/kyclogic/plugin_kyclogic_persona.c +++ b/src/kyclogic/plugin_kyclogic_persona.c @@ -1457,6 +1457,7 @@ webhook_generic_reply (struct TALER_KYCLOGIC_WebhookHandle *wh,  {    struct MHD_Response *resp;    struct GNUNET_TIME_Absolute expiration; +  json_t *attr;    if (TALER_KYCLOGIC_STATUS_SUCCESS == status)      expiration = GNUNET_TIME_relative_to_absolute (wh->pd->validity); @@ -1466,6 +1467,9 @@ webhook_generic_reply (struct TALER_KYCLOGIC_WebhookHandle *wh,                                            "",                                            MHD_RESPMEM_PERSISTENT);    TALER_MHD_add_global_headers (resp); +  attr = json_object (); +  // FIXME: fetch attributes! +  GNUNET_assert (NULL != attr);    wh->cb (wh->cb_cls,            wh->process_row,            &wh->h_payto, @@ -1474,8 +1478,10 @@ webhook_generic_reply (struct TALER_KYCLOGIC_WebhookHandle *wh,            inquiry_id,            status,            expiration, +          attr,            http_status,            resp); +  json_decref (attr);  } @@ -1773,6 +1779,7 @@ async_webhook_reply (void *cls)            wh->inquiry_id, /* provider legi ID */            TALER_KYCLOGIC_STATUS_PROVIDER_FAILED,            GNUNET_TIME_UNIT_ZERO_ABS, /* expiration */ +          NULL,            wh->response_code,            wh->resp);    persona_webhook_cancel (wh); diff --git a/src/kyclogic/taler-exchange-kyc-tester.c b/src/kyclogic/taler-exchange-kyc-tester.c index bb473c68..bb9c61d5 100644 --- a/src/kyclogic/taler-exchange-kyc-tester.c +++ b/src/kyclogic/taler-exchange-kyc-tester.c @@ -436,6 +436,7 @@ kyc_webhook_cleanup (void)   * @param provider_legitimization_id set to legitimization process ID at the provider, or NULL if not supported or unknown   * @param status KYC status   * @param expiration until when is the KYC check valid + * @param attributes user attributes returned by the provider   * @param http_status HTTP status code of @a response   * @param[in] response to return to the HTTP client   */ @@ -449,6 +450,7 @@ webhook_finished_cb (    const char *provider_legitimization_id,    enum TALER_KYCLOGIC_KycStatus status,    struct GNUNET_TIME_Absolute expiration, +  const json_t *attributes,    unsigned int http_status,    struct MHD_Response *response)  { @@ -457,6 +459,7 @@ webhook_finished_cb (    (void) expiration;    (void) provider_section;    kwh->wh = NULL; +  GNUNET_break (NULL != attributes);    GNUNET_break (0 == GNUNET_memcmp (account_id,                                      &cmd_line_h_payto));    GNUNET_break (0 == strcmp (provider_user_id, | 
