add user type to kyc-check

This commit is contained in:
Christian Grothoff 2022-08-19 09:31:51 +02:00
parent 9c1f1c76be
commit 2c4bd1e1d0
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 28 additions and 4 deletions

View File

@ -1217,7 +1217,7 @@ handle_mhd_request (void *cls,
.url = "kyc-check",
.method = MHD_HTTP_METHOD_GET,
.handler.get = &TEH_handler_kyc_check,
.nargs = 2
.nargs = 3
},
{
.url = "kyc-proof",

View File

@ -107,6 +107,11 @@ struct KycPoller
*/
enum TALER_ErrorCode ec;
/**
* What kind of entity is doing the KYC check?
*/
enum TALER_KYCLOGIC_KycUserType ut;
/**
* True if we are still suspended.
*/
@ -401,7 +406,7 @@ db_event_cb (void *cls,
MHD_RESULT
TEH_handler_kyc_check (
struct TEH_RequestContext *rc,
const char *const args[2])
const char *const args[3])
{
struct KycPoller *kyp = rc->rh_ctx;
MHD_RESULT res;
@ -447,6 +452,17 @@ TEH_handler_kyc_check (
"h_payto");
}
if (GNUNET_OK !=
TALER_KYCLOGIC_kyc_user_type_from_string (args[2],
&kyp->ut))
{
GNUNET_break_op (0);
return TALER_MHD_reply_with_error (rc->connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
"usertype");
}
{
const char *ts;

View File

@ -25,6 +25,7 @@
#include <jansson.h>
#include "taler_util.h"
#include "taler_error_codes.h"
#include "taler_kyclogic_lib.h"
#include <gnunet/gnunet_curl_lib.h>
@ -3425,6 +3426,7 @@ typedef void
* @param eh exchange handle to use
* @param legitimization_uuid number identifying the legitimization process
* @param h_payto hash of the payto:// URI at @a payment_target
* @param ut type of the entity performing the KYC check
* @param timeout how long to wait for a positive KYC status
* @param cb function to call with the result
* @param cb_cls closure for @a cb
@ -3434,6 +3436,7 @@ struct TALER_EXCHANGE_KycCheckHandle *
TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *eh,
uint64_t legitimization_uuid,
const struct TALER_PaytoHashP *h_payto,
enum TALER_KYCLOGIC_KycUserType ut,
struct GNUNET_TIME_Relative timeout,
TALER_EXCHANGE_KycStatusCallback cb,
void *cb_cls);

View File

@ -226,7 +226,7 @@ TALER_KYCLOGIC_kyc_user_type_from_string (const char *ut_s,
struct
{
const char *in;
enum TALER_KYCLOGIC_KycTriggerEvent out;
enum TALER_KYCLOGIC_KycUserType out;
} map [] = {
{ "individual", TALER_KYCLOGIC_KYC_UT_INDIVIDUAL },
{ "business", TALER_KYCLOGIC_KYC_UT_BUSINESS },

View File

@ -70,6 +70,7 @@ libtalerexchange_la_SOURCES = \
libtalerexchange_la_LIBADD = \
libtalerauditor.la \
$(top_builddir)/src/json/libtalerjson.la \
$(top_builddir)/src/kyclogic/libtalerkyclogic.la \
$(top_builddir)/src/curl/libtalercurl.la \
$(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/extensions/libtalerextensions.la \

View File

@ -65,6 +65,7 @@ struct TALER_EXCHANGE_KycCheckHandle
* Hash of the payto:// URL that is being KYC'ed.
*/
struct TALER_PaytoHashP h_payto;
};
@ -209,6 +210,7 @@ struct TALER_EXCHANGE_KycCheckHandle *
TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange,
uint64_t legitimization_uuid,
const struct TALER_PaytoHashP *h_payto,
enum TALER_KYCLOGIC_KycUserType ut,
struct GNUNET_TIME_Relative timeout,
TALER_EXCHANGE_KycStatusCallback cb,
void *cb_cls)
@ -238,9 +240,10 @@ TALER_EXCHANGE_kyc_check (struct TALER_EXCHANGE_Handle *exchange,
timeout_ms = timeout.rel_value_us
/ GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us;
GNUNET_asprintf (&arg_str,
"/kyc-check/%llu/%s?timeout_ms=%llu",
"/kyc-check/%llu/%s/%s?timeout_ms=%llu",
(unsigned long long) legitimization_uuid,
payto_str,
TALER_KYCLOGIC_kyc_user_type2s (ut),
timeout_ms);
}
kch = GNUNET_new (struct TALER_EXCHANGE_KycCheckHandle);

View File

@ -165,6 +165,7 @@ check_kyc_run (void *cls,
kcg->kwh = TALER_EXCHANGE_kyc_check (is->exchange,
*payment_target,
&h_payto,
TALER_KYCLOGIC_KYC_UT_INDIVIDUAL,
GNUNET_TIME_UNIT_SECONDS,
&check_kyc_cb,
kcg);