diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index c91dbfbb4..496d3d29f 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -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", diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c index 61d1abf8e..c4181e11f 100644 --- a/src/exchange/taler-exchange-httpd_kyc-check.c +++ b/src/exchange/taler-exchange-httpd_kyc-check.c @@ -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; diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index a3e0fffce..dac20d064 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -25,6 +25,7 @@ #include #include "taler_util.h" #include "taler_error_codes.h" +#include "taler_kyclogic_lib.h" #include @@ -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); diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c index 303869804..22d2129c9 100644 --- a/src/kyclogic/kyclogic_api.c +++ b/src/kyclogic/kyclogic_api.c @@ -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 }, diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 6adaac387..dc08c585d 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -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 \ diff --git a/src/lib/exchange_api_kyc_check.c b/src/lib/exchange_api_kyc_check.c index b67a3a58a..ffb7a24b5 100644 --- a/src/lib/exchange_api_kyc_check.c +++ b/src/lib/exchange_api_kyc_check.c @@ -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); diff --git a/src/testing/testing_api_cmd_kyc_check_get.c b/src/testing/testing_api_cmd_kyc_check_get.c index bf7159530..a67a08c18 100644 --- a/src/testing/testing_api_cmd_kyc_check_get.c +++ b/src/testing/testing_api_cmd_kyc_check_get.c @@ -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);