gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: add user type to kyc-check


From: gnunet
Subject: [taler-exchange] branch master updated: add user type to kyc-check
Date: Fri, 19 Aug 2022 09:32:01 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 2c4bd1e1 add user type to kyc-check
2c4bd1e1 is described below

commit 2c4bd1e1d0094b93588a5c35205d54e9eac60f03
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Aug 19 09:31:51 2022 +0200

    add user type to kyc-check
---
 src/exchange/taler-exchange-httpd.c           |  2 +-
 src/exchange/taler-exchange-httpd_kyc-check.c | 18 +++++++++++++++++-
 src/include/taler_exchange_service.h          |  3 +++
 src/kyclogic/kyclogic_api.c                   |  2 +-
 src/lib/Makefile.am                           |  1 +
 src/lib/exchange_api_kyc_check.c              |  5 ++++-
 src/testing/testing_api_cmd_kyc_check_get.c   |  1 +
 7 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd.c 
b/src/exchange/taler-exchange-httpd.c
index c91dbfbb..496d3d29 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 61d1abf8..c4181e11 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 a3e0fffc..dac20d06 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -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);
diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c
index 30386980..22d2129c 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 6adaac38..dc08c585 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 b67a3a58..ffb7a24b 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 bf715953..a67a08c1 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);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]