gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated (cda751ea -> 3a7045bf)


From: gnunet
Subject: [taler-exchange] branch master updated (cda751ea -> 3a7045bf)
Date: Wed, 18 Jan 2023 14:38:32 +0100

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

grothoff pushed a change to branch master
in repository exchange.

    from cda751ea eventually kick out /keys clients also if ksh exists but krd 
array is empty
     new 99920951 new AML APIs (libtalerexchange)
     new 3a7045bf -fix warning

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/exchange/taler-exchange-httpd_kyc-proof.h      |   2 +-
 src/include/taler_exchange_service.h               | 181 ++++++++++++++++++++-
 ...re_enable.c => exchange_api_add_aml_decision.c} | 118 ++++++++------
 ...ble.c => exchange_api_management_add_partner.c} |  97 ++++++-----
 ...> exchange_api_management_update_aml_officer.c} | 102 ++++++------
 5 files changed, 365 insertions(+), 135 deletions(-)
 copy src/lib/{exchange_api_management_wire_enable.c => 
exchange_api_add_aml_decision.c} (57%)
 copy src/lib/{exchange_api_management_wire_disable.c => 
exchange_api_management_add_partner.c} (61%)
 copy src/lib/{exchange_api_management_wire_enable.c => 
exchange_api_management_update_aml_officer.c} (64%)

diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.h 
b/src/exchange/taler-exchange-httpd_kyc-proof.h
index 98551557..d40ea90a 100644
--- a/src/exchange/taler-exchange-httpd_kyc-proof.h
+++ b/src/exchange/taler-exchange-httpd_kyc-proof.h
@@ -43,7 +43,7 @@ TEH_kyc_proof_cleanup (void);
 MHD_RESULT
 TEH_handler_kyc_proof (
   struct TEH_RequestContext *rc,
-  const char *const args[3]);
+  const char *const args[1]);
 
 
 #endif
diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index b2d0bf71..ff1698cc 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1,6 +1,6 @@
 /*
    This file is part of TALER
-   Copyright (C) 2014-2022 Taler Systems SA
+   Copyright (C) 2014-2023 Taler Systems SA
 
    TALER is free software; you can redistribute it and/or modify it under the
    terms of the GNU Affero General Public License as published by the Free 
Software
@@ -4240,6 +4240,185 @@ TALER_EXCHANGE_management_revoke_signing_key_cancel (
   struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *rh);
 
 
+/**
+ * Function called with information about the change to
+ * an AML officer status.
+ *
+ * @param cls closure
+ * @param hr HTTP response data
+ */
+typedef void
+(*TALER_EXCHANGE_ManagementUpdateAmlOfficerCallback) (
+  void *cls,
+  const struct TALER_EXCHANGE_HttpResponse *hr);
+
+
+/**
+ * @brief Handle for a POST /management/aml-officers/$OFFICER_PUB request.
+ */
+struct TALER_EXCHANGE_ManagementUpdateAmlOfficer;
+
+
+/**
+ * Inform the exchange that the status of an AML officer has changed.
+ *
+ * @param ctx the context
+ * @param url HTTP base URL for the exchange
+ * @param officer_pub the public signing key of the officer
+ * @param officer_name name of the officer
+ * @param change_date when to affect the status change
+ * @param is_active true to enable the officer
+ * @param read_only true to only allow read-only access
+ * @param master_sig signature affirming the change
+ * @param cb function to call with the exchange's result
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *
+TALER_EXCHANGE_management_update_aml_officer (
+  struct GNUNET_CURL_Context *ctx,
+  const char *url,
+  const struct TALER_AmlOfficerPublicKeyP *officer_pub,
+  const char *officer_name,
+  struct GNUNET_TIME_Timestamp change_date,
+  bool is_active,
+  bool read_only,
+  const struct TALER_MasterSignatureP *master_sig,
+  TALER_EXCHANGE_ManagementUpdateAmlOfficerCallback cb,
+  void *cb_cls);
+
+
+/**
+ * Cancel #TALER_EXCHANGE_management_update_aml_officer() operation.
+ *
+ * @param rh handle of the operation to cancel
+ */
+void
+TALER_EXCHANGE_management_update_aml_officer_cancel (
+  struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *rh);
+
+
+/**
+ * Function called with information about storing an
+ * an AML decision.
+ *
+ * @param cls closure
+ * @param hr HTTP response data
+ */
+typedef void
+(*TALER_EXCHANGE_AddAmlDecisionCallback) (
+  void *cls,
+  const struct TALER_EXCHANGE_HttpResponse *hr);
+
+
+/**
+ * @brief Handle for a POST /aml-decision/$OFFICER_PUB request.
+ */
+struct TALER_EXCHANGE_AddAmlDecision;
+
+
+/**
+ * Inform the exchange that an AML decision has been taken.
+ *
+ * @param ctx the context
+ * @param url HTTP base URL for the exchange
+ * @param justification human-readable justification
+ * @param decision_time when was the decision made
+ * @param new_threshold at what monthly amount threshold
+ *                      should a revision be triggered
+ * @param h_payto payto URI hash of the account the
+ *                      decision is about
+ * @param new_state updated AML state
+ * @param officer_priv private key of the deciding AML officer
+ * @param cb function to call with the exchange's result
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_EXCHANGE_AddAmlDecision *
+TALER_EXCHANGE_add_aml_decision (
+  struct GNUNET_CURL_Context *ctx,
+  const char *url,
+  const char *justification,
+  struct GNUNET_TIME_Timestamp decision_time,
+  const struct TALER_Amount *new_threshold,
+  const struct TALER_PaytoHashP *h_payto,
+  enum TALER_AmlDecisionState new_state,
+  const struct TALER_AmlOfficerPrivateKeyP *officer_priv,
+  TALER_EXCHANGE_AddAmlDecisionCallback cb,
+  void *cb_cls);
+
+
+/**
+ * Cancel #TALER_EXCHANGE_add_aml_decision() operation.
+ *
+ * @param rh handle of the operation to cancel
+ */
+void
+TALER_EXCHANGE_add_aml_decision_cancel (
+  struct TALER_EXCHANGE_AddAmlDecision *rh);
+
+
+/**
+ * Function called with information about the change to
+ * an AML officer status.
+ *
+ * @param cls closure
+ * @param hr HTTP response data
+ */
+typedef void
+(*TALER_EXCHANGE_ManagementAddPartnerCallback) (
+  void *cls,
+  const struct TALER_EXCHANGE_HttpResponse *hr);
+
+
+/**
+ * @brief Handle for a POST /management/partners/$PARTNER_PUB request.
+ */
+struct TALER_EXCHANGE_ManagementAddPartner;
+
+
+/**
+ * Inform the exchange that the status of a partnering
+ * exchange was defined.
+ *
+ * @param ctx the context
+ * @param url HTTP base URL for the exchange
+ * @param partner_pub the offline signing key of the partner
+ * @param start_date validity period start
+ * @param end_date validity period end
+ * @param wad_frequency how often will we do wad transfers to this partner
+ * @param wad_fee what is the wad fee to this partner
+ * @param partner_base_url what is the base URL of the @a partner_pub exchange
+ * @param master_sig the signature the signature
+ * @param cb function to call with the exchange's result
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_EXCHANGE_ManagementAddPartner *
+TALER_EXCHANGE_management_add_partner (
+  struct GNUNET_CURL_Context *ctx,
+  const char *url,
+  const struct TALER_MasterPublicKeyP *partner_pub,
+  struct GNUNET_TIME_Timestamp start_date,
+  struct GNUNET_TIME_Timestamp end_date,
+  struct GNUNET_TIME_Relative wad_frequency,
+  const struct TALER_Amount *wad_fee,
+  const char *partner_base_url,
+  const struct TALER_MasterSignatureP *master_sig,
+  TALER_EXCHANGE_ManagementAddPartnerCallback cb,
+  void *cb_cls);
+
+
+/**
+ * Cancel #TALER_EXCHANGE_management_update_aml_officer() operation.
+ *
+ * @param rh handle of the operation to cancel
+ */
+void
+TALER_EXCHANGE_management_add_partner_cancel (
+  struct TALER_EXCHANGE_ManagementAddPartner *rh);
+
+
 /**
  * Function called with information about the auditor setup operation result.
  *
diff --git a/src/lib/exchange_api_management_wire_enable.c 
b/src/lib/exchange_api_add_aml_decision.c
similarity index 57%
copy from src/lib/exchange_api_management_wire_enable.c
copy to src/lib/exchange_api_add_aml_decision.c
index 55480474..7230c5ed 100644
--- a/src/lib/exchange_api_management_wire_enable.c
+++ b/src/lib/exchange_api_add_aml_decision.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2015-2021 Taler Systems SA
+  Copyright (C) 2023 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
@@ -15,8 +15,8 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file lib/exchange_api_management_wire_enable.c
- * @brief functions to enable an exchange wire method / bank account
+ * @file lib/exchange_api_add_aml_decision.c
+ * @brief functions to add an AML decision by an AML officer
  * @author Christian Grothoff
  */
 #include "platform.h"
@@ -29,7 +29,7 @@
 #include "taler_json_lib.h"
 
 
-struct TALER_EXCHANGE_ManagementWireEnableHandle
+struct TALER_EXCHANGE_AddAmlDecision
 {
 
   /**
@@ -50,7 +50,7 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle
   /**
    * Function to call with the result.
    */
-  TALER_EXCHANGE_ManagementWireEnableCallback cb;
+  TALER_EXCHANGE_AddAmlDecisionCallback cb;
 
   /**
    * Closure for @a cb.
@@ -66,18 +66,18 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle
 
 /**
  * Function called when we're done processing the
- * HTTP /management/wire request.
+ * HTTP POST /aml-decision/$OFFICER_PUB request.
  *
- * @param cls the `struct TALER_EXCHANGE_ManagementAuditorEnableHandle *`
+ * @param cls the `struct TALER_EXCHANGE_AddAmlDecision *`
  * @param response_code HTTP response code, 0 on error
  * @param response response body, NULL if not in JSON
  */
 static void
-handle_auditor_enable_finished (void *cls,
-                                long response_code,
-                                const void *response)
+handle_add_aml_decision_finished (void *cls,
+                                  long response_code,
+                                  const void *response)
 {
-  struct TALER_EXCHANGE_ManagementWireEnableHandle *wh = cls;
+  struct TALER_EXCHANGE_AddAmlDecision *wh = cls;
   const json_t *json = response;
   struct TALER_EXCHANGE_HttpResponse hr = {
     .http_status = (unsigned int) response_code,
@@ -108,7 +108,7 @@ handle_auditor_enable_finished (void *cls,
     hr.ec = TALER_JSON_get_error_code (json);
     hr.hint = TALER_JSON_get_error_hint (json);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u/%d for exchange management enable 
wire\n",
+                "Unexpected response code %u/%d for exchange AML decision\n",
                 (unsigned int) response_code,
                 (int) hr.ec);
     break;
@@ -119,44 +119,60 @@ handle_auditor_enable_finished (void *cls,
             &hr);
     wh->cb = NULL;
   }
-  TALER_EXCHANGE_management_enable_wire_cancel (wh);
+  TALER_EXCHANGE_add_aml_decision_cancel (wh);
 }
 
 
-struct TALER_EXCHANGE_ManagementWireEnableHandle *
-TALER_EXCHANGE_management_enable_wire (
+struct TALER_EXCHANGE_AddAmlDecision *
+TALER_EXCHANGE_add_aml_decision (
   struct GNUNET_CURL_Context *ctx,
   const char *url,
-  const char *payto_uri,
-  struct GNUNET_TIME_Timestamp validity_start,
-  const struct TALER_MasterSignatureP *master_sig1,
-  const struct TALER_MasterSignatureP *master_sig2,
-  TALER_EXCHANGE_ManagementWireEnableCallback cb,
+  const char *justification,
+  struct GNUNET_TIME_Timestamp decision_time,
+  const struct TALER_Amount *new_threshold,
+  const struct TALER_PaytoHashP *h_payto,
+  enum TALER_AmlDecisionState new_state,
+  const struct TALER_AmlOfficerPrivateKeyP *officer_priv,
+  TALER_EXCHANGE_AddAmlDecisionCallback cb,
   void *cb_cls)
 {
-  struct TALER_EXCHANGE_ManagementWireEnableHandle *wh;
+  struct TALER_AmlOfficerPrivateKeyP officer_pub;
+  struct TALER_AmlOfficerSignatureP officer_sig;
+  struct TALER_EXCHANGE_AddAmlDecision *wh;
   CURL *eh;
   json_t *body;
 
-  {
-    char *msg = TALER_payto_validate (payto_uri);
-
-    if (NULL != msg)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "payto URI is malformed: %s\n",
-                  msg);
-      GNUNET_free (msg);
-      return NULL;
-    }
-  }
-  wh = GNUNET_new (struct TALER_EXCHANGE_ManagementWireEnableHandle);
+  GNUNET_CRYPTO_eddsa_key_get_public (&officer_priv->eddsa_priv,
+                                      &officer_pub.eddsa_pub);
+  TALER_officer_aml_decision_sign (justification,
+                                   decision_time,
+                                   h_payto,
+                                   new_state,
+                                   officer_priv,
+                                   &officer_sig);
+  wh = GNUNET_new (struct TALER_EXCHANGE_AddAmlDecision);
   wh->cb = cb;
   wh->cb_cls = cb_cls;
   wh->ctx = ctx;
-  wh->url = TALER_url_join (url,
-                            "management/wire",
-                            NULL);
+  {
+    char *path;
+    char opus[sizeof (officer_pub) * 2];
+    char *end;
+
+    end = GNUNET_STRINGS_data_to_string (
+      &officer_pub,
+      sizeof (officer_pub),
+      opus,
+      sizeof (opus));
+    *end = '\0';
+    GNUNET_asprintf (&path,
+                     "aml-decision/%s",
+                     opus);
+    wh->url = TALER_url_join (url,
+                              path,
+                              NULL);
+    GNUNET_free (path);
+  }
   if (NULL == wh->url)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -165,14 +181,18 @@ TALER_EXCHANGE_management_enable_wire (
     return NULL;
   }
   body = GNUNET_JSON_PACK (
-    GNUNET_JSON_pack_string ("payto_uri",
-                             payto_uri),
-    GNUNET_JSON_pack_data_auto ("master_sig_add",
-                                master_sig1),
-    GNUNET_JSON_pack_data_auto ("master_sig_wire",
-                                master_sig2),
-    GNUNET_JSON_pack_timestamp ("validity_start",
-                                validity_start));
+    GNUNET_JSON_pack_string ("justification",
+                             justification),
+    GNUNET_JSON_pack_data_auto ("officer_sig",
+                                &officer_sig),
+    GNUNET_JSON_pack_data_auto ("h_payto",
+                                h_payto),
+    GNUNET_JSON_pack_data_uint64 ("state",
+                                  (uint32_t) new_state),
+    TALER_JSON_pack_amount ("new_threshold",
+                            new_threshold),
+    GNUNET_JSON_pack_timestamp ("decision_time",
+                                decision_time));
   eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
   if ( (NULL == eh) ||
        (GNUNET_OK !=
@@ -194,11 +214,11 @@ TALER_EXCHANGE_management_enable_wire (
   wh->job = GNUNET_CURL_job_add2 (ctx,
                                   eh,
                                   wh->post_ctx.headers,
-                                  &handle_auditor_enable_finished,
+                                  &handle_add_aml_decision_finished,
                                   wh);
   if (NULL == wh->job)
   {
-    TALER_EXCHANGE_management_enable_wire_cancel (wh);
+    TALER_EXCHANGE_add_aml_decision_cancel (wh);
     return NULL;
   }
   return wh;
@@ -206,8 +226,8 @@ TALER_EXCHANGE_management_enable_wire (
 
 
 void
-TALER_EXCHANGE_management_enable_wire_cancel (
-  struct TALER_EXCHANGE_ManagementWireEnableHandle *wh)
+TALER_EXCHANGE_add_aml_decision_cancel (
+  struct TALER_EXCHANGE_AddAmlDecision *wh)
 {
   if (NULL != wh->job)
   {
diff --git a/src/lib/exchange_api_management_wire_disable.c 
b/src/lib/exchange_api_management_add_partner.c
similarity index 61%
copy from src/lib/exchange_api_management_wire_disable.c
copy to src/lib/exchange_api_management_add_partner.c
index 5d97eef7..264fd664 100644
--- a/src/lib/exchange_api_management_wire_disable.c
+++ b/src/lib/exchange_api_management_add_partner.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2015-2021 Taler Systems SA
+  Copyright (C) 2023 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
@@ -15,8 +15,8 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file lib/exchange_api_management_wire_disable.c
- * @brief functions to disable an exchange wire method / bank account
+ * @file lib/exchange_api_management_add_partner.c
+ * @brief functions to add an partner by an AML officer
  * @author Christian Grothoff
  */
 #include "platform.h"
@@ -29,7 +29,7 @@
 #include "taler_json_lib.h"
 
 
-struct TALER_EXCHANGE_ManagementWireDisableHandle
+struct TALER_EXCHANGE_ManagementAddPartner
 {
 
   /**
@@ -50,7 +50,7 @@ struct TALER_EXCHANGE_ManagementWireDisableHandle
   /**
    * Function to call with the result.
    */
-  TALER_EXCHANGE_ManagementWireDisableCallback cb;
+  TALER_EXCHANGE_ManagementAddPartnerCallback cb;
 
   /**
    * Closure for @a cb.
@@ -66,18 +66,18 @@ struct TALER_EXCHANGE_ManagementWireDisableHandle
 
 /**
  * Function called when we're done processing the
- * HTTP /management/wire/disable request.
+ * HTTP POST /aml-decision/$OFFICER_PUB request.
  *
- * @param cls the `struct TALER_EXCHANGE_ManagementAuditorDisableHandle *`
+ * @param cls the `struct TALER_EXCHANGE_ManagementAddPartner *`
  * @param response_code HTTP response code, 0 on error
  * @param response response body, NULL if not in JSON
  */
 static void
-handle_auditor_disable_finished (void *cls,
-                                 long response_code,
-                                 const void *response)
+handle_add_partner_finished (void *cls,
+                             long response_code,
+                             const void *response)
 {
-  struct TALER_EXCHANGE_ManagementWireDisableHandle *wh = cls;
+  struct TALER_EXCHANGE_ManagementAddPartner *wh = cls;
   const json_t *json = response;
   struct TALER_EXCHANGE_HttpResponse hr = {
     .http_status = (unsigned int) response_code,
@@ -98,10 +98,6 @@ handle_auditor_disable_finished (void *cls,
     hr.ec = TALER_JSON_get_error_code (json);
     hr.hint = TALER_JSON_get_error_hint (json);
     break;
-  case MHD_HTTP_NOT_FOUND:
-    hr.ec = TALER_JSON_get_error_code (json);
-    hr.hint = TALER_JSON_get_error_hint (json);
-    break;
   case MHD_HTTP_CONFLICT:
     hr.ec = TALER_JSON_get_error_code (json);
     hr.hint = TALER_JSON_get_error_hint (json);
@@ -112,7 +108,7 @@ handle_auditor_disable_finished (void *cls,
     hr.ec = TALER_JSON_get_error_code (json);
     hr.hint = TALER_JSON_get_error_hint (json);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u/%d exchange management disable 
wire\n",
+                "Unexpected response code %u/%d for adding exchange partner\n",
                 (unsigned int) response_code,
                 (int) hr.ec);
     break;
@@ -123,31 +119,51 @@ handle_auditor_disable_finished (void *cls,
             &hr);
     wh->cb = NULL;
   }
-  TALER_EXCHANGE_management_disable_wire_cancel (wh);
+  TALER_EXCHANGE_management_add_partner_cancel (wh);
 }
 
 
-struct TALER_EXCHANGE_ManagementWireDisableHandle *
-TALER_EXCHANGE_management_disable_wire (
+struct TALER_EXCHANGE_ManagementAddPartner *
+TALER_EXCHANGE_management_add_partner (
   struct GNUNET_CURL_Context *ctx,
   const char *url,
-  const char *payto_uri,
-  struct GNUNET_TIME_Timestamp validity_end,
+  const struct TALER_MasterPublicKeyP *partner_pub,
+  struct GNUNET_TIME_Timestamp start_date,
+  struct GNUNET_TIME_Timestamp end_date,
+  struct GNUNET_TIME_Relative wad_frequency,
+  const struct TALER_Amount *wad_fee,
+  const char *partner_base_url,
   const struct TALER_MasterSignatureP *master_sig,
-  TALER_EXCHANGE_ManagementWireDisableCallback cb,
+  TALER_EXCHANGE_ManagementAddPartnerCallback cb,
   void *cb_cls)
 {
-  struct TALER_EXCHANGE_ManagementWireDisableHandle *wh;
+  struct TALER_EXCHANGE_ManagementAddPartner *wh;
   CURL *eh;
   json_t *body;
 
-  wh = GNUNET_new (struct TALER_EXCHANGE_ManagementWireDisableHandle);
+  wh = GNUNET_new (struct TALER_EXCHANGE_ManagementAddPartner);
   wh->cb = cb;
   wh->cb_cls = cb_cls;
   wh->ctx = ctx;
-  wh->url = TALER_url_join (url,
-                            "management/wire/disable",
-                            NULL);
+  {
+    char *path;
+    char opus[sizeof (*partner_pub) * 2];
+    char *end;
+
+    end = GNUNET_STRINGS_data_to_string (
+      partner_pub,
+      sizeof (*partner_pub),
+      opus,
+      sizeof (opus));
+    *end = '\0';
+    GNUNET_asprintf (&path,
+                     "management/partners/%s",
+                     opus);
+    wh->url = TALER_url_join (url,
+                              path,
+                              NULL);
+    GNUNET_free (path);
+  }
   if (NULL == wh->url)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -156,12 +172,19 @@ TALER_EXCHANGE_management_disable_wire (
     return NULL;
   }
   body = GNUNET_JSON_PACK (
-    GNUNET_JSON_pack_string ("payto_uri",
-                             payto_uri),
-    GNUNET_JSON_pack_data_auto ("master_sig_del",
-                                master_sig),
-    GNUNET_JSON_pack_timestamp ("validity_end",
-                                validity_end));
+    GNUNET_JSON_pack_string ("partner_base_url",
+                             partner_base_url),
+    GNUNET_JSON_pack_timestamp ("start_date",
+                                start_date),
+    GNUNET_JSON_pack_timestamp ("end_date",
+                                end_date),
+    GNUNET_JSON_pack_time_rel ("wad_frequency",
+                               wad_frequency),
+    GNUNET_JSON_pack_data_auto ("master_sig",
+                                &master_sig),
+    TALER_JSON_pack_amount ("wad_fee",
+                            wad_fee)
+    );
   eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
   if ( (NULL == eh) ||
        (GNUNET_OK !=
@@ -183,11 +206,11 @@ TALER_EXCHANGE_management_disable_wire (
   wh->job = GNUNET_CURL_job_add2 (ctx,
                                   eh,
                                   wh->post_ctx.headers,
-                                  &handle_auditor_disable_finished,
+                                  &handle_add_partner_finished,
                                   wh);
   if (NULL == wh->job)
   {
-    TALER_EXCHANGE_management_disable_wire_cancel (wh);
+    TALER_EXCHANGE_management_add_partner_cancel (wh);
     return NULL;
   }
   return wh;
@@ -195,8 +218,8 @@ TALER_EXCHANGE_management_disable_wire (
 
 
 void
-TALER_EXCHANGE_management_disable_wire_cancel (
-  struct TALER_EXCHANGE_ManagementWireDisableHandle *wh)
+TALER_EXCHANGE_management_add_partner_cancel (
+  struct TALER_EXCHANGE_ManagementAddPartner *wh)
 {
   if (NULL != wh->job)
   {
diff --git a/src/lib/exchange_api_management_wire_enable.c 
b/src/lib/exchange_api_management_update_aml_officer.c
similarity index 64%
copy from src/lib/exchange_api_management_wire_enable.c
copy to src/lib/exchange_api_management_update_aml_officer.c
index 55480474..bdc0dbe4 100644
--- a/src/lib/exchange_api_management_wire_enable.c
+++ b/src/lib/exchange_api_management_update_aml_officer.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2015-2021 Taler Systems SA
+  Copyright (C) 2023 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
@@ -15,8 +15,8 @@
   <http://www.gnu.org/licenses/>
 */
 /**
- * @file lib/exchange_api_management_wire_enable.c
- * @brief functions to enable an exchange wire method / bank account
+ * @file lib/exchange_api_management_update_aml_officer.c
+ * @brief functions to update AML officer status
  * @author Christian Grothoff
  */
 #include "platform.h"
@@ -29,7 +29,7 @@
 #include "taler_json_lib.h"
 
 
-struct TALER_EXCHANGE_ManagementWireEnableHandle
+struct TALER_EXCHANGE_ManagementUpdateAmlOfficer
 {
 
   /**
@@ -50,7 +50,7 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle
   /**
    * Function to call with the result.
    */
-  TALER_EXCHANGE_ManagementWireEnableCallback cb;
+  TALER_EXCHANGE_ManagementUpdateAmlOfficerCallback cb;
 
   /**
    * Closure for @a cb.
@@ -73,11 +73,11 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle
  * @param response response body, NULL if not in JSON
  */
 static void
-handle_auditor_enable_finished (void *cls,
-                                long response_code,
-                                const void *response)
+handle_update_aml_officer_finished (void *cls,
+                                    long response_code,
+                                    const void *response)
 {
-  struct TALER_EXCHANGE_ManagementWireEnableHandle *wh = cls;
+  struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *wh = cls;
   const json_t *json = response;
   struct TALER_EXCHANGE_HttpResponse hr = {
     .http_status = (unsigned int) response_code,
@@ -108,7 +108,7 @@ handle_auditor_enable_finished (void *cls,
     hr.ec = TALER_JSON_get_error_code (json);
     hr.hint = TALER_JSON_get_error_hint (json);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unexpected response code %u/%d for exchange management enable 
wire\n",
+                "Unexpected response code %u/%d for exchange management update 
AML officer\n",
                 (unsigned int) response_code,
                 (int) hr.ec);
     break;
@@ -119,44 +119,50 @@ handle_auditor_enable_finished (void *cls,
             &hr);
     wh->cb = NULL;
   }
-  TALER_EXCHANGE_management_enable_wire_cancel (wh);
+  TALER_EXCHANGE_management_update_aml_officer_cancel (wh);
 }
 
 
-struct TALER_EXCHANGE_ManagementWireEnableHandle *
-TALER_EXCHANGE_management_enable_wire (
+struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *
+TALER_EXCHANGE_management_update_aml_officer (
   struct GNUNET_CURL_Context *ctx,
   const char *url,
-  const char *payto_uri,
-  struct GNUNET_TIME_Timestamp validity_start,
-  const struct TALER_MasterSignatureP *master_sig1,
-  const struct TALER_MasterSignatureP *master_sig2,
-  TALER_EXCHANGE_ManagementWireEnableCallback cb,
+  const struct TALER_AmlOfficerPublicKeyP *officer_pub,
+  const char *officer_name,
+  struct GNUNET_TIME_Timestamp change_date,
+  bool is_active,
+  bool read_only,
+  const struct TALER_MasterSignatureP *master_sig,
+  TALER_EXCHANGE_ManagementUpdateAmlOfficerCallback cb,
   void *cb_cls)
 {
-  struct TALER_EXCHANGE_ManagementWireEnableHandle *wh;
+  struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *wh;
   CURL *eh;
   json_t *body;
 
-  {
-    char *msg = TALER_payto_validate (payto_uri);
-
-    if (NULL != msg)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "payto URI is malformed: %s\n",
-                  msg);
-      GNUNET_free (msg);
-      return NULL;
-    }
-  }
-  wh = GNUNET_new (struct TALER_EXCHANGE_ManagementWireEnableHandle);
+  wh = GNUNET_new (struct TALER_EXCHANGE_ManagementUpdateAmlOfficer);
   wh->cb = cb;
   wh->cb_cls = cb_cls;
   wh->ctx = ctx;
-  wh->url = TALER_url_join (url,
-                            "management/wire",
-                            NULL);
+  {
+    char *path;
+    char opus[sizeof (*officer_pub) * 2];
+    char *end;
+
+    end = GNUNET_STRINGS_data_to_string (
+      officer_pub,
+      sizeof (*officer_pub),
+      opus,
+      sizeof (opus));
+    *end = '\0';
+    GNUNET_asprintf (&path,
+                     "management/aml-officers/%s",
+                     opus);
+    wh->url = TALER_url_join (url,
+                              path,
+                              NULL);
+    GNUNET_free (path);
+  }
   if (NULL == wh->url)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -165,14 +171,16 @@ TALER_EXCHANGE_management_enable_wire (
     return NULL;
   }
   body = GNUNET_JSON_PACK (
-    GNUNET_JSON_pack_string ("payto_uri",
-                             payto_uri),
-    GNUNET_JSON_pack_data_auto ("master_sig_add",
-                                master_sig1),
-    GNUNET_JSON_pack_data_auto ("master_sig_wire",
-                                master_sig2),
-    GNUNET_JSON_pack_timestamp ("validity_start",
-                                validity_start));
+    GNUNET_JSON_pack_string ("officer_name",
+                             officer_name),
+    GNUNET_JSON_pack_data_auto ("master_sig",
+                                master_sig),
+    GNUNET_JSON_pack_data_bool ("is_active",
+                                is_active),
+    GNUNET_JSON_pack_data_bool ("read_only",
+                                read_only),
+    GNUNET_JSON_pack_timestamp ("change_date",
+                                change_date));
   eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
   if ( (NULL == eh) ||
        (GNUNET_OK !=
@@ -194,11 +202,11 @@ TALER_EXCHANGE_management_enable_wire (
   wh->job = GNUNET_CURL_job_add2 (ctx,
                                   eh,
                                   wh->post_ctx.headers,
-                                  &handle_auditor_enable_finished,
+                                  &handle_update_aml_officer_finished,
                                   wh);
   if (NULL == wh->job)
   {
-    TALER_EXCHANGE_management_enable_wire_cancel (wh);
+    TALER_EXCHANGE_management_update_aml_officer_cancel (wh);
     return NULL;
   }
   return wh;
@@ -206,8 +214,8 @@ TALER_EXCHANGE_management_enable_wire (
 
 
 void
-TALER_EXCHANGE_management_enable_wire_cancel (
-  struct TALER_EXCHANGE_ManagementWireEnableHandle *wh)
+TALER_EXCHANGE_management_update_aml_officer_cancel (
+  struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *wh)
 {
   if (NULL != wh->job)
   {

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