gnunet-svn
[Top][All Lists]
Advanced

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

[exchange] branch master updated: implement protocol v28: expose default


From: Admin
Subject: [exchange] branch master updated: implement protocol v28: expose default rules to AML officer; fixes #9890
Date: Tue, 03 Jun 2025 20:46: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 ae9b97a43 implement protocol v28: expose default rules to AML officer; 
fixes #9890
ae9b97a43 is described below

commit ae9b97a4392cda62ebdb86b87c388d2b4dcdf54f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Jun 3 20:45:51 2025 +0200

    implement protocol v28: expose default rules to AML officer; fixes #9890
---
 .../taler-exchange-httpd_aml-measures-get.c        |  6 ++-
 src/exchange/taler-exchange-httpd_config.h         |  2 +-
 src/include/taler_kyclogic_lib.h                   |  4 +-
 src/kyclogic/Makefile.am                           |  2 +-
 src/kyclogic/kyclogic_api.c                        | 56 +++++++++++++++++++++-
 5 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_aml-measures-get.c 
b/src/exchange/taler-exchange-httpd_aml-measures-get.c
index 6332b4021..9b22e6099 100644
--- a/src/exchange/taler-exchange-httpd_aml-measures-get.c
+++ b/src/exchange/taler-exchange-httpd_aml-measures-get.c
@@ -40,12 +40,14 @@ TEH_handler_aml_measures_get (
   static json_t *roots;
   static json_t *programs;
   static json_t *checks;
+  static json_t *default_rules;
 
   if (NULL == roots)
   {
     TALER_KYCLOGIC_get_measure_configuration (&roots,
                                               &programs,
-                                              &checks);
+                                              &checks,
+                                              &default_rules);
   }
   if (NULL != args[0])
   {
@@ -59,6 +61,8 @@ TEH_handler_aml_measures_get (
   return TALER_MHD_REPLY_JSON_PACK (
     rc->connection,
     MHD_HTTP_OK,
+    GNUNET_JSON_pack_array_incref ("default_rules",
+                                   default_rules),
     GNUNET_JSON_pack_object_incref ("roots",
                                     roots),
     GNUNET_JSON_pack_object_incref ("programs",
diff --git a/src/exchange/taler-exchange-httpd_config.h 
b/src/exchange/taler-exchange-httpd_config.h
index e6aeb27fd..3260aeea7 100644
--- a/src/exchange/taler-exchange-httpd_config.h
+++ b/src/exchange/taler-exchange-httpd_config.h
@@ -41,7 +41,7 @@
  *
  * Returned via both /config and /keys endpoints.
  */
-#define EXCHANGE_PROTOCOL_VERSION "27:0:5"
+#define EXCHANGE_PROTOCOL_VERSION "28:0:6"
 
 
 /**
diff --git a/src/include/taler_kyclogic_lib.h b/src/include/taler_kyclogic_lib.h
index c7ea20784..7264e0bd9 100644
--- a/src/include/taler_kyclogic_lib.h
+++ b/src/include/taler_kyclogic_lib.h
@@ -721,12 +721,14 @@ TALER_KYCLOGIC_kyc_get_details (
  * @param[out] proots set to the root measures
  * @param[out] pprograms set to available AML programs
  * @param[out] pchecks set to available KYC checks
+ * @param[out] pdefault_rules set to array of default KycRules
  */
 void
 TALER_KYCLOGIC_get_measure_configuration (
   json_t **proots,
   json_t **pprograms,
-  json_t **pchecks);
+  json_t **pchecks,
+  json_t **pdefault_rules);
 
 
 /**
diff --git a/src/kyclogic/Makefile.am b/src/kyclogic/Makefile.am
index 738c67512..73b14c10b 100644
--- a/src/kyclogic/Makefile.am
+++ b/src/kyclogic/Makefile.am
@@ -63,7 +63,7 @@ libtalerkyclogic_la_LIBADD = \
   -ljansson \
   $(XLIB)
 libtalerkyclogic_la_LDFLAGS = \
-  -version-info 1:1:0 \
+  -version-info 2:0:0 \
   -no-undefined
 
 
diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c
index c6a68b262..52ec84524 100644
--- a/src/kyclogic/kyclogic_api.c
+++ b/src/kyclogic/kyclogic_api.c
@@ -3797,13 +3797,16 @@ void
 TALER_KYCLOGIC_get_measure_configuration (
   json_t **proots,
   json_t **pprograms,
-  json_t **pchecks)
+  json_t **pchecks,
+  json_t **pdefault_rules)
 {
   json_t *roots;
   json_t *programs;
   json_t *checks;
+  json_t *drules;
 
   roots = json_object ();
+  GNUNET_assert (NULL != roots);
   for (unsigned int i = 0; i<default_rules.num_custom_measures; i++)
   {
     const struct TALER_KYCLOGIC_Measure *m
@@ -3825,6 +3828,7 @@ TALER_KYCLOGIC_get_measure_configuration (
   }
 
   programs = json_object ();
+  GNUNET_assert (NULL != programs);
   for (unsigned int i = 0; i<num_aml_programs; i++)
   {
     const struct TALER_KYCLOGIC_AmlProgram *ap
@@ -3868,6 +3872,7 @@ TALER_KYCLOGIC_get_measure_configuration (
   }
 
   checks = json_object ();
+  GNUNET_assert (NULL != checks);
   for (unsigned int i = 0; i<num_kyc_checks; i++)
   {
     const struct TALER_KYCLOGIC_KycCheck *ck
@@ -3914,10 +3919,59 @@ TALER_KYCLOGIC_get_measure_configuration (
                                         ck->check_name,
                                         jc));
   }
+  drules = json_array ();
+  GNUNET_assert (NULL != drules);
+  {
+    const struct TALER_KYCLOGIC_KycRule *rules
+      = default_rules.kyc_rules;
+    unsigned int num_rules
+      = default_rules.num_kyc_rules;
+
+    for (unsigned int i = 0; i<num_rules; i++)
+    {
+      const struct TALER_KYCLOGIC_KycRule *rule = &rules[i];
+      json_t *measures;
+      json_t *limit;
+
+      measures = json_array ();
+      GNUNET_assert (NULL != measures);
+      for (unsigned int j = 0; j<rule->num_measures; j++)
+        GNUNET_assert (
+          0 ==
+          json_array_append_new (measures,
+                                 json_string (
+                                   rule->next_measures[j])));
+      limit = GNUNET_JSON_PACK (
+        GNUNET_JSON_pack_allow_null (
+          GNUNET_JSON_pack_string ("rule_name",
+                                   rule->rule_name)),
+        TALER_JSON_pack_kycte ("operation_type",
+                               rule->trigger),
+        TALER_JSON_pack_amount ("threshold",
+                                &rule->threshold),
+        GNUNET_JSON_pack_time_rel ("timeframe",
+                                   rule->timeframe),
+        GNUNET_JSON_pack_array_steal ("measures",
+                                      measures),
+        GNUNET_JSON_pack_uint64 ("display_priority",
+                                 rule->display_priority),
+        GNUNET_JSON_pack_bool ("soft_limit",
+                               ! rule->verboten),
+        GNUNET_JSON_pack_bool ("exposed",
+                               rule->exposed),
+        GNUNET_JSON_pack_bool ("is_and_combinator",
+                               rule->is_and_combinator)
+        );
+      GNUNET_assert (0 ==
+                     json_array_append_new (drules,
+                                            limit));
+    }
+  }
 
   *proots = roots;
   *pprograms = programs;
   *pchecks = checks;
+  *pdefault_rules = drules;
 }
 
 

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