gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 03/151: revise APIs


From: gnunet
Subject: [taler-exchange] 03/151: revise APIs
Date: Tue, 30 Jul 2024 23:36:13 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

commit 6bbfbe8e3fdaf1c7cf56733ab4e71ab08f9dad53
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Apr 23 15:33:20 2024 +0200

    revise APIs
---
 .../0002-legitimization_requirements.sql           |  2 +-
 src/exchangedb/0005-legitimization_measures.sql    |  2 +-
 src/exchangedb/0005-wire_targets.sql               |  4 +-
 src/exchangedb/exchange-0001.sql                   |  2 +-
 src/exchangedb/exchange_do_recoup_by_reserve.sql   |  6 +--
 src/include/taler_exchange_service.h               | 28 +++++-------
 src/include/taler_kyclogic_lib.h                   | 44 +------------------
 src/json/Makefile.am                               |  2 +-
 src/kyclogic/kyclogic_api.c                        | 50 +---------------------
 9 files changed, 23 insertions(+), 117 deletions(-)

diff --git a/src/exchangedb/0002-legitimization_requirements.sql 
b/src/exchangedb/0002-legitimization_requirements.sql
index d806eb424..a2d3eae71 100644
--- a/src/exchangedb/0002-legitimization_requirements.sql
+++ b/src/exchangedb/0002-legitimization_requirements.sql
@@ -23,7 +23,7 @@ AS $$
 BEGIN
   PERFORM create_partitioned_table(
     'CREATE TABLE %I'
-      '(legitimization_requirement_serial_id BIGINT GENERATED BY DEFAULT AS 
IDENTITY'
+      '(legitimization_requirement_serial_id INT8 GENERATED BY DEFAULT AS 
IDENTITY'
       ',h_payto BYTEA NOT NULL CHECK (LENGTH(h_payto)=32)'
       ',reserve_pub BYTEA'
       ',required_checks TEXT NOT NULL'
diff --git a/src/exchangedb/0005-legitimization_measures.sql 
b/src/exchangedb/0005-legitimization_measures.sql
index 3a94d68f5..e0d3f6ff0 100644
--- a/src/exchangedb/0005-legitimization_measures.sql
+++ b/src/exchangedb/0005-legitimization_measures.sql
@@ -23,7 +23,7 @@ AS $$
 BEGIN
   PERFORM create_partitioned_table(
     'CREATE TABLE %I'
-      '(legitimization_measure_serial_id BIGINT GENERATED BY DEFAULT AS 
IDENTITY'
+      '(legitimization_measure_serial_id INT8 GENERATED BY DEFAULT AS IDENTITY'
       ',target_token BYTEA NOT NULL CHECK (LENGTH(target_token)=32)'
       ',start_time INT8 NOT NULL'
       ',jmeasures TEXT NOT NULL'
diff --git a/src/exchangedb/0005-wire_targets.sql 
b/src/exchangedb/0005-wire_targets.sql
index 1b0f59dd1..a2130ef83 100644
--- a/src/exchangedb/0005-wire_targets.sql
+++ b/src/exchangedb/0005-wire_targets.sql
@@ -34,7 +34,7 @@ AS $$
 BEGIN
   PERFORM create_partitioned_table(
     'ALTER TABLE %I'
-    ' ADD COLUMN target_token BYTEA UNIQUE CHECK(LENGTH(target_token)=32) 
DEFAULT random_bytea(32)'
+    ' ADD COLUMN access_token BYTEA UNIQUE CHECK(LENGTH(access_token)=32) 
DEFAULT random_bytea(32)'
     ',ADD COLUMN target_pub BYTEA CHECK(LENGTH(target_pub)=32) DEFAULT NULL'
     ';'
     ,'wire_targets'
@@ -43,7 +43,7 @@ BEGIN
 
   PERFORM comment_partitioned_column(
      'high-entropy random value that is used as a bearer token used to 
authenticate access to the KYC SPA and its state (without requiring a 
signature)'
-    ,'target_token'
+    ,'access_token'
     ,'wire_targets'
     ,partition_suffix
   );
diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql
index a4b1c8b9f..ca8d7ecde 100644
--- a/src/exchangedb/exchange-0001.sql
+++ b/src/exchangedb/exchange-0001.sql
@@ -28,7 +28,7 @@ SET search_path TO exchange;
 ---------------------------------------------------------------------------
 
 CREATE TABLE exchange_tables
-  (table_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY
+  (table_serial_id INT8 GENERATED BY DEFAULT AS IDENTITY
   ,name TEXT NOT NULL
   ,version TEXT NOT NULL
   ,action TEXT NOT NULL
diff --git a/src/exchangedb/exchange_do_recoup_by_reserve.sql 
b/src/exchangedb/exchange_do_recoup_by_reserve.sql
index 80f953c4a..494bf0ff3 100644
--- a/src/exchangedb/exchange_do_recoup_by_reserve.sql
+++ b/src/exchangedb/exchange_do_recoup_by_reserve.sql
@@ -21,17 +21,17 @@ CREATE OR REPLACE FUNCTION exchange_do_recoup_by_reserve(
 RETURNS TABLE
 (
   denom_sig            BYTEA,
-  denominations_serial BIGINT,
+  denominations_serial INT8,
   coin_pub             BYTEA,
   coin_sig             BYTEA,
   coin_blind           BYTEA,
   amount               taler_amount,
-  recoup_timestamp     BIGINT
+  recoup_timestamp     INT8
 )
 LANGUAGE plpgsql
 AS $$
 DECLARE
-  res_uuid BIGINT;
+  res_uuid INT8;
   blind_ev BYTEA;
   c_pub    BYTEA;
 BEGIN
diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index 7d1943407..4a5844595 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -4239,10 +4239,8 @@ struct TALER_EXCHANGE_AccountLimit
 
   /**
    * Operation type for which the restriction applies.
-   * Should be one of "WITHDRAW", "DEPOSIT", "P2P-RECEIVE"
-   * or "WALLET-BALANCE".
    */
-  const char *operation_type;
+  enum TALER_KYCLOGIC_KycTriggerEvent operation_type;
 
   /**
    * Timeframe over which the @e threshold is computed.
@@ -4290,10 +4288,9 @@ struct TALER_EXCHANGE_AccountKycStatus
   struct TALER_EXCHANGE_AccountLimit *limits;
 
   /**
-   * URL the user should open in a browser if the KYC process is to be
-   * run. Returned if @e http_status is #MHD_HTTP_ACCEPTED.
+   * Access token the user needs to start a KYC process.
    */
-  const char *kyc_url;
+  struct TALER_AccountAccessTokenP access_token;
 
 };
 
@@ -4346,15 +4343,13 @@ typedef void
 
 
 /**
- * Run interaction with exchange to check KYC status
- * of a merchant.
+ * Run interaction with exchange to check KYC status of a merchant
+ * or wallet account.
  *
  * @param ctx CURL context
  * @param url exchange base URL
- * @param keys keys of the exchange
  * @param requirement_row number identifying the KYC requirement
- * @param h_payto hash of the payto:// URI at @a payment_target
- * @param ut type of the entity performing the KYC check
+ * @param pk private key to authorize the request with
  * @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
@@ -4364,10 +4359,8 @@ struct TALER_EXCHANGE_KycCheckHandle *
 TALER_EXCHANGE_kyc_check (
   struct GNUNET_CURL_Context *ctx,
   const char *url,
-  struct TALER_EXCHANGE_Keys *keys,
   uint64_t requirement_row,
-  const struct TALER_PaytoHashP *h_payto,
-  enum TALER_KYCLOGIC_KycUserType ut,
+  const struct GNUNET_CRYPTO_EddsaPrivateKey *pk,
   struct GNUNET_TIME_Relative timeout,
   TALER_EXCHANGE_KycStatusCallback cb,
   void *cb_cls);
@@ -5237,10 +5230,9 @@ TALER_EXCHANGE_management_update_aml_officer_cancel (
 
 
 /**
- * Summary data about an AML decision.
- * FIXME: not exactly a summary anymore...
+ * Data about an AML decision.
  */
-struct TALER_EXCHANGE_AmlDecisionSummary
+struct TALER_EXCHANGE_AmlDecision
 {
   /**
    * Account the decision was made for.
@@ -5311,7 +5303,7 @@ struct TALER_EXCHANGE_AmlDecisionsResponse
       /**
        * Array of AML decision summaries returned by the exchange.
        */
-      const struct TALER_EXCHANGE_AmlDecisionSummary *decisions;
+      const struct TALER_EXCHANGE_AmlDecision *decisions;
 
       /**
        * Length of the @e decisions array.
diff --git a/src/include/taler_kyclogic_lib.h b/src/include/taler_kyclogic_lib.h
index 4d0c18fa4..1fa2be351 100644
--- a/src/include/taler_kyclogic_lib.h
+++ b/src/include/taler_kyclogic_lib.h
@@ -26,23 +26,6 @@
 #include "taler_kyclogic_plugin.h"
 
 
-/**
- * Enumeration for our KYC user types.
- */
-enum TALER_KYCLOGIC_KycUserType
-{
-  /**
-   * KYC rule is for an individual.
-   */
-  TALER_KYCLOGIC_KYC_UT_INDIVIDUAL = 0,
-
-  /**
-   * KYC rule is for a business.
-   */
-  TALER_KYCLOGIC_KYC_UT_BUSINESS = 1
-};
-
-
 /**
  * Enumeration of possible events that may trigger
  * KYC requirements.
@@ -108,30 +91,6 @@ const char *
 TALER_KYCLOGIC_kyc_trigger2s (enum TALER_KYCLOGIC_KycTriggerEvent trigger);
 
 
-/**
- * Parse user type string into enumeration value.
- *
- * @param ut_s string to parse
- * @param[out] ut set to the value found
- * @return #GNUNET_OK on success, #GNUNET_NO if option
- *         does not exist, #GNUNET_SYSERR if option is
- *         malformed
- */
-enum GNUNET_GenericReturnValue
-TALER_KYCLOGIC_kyc_user_type_from_string (const char *ut_s,
-                                          enum TALER_KYCLOGIC_KycUserType *ut);
-
-
-/**
- * Convert KYC user type to human-readable string.
- *
- * @param ut value to convert
- * @return human-readable representation of the @a ut
- */
-const char *
-TALER_KYCLOGIC_kyc_user_type2s (enum TALER_KYCLOGIC_KycUserType ut);
-
-
 /**
  * Initialize KYC subsystem. Loads the KYC configuration.
  *
@@ -337,7 +296,8 @@ enum GNUNET_GenericReturnValue
 TALER_KYCLOGIC_requirements_to_logic (const char *requirements,
                                       enum TALER_KYCLOGIC_KycUserType ut,
                                       struct TALER_KYCLOGIC_Plugin **plugin,
-                                      struct TALER_KYCLOGIC_ProviderDetails 
**pd,
+                                      struct TALER_KYCLOGIC_ProviderDetails 
**pd
+                                      ,
                                       const char **configuration_section);
 
 
diff --git a/src/json/Makefile.am b/src/json/Makefile.am
index ce863cb7e..200afa714 100644
--- a/src/json/Makefile.am
+++ b/src/json/Makefile.am
@@ -16,7 +16,7 @@ libtalerjson_la_SOURCES = \
   json_pack.c \
   json_wire.c
 libtalerjson_la_LDFLAGS = \
-  -version-info 3:0:1 \
+  -version-info 4:0:0 \
   -no-undefined
 libtalerjson_la_LIBADD = \
   $(top_builddir)/src/util/libtalerutil.la \
diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c
index 186799dbb..ddf607309 100644
--- a/src/kyclogic/kyclogic_api.c
+++ b/src/kyclogic/kyclogic_api.c
@@ -89,10 +89,6 @@ struct TALER_KYCLOGIC_KycProvider
    */
   unsigned int num_checks;
 
-  /**
-   * Type of user this provider supports.
-   */
-  enum TALER_KYCLOGIC_KycUserType user_type;
 };
 
 
@@ -231,49 +227,6 @@ TALER_KYCLOGIC_kyc_trigger2s (enum 
TALER_KYCLOGIC_KycTriggerEvent trigger)
 }
 
 
-enum GNUNET_GenericReturnValue
-TALER_KYCLOGIC_kyc_user_type_from_string (const char *ut_s,
-                                          enum TALER_KYCLOGIC_KycUserType *ut)
-{
-  struct
-  {
-    const char *in;
-    enum TALER_KYCLOGIC_KycUserType out;
-  } map [] = {
-    { "individual", TALER_KYCLOGIC_KYC_UT_INDIVIDUAL },
-    { "business", TALER_KYCLOGIC_KYC_UT_BUSINESS  },
-    { NULL, 0 }
-  };
-
-  for (unsigned int i = 0; NULL != map[i].in; i++)
-    if (0 == strcasecmp (map[i].in,
-                         ut_s))
-    {
-      *ut = map[i].out;
-      return GNUNET_OK;
-    }
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Invalid user type `%s'\n",
-              ut_s);
-  return GNUNET_SYSERR;
-}
-
-
-const char *
-TALER_KYCLOGIC_kyc_user_type2s (enum TALER_KYCLOGIC_KycUserType ut)
-{
-  switch (ut)
-  {
-  case TALER_KYCLOGIC_KYC_UT_INDIVIDUAL:
-    return "individual";
-  case TALER_KYCLOGIC_KYC_UT_BUSINESS:
-    return "business";
-  }
-  GNUNET_break (0);
-  return NULL;
-}
-
-
 enum GNUNET_GenericReturnValue
 TALER_KYCLOGIC_check_satisfiable (
   const char *check_name)
@@ -1342,7 +1295,8 @@ enum GNUNET_GenericReturnValue
 TALER_KYCLOGIC_requirements_to_logic (const char *requirements,
                                       enum TALER_KYCLOGIC_KycUserType ut,
                                       struct TALER_KYCLOGIC_Plugin **plugin,
-                                      struct TALER_KYCLOGIC_ProviderDetails 
**pd,
+                                      struct TALER_KYCLOGIC_ProviderDetails 
**pd
+                                      ,
                                       const char **configuration_section)
 {
   struct TALER_KYCLOGIC_KycCheck *needed[num_kyc_checks];

-- 
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]