commit ca846b09671c742b2f8275bbb9f1a975efdebc0f
parent 0e00c2a9854c00d2b2da62689d1ba2a735090caf
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 22 Feb 2026 20:10:08 +0100
starting with migration to NG API: aml officer update
Diffstat:
6 files changed, 337 insertions(+), 310 deletions(-)
diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c
@@ -22,6 +22,11 @@
#include <gnunet/gnunet_json_lib.h>
#include <gnunet/gnunet_util_lib.h>
#include "taler/taler_json_lib.h"
+
+struct AmlStaffRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE \
+ struct AmlStaffRequest
+#include "taler/taler-exchange/post-management-aml-officers.h"
#include "taler/taler_exchange_service.h"
#include "taler/taler_extensions.h"
#include <regex.h>
@@ -529,7 +534,7 @@ struct AmlStaffRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *h;
+ struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *h;
/**
* Array index of the associated command.
@@ -725,7 +730,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete AML staff update #%u\n",
(unsigned int) asr->idx);
- TALER_EXCHANGE_management_update_aml_officer_cancel (asr->h);
+ TALER_EXCHANGE_post_management_aml_officers_cancel (asr->h);
GNUNET_CONTAINER_DLL_remove (asr_head,
asr_tail,
asr);
@@ -2484,15 +2489,14 @@ add_partner (const char *exchange_url,
/**
* Function called with information about the AML officer update operation.
*
- * @param cls closure with a `struct AmlStaffRequest`
+ * @param asr the request
* @param ar response data
*/
static void
update_aml_officer_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementUpdateAmlOfficerResponse *ar)
+ TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE *asr,
+ const struct TALER_EXCHANGE_PostManagementAmlOfficersResponse *ar)
{
- struct AmlStaffRequest *asr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &ar->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -2570,20 +2574,23 @@ update_aml_staff (const char *exchange_url,
}
asr = GNUNET_new (struct AmlStaffRequest);
asr->idx = idx;
- asr->h =
- TALER_EXCHANGE_management_update_aml_officer (ctx,
- exchange_url,
- &officer_pub,
- officer_name,
- change_date,
- is_active,
- read_only,
- &master_sig,
- &update_aml_officer_cb,
- asr);
+ asr->h = TALER_EXCHANGE_post_management_aml_officers_create (
+ ctx,
+ exchange_url,
+ &officer_pub,
+ officer_name,
+ change_date,
+ is_active,
+ read_only,
+ &master_sig);
GNUNET_CONTAINER_DLL_insert (asr_head,
asr_tail,
asr);
+ GNUNET_assert (TALER_EC_NONE ==
+ TALER_EXCHANGE_post_management_aml_officers_start (
+ asr->h,
+ &update_aml_officer_cb,
+ asr));
}
diff --git a/src/include/taler/taler-exchange/post-management-aml-officers.h b/src/include/taler/taler-exchange/post-management-aml-officers.h
@@ -116,53 +116,4 @@ TALER_EXCHANGE_post_management_aml_officers_cancel (
struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *pmaoh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementAmlOfficersResponse instead.
- */
-struct TALER_EXCHANGE_ManagementUpdateAmlOfficerResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementAmlOfficersCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementUpdateAmlOfficerCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementUpdateAmlOfficerResponse *hr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementAmlOfficersHandle instead.
- */
-struct TALER_EXCHANGE_ManagementUpdateAmlOfficer;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_aml_officers_create() and
- * the new API instead.
- */
-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);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_aml_officers_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_update_aml_officer_cancel (
- struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *rh);
-
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_AML_OFFICERS_H */
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
@@ -18,7 +18,7 @@ lib_LTLIBRARIES = \
libtalerexchange.la
libtalerexchange_la_LDFLAGS = \
- -version-info 19:0:0 \
+ -version-info 18:0:0 \
-no-undefined
libtalerexchange_la_SOURCES = \
exchange_api_add_aml_decision.c \
@@ -52,7 +52,7 @@ libtalerexchange_la_SOURCES = \
exchange_api_management_revoke_signing_key.c \
exchange_api_management_set_global_fee.c \
exchange_api_management_set_wire_fee.c \
- exchange_api_management_update_aml_officer.c \
+ exchange_api_post-management-aml-officers.c \
exchange_api_management_wire_disable.c \
exchange_api_management_wire_enable.c \
exchange_api_melt.c \
diff --git a/src/lib/exchange_api_management_update_aml_officer.c b/src/lib/exchange_api_management_update_aml_officer.c
@@ -1,231 +0,0 @@
-/*
- This file is part of TALER
- 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
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, see
- <http://www.gnu.org/licenses/>
-*/
-/**
- * @file lib/exchange_api_management_update_aml_officer.c
- * @brief functions to update AML officer status
- * @author Christian Grothoff
- */
-#include "taler/platform.h"
-#include "taler/taler_json_lib.h"
-#include <gnunet/gnunet_curl_lib.h>
-#include <microhttpd.h>
-#include "taler/taler_exchange_service.h"
-#include "exchange_api_curl_defaults.h"
-#include "taler/taler_signatures.h"
-#include "taler/taler_curl_lib.h"
-#include "taler/taler_json_lib.h"
-
-
-struct TALER_EXCHANGE_ManagementUpdateAmlOfficer
-{
-
- /**
- * The url for this request.
- */
- char *url;
-
- /**
- * Minor context that holds body and headers.
- */
- struct TALER_CURL_PostContext post_ctx;
-
- /**
- * Handle for the request.
- */
- struct GNUNET_CURL_Job *job;
-
- /**
- * Function to call with the result.
- */
- TALER_EXCHANGE_ManagementUpdateAmlOfficerCallback cb;
-
- /**
- * Closure for @a cb.
- */
- void *cb_cls;
-
- /**
- * Reference to the execution context.
- */
- struct GNUNET_CURL_Context *ctx;
-};
-
-
-/**
- * Function called when we're done processing the
- * HTTP /management/wire request.
- *
- * @param cls the `struct TALER_EXCHANGE_ManagementAuditorEnableHandle *`
- * @param response_code HTTP response code, 0 on error
- * @param response response body, NULL if not in JSON
- */
-static void
-handle_update_aml_officer_finished (void *cls,
- long response_code,
- const void *response)
-{
- struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *wh = cls;
- const json_t *json = response;
- struct TALER_EXCHANGE_ManagementUpdateAmlOfficerResponse uar = {
- .hr.http_status = (unsigned int) response_code,
- .hr.reply = json
- };
-
- wh->job = NULL;
- switch (response_code)
- {
- case 0:
- /* no reply */
- uar.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- uar.hr.hint = "server offline?";
- break;
- case MHD_HTTP_NO_CONTENT:
- break;
- case MHD_HTTP_FORBIDDEN:
- uar.hr.ec = TALER_JSON_get_error_code (json);
- uar.hr.hint = TALER_JSON_get_error_hint (json);
- break;
- case MHD_HTTP_NOT_FOUND:
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Server did not find handler at `%s'. Did you configure the correct exchange base URL?\n",
- wh->url);
- if (NULL != json)
- {
- uar.hr.ec = TALER_JSON_get_error_code (json);
- uar.hr.hint = TALER_JSON_get_error_hint (json);
- }
- else
- {
- uar.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- uar.hr.hint = TALER_ErrorCode_get_hint (uar.hr.ec);
- }
- break;
- case MHD_HTTP_CONFLICT:
- uar.hr.ec = TALER_JSON_get_error_code (json);
- uar.hr.hint = TALER_JSON_get_error_hint (json);
- break;
- default:
- /* unexpected response code */
- GNUNET_break_op (0);
- uar.hr.ec = TALER_JSON_get_error_code (json);
- uar.hr.hint = TALER_JSON_get_error_hint (json);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u/%d for exchange management update AML officer\n",
- (unsigned int) response_code,
- (int) uar.hr.ec);
- break;
- }
- if (NULL != wh->cb)
- {
- wh->cb (wh->cb_cls,
- &uar);
- wh->cb = NULL;
- }
- TALER_EXCHANGE_management_update_aml_officer_cancel (wh);
-}
-
-
-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)
-{
- struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *wh;
- CURL *eh;
- json_t *body;
-
- 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/aml-officers",
- NULL);
- if (NULL == wh->url)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not construct request URL.\n");
- GNUNET_free (wh);
- return NULL;
- }
- body = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_string ("officer_name",
- officer_name),
- GNUNET_JSON_pack_data_auto ("officer_pub",
- officer_pub),
- GNUNET_JSON_pack_data_auto ("master_sig",
- master_sig),
- GNUNET_JSON_pack_bool ("is_active",
- is_active),
- GNUNET_JSON_pack_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 !=
- TALER_curl_easy_post (&wh->post_ctx,
- eh,
- body)) )
- {
- GNUNET_break (0);
- if (NULL != eh)
- curl_easy_cleanup (eh);
- json_decref (body);
- GNUNET_free (wh->url);
- GNUNET_free (wh);
- return NULL;
- }
- json_decref (body);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Requesting URL '%s'\n",
- wh->url);
- wh->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- wh->post_ctx.headers,
- &handle_update_aml_officer_finished,
- wh);
- if (NULL == wh->job)
- {
- TALER_EXCHANGE_management_update_aml_officer_cancel (wh);
- return NULL;
- }
- return wh;
-}
-
-
-void
-TALER_EXCHANGE_management_update_aml_officer_cancel (
- struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *wh)
-{
- if (NULL != wh->job)
- {
- GNUNET_CURL_job_cancel (wh->job);
- wh->job = NULL;
- }
- TALER_curl_easy_post_finished (&wh->post_ctx);
- GNUNET_free (wh->url);
- GNUNET_free (wh);
-}
diff --git a/src/lib/exchange_api_post-management-aml-officers.c b/src/lib/exchange_api_post-management-aml-officers.c
@@ -0,0 +1,292 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2023-2026 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
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see
+ <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file lib/exchange_api_post-management-aml-officers.c
+ * @brief functions to update AML officer status via POST /management/aml-officers
+ * @author Christian Grothoff
+ */
+#include "taler/platform.h"
+#include "taler/taler_json_lib.h"
+#include <gnunet/gnunet_curl_lib.h>
+#include <microhttpd.h>
+#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-aml-officers.h"
+#include "exchange_api_curl_defaults.h"
+#include "taler/taler_signatures.h"
+#include "taler/taler_curl_lib.h"
+
+
+/**
+ * Handle for a POST /management/aml-officers request.
+ */
+struct TALER_EXCHANGE_PostManagementAmlOfficersHandle
+{
+
+ /**
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
+ */
+ char *url;
+
+ /**
+ * Minor context that holds body and headers.
+ */
+ struct TALER_CURL_PostContext post_ctx;
+
+ /**
+ * Handle for the request.
+ */
+ struct GNUNET_CURL_Job *job;
+
+ /**
+ * Function to call with the result.
+ */
+ TALER_EXCHANGE_PostManagementAmlOfficersCallback cb;
+
+ /**
+ * Closure for @a cb.
+ */
+ TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE *cb_cls;
+
+ /**
+ * Reference to the execution context.
+ */
+ struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Public key of the officer.
+ */
+ struct TALER_AmlOfficerPublicKeyP officer_pub;
+
+ /**
+ * Name of the officer.
+ */
+ char *officer_name;
+
+ /**
+ * When to affect the status change.
+ */
+ struct GNUNET_TIME_Timestamp change_date;
+
+ /**
+ * Is the officer active?
+ */
+ bool is_active;
+
+ /**
+ * Is the officer read-only?
+ */
+ bool read_only;
+
+ /**
+ * Master signature affirming the change.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
+};
+
+
+/**
+ * Function called when we're done processing the
+ * HTTP POST /management/aml-officers request.
+ *
+ * @param cls the `struct TALER_EXCHANGE_PostManagementAmlOfficersHandle`
+ * @param response_code HTTP response code, 0 on error
+ * @param response response body, NULL if not in JSON
+ */
+static void
+handle_post_aml_officer_finished (void *cls,
+ long response_code,
+ const void *response)
+{
+ struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *pmaoh = cls;
+ const json_t *json = response;
+ struct TALER_EXCHANGE_PostManagementAmlOfficersResponse res = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
+ };
+
+ pmaoh->job = NULL;
+ switch (response_code)
+ {
+ case 0:
+ /* no reply */
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = "server offline?";
+ break;
+ case MHD_HTTP_NO_CONTENT:
+ break;
+ case MHD_HTTP_FORBIDDEN:
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
+ break;
+ case MHD_HTTP_NOT_FOUND:
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Server did not find handler at `%s'. Did you configure the correct exchange base URL?\n",
+ pmaoh->url);
+ if (NULL != json)
+ {
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
+ }
+ else
+ {
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = TALER_ErrorCode_get_hint (res.hr.ec);
+ }
+ break;
+ case MHD_HTTP_CONFLICT:
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
+ break;
+ default:
+ /* unexpected response code */
+ GNUNET_break_op (0);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unexpected response code %u/%d for exchange POST management AML officer\n",
+ (unsigned int) response_code,
+ (int) res.hr.ec);
+ break;
+ }
+ if (NULL != pmaoh->cb)
+ {
+ pmaoh->cb (pmaoh->cb_cls,
+ &res);
+ pmaoh->cb = NULL;
+ }
+ TALER_EXCHANGE_post_management_aml_officers_cancel (pmaoh);
+}
+
+
+struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *
+TALER_EXCHANGE_post_management_aml_officers_create (
+ 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)
+{
+ struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *pmaoh;
+
+ pmaoh = GNUNET_new (struct TALER_EXCHANGE_PostManagementAmlOfficersHandle);
+ pmaoh->ctx = ctx;
+ pmaoh->base_url = GNUNET_strdup (url);
+ pmaoh->officer_pub = *officer_pub;
+ pmaoh->officer_name = GNUNET_strdup (officer_name);
+ pmaoh->change_date = change_date;
+ pmaoh->is_active = is_active;
+ pmaoh->read_only = read_only;
+ pmaoh->master_sig = *master_sig;
+ return pmaoh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_aml_officers_start (
+ struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *pmaoh,
+ TALER_EXCHANGE_PostManagementAmlOfficersCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE *cb_cls)
+{
+ CURL *eh;
+ json_t *body;
+
+ pmaoh->cb = cb;
+ pmaoh->cb_cls = cb_cls;
+ pmaoh->url = TALER_url_join (pmaoh->base_url,
+ "management/aml-officers",
+ NULL);
+ if (NULL == pmaoh->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
+ }
+ body = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("officer_name",
+ pmaoh->officer_name),
+ GNUNET_JSON_pack_data_auto ("officer_pub",
+ &pmaoh->officer_pub),
+ GNUNET_JSON_pack_data_auto ("master_sig",
+ &pmaoh->master_sig),
+ GNUNET_JSON_pack_bool ("is_active",
+ pmaoh->is_active),
+ GNUNET_JSON_pack_bool ("read_only",
+ pmaoh->read_only),
+ GNUNET_JSON_pack_timestamp ("change_date",
+ pmaoh->change_date));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmaoh->url);
+ if ( (NULL == eh) ||
+ (GNUNET_OK !=
+ TALER_curl_easy_post (&pmaoh->post_ctx,
+ eh,
+ body)) )
+ {
+ GNUNET_break (0);
+ if (NULL != eh)
+ curl_easy_cleanup (eh);
+ json_decref (body);
+ GNUNET_free (pmaoh->url);
+ pmaoh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
+ }
+ json_decref (body);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Requesting URL '%s'\n",
+ pmaoh->url);
+ pmaoh->job = GNUNET_CURL_job_add2 (pmaoh->ctx,
+ eh,
+ pmaoh->post_ctx.headers,
+ &handle_post_aml_officer_finished,
+ pmaoh);
+ if (NULL == pmaoh->job)
+ {
+ TALER_curl_easy_post_finished (&pmaoh->post_ctx);
+ GNUNET_free (pmaoh->url);
+ pmaoh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
+ }
+ return TALER_EC_NONE;
+}
+
+
+void
+TALER_EXCHANGE_post_management_aml_officers_cancel (
+ struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *pmaoh)
+{
+ if (NULL != pmaoh->job)
+ {
+ GNUNET_CURL_job_cancel (pmaoh->job);
+ pmaoh->job = NULL;
+ }
+ TALER_curl_easy_post_finished (&pmaoh->post_ctx);
+ GNUNET_free (pmaoh->url);
+ GNUNET_free (pmaoh->officer_name);
+ GNUNET_free (pmaoh->base_url);
+ GNUNET_free (pmaoh);
+}
+
+
+/* end of exchange_api_post-management-aml-officers.c */
diff --git a/src/testing/testing_api_cmd_set_officer.c b/src/testing/testing_api_cmd_set_officer.c
@@ -22,6 +22,12 @@
* @author Christian Grothoff
*/
#include "taler/platform.h"
+
+struct SetOfficerState;
+#define TALER_EXCHANGE_POST_MANAGEMENT_AML_OFFICERS_RESULT_CLOSURE \
+ struct SetOfficerState
+#include "taler/taler-exchange/post-management-aml-officers.h"
+
#include "taler/taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler/taler_testing_lib.h"
@@ -38,7 +44,7 @@ struct SetOfficerState
/**
* Update AML officer handle while operation is running.
*/
- struct TALER_EXCHANGE_ManagementUpdateAmlOfficer *dh;
+ struct TALER_EXCHANGE_PostManagementAmlOfficersHandle *dh;
/**
* Our interpreter.
@@ -83,15 +89,14 @@ struct SetOfficerState
* Callback to analyze the /management/XXX response, just used to check
* if the response code is acceptable.
*
- * @param cls closure.
+ * @param ds our context
* @param ar response details
*/
static void
-set_officer_cb (void *cls,
- const struct
- TALER_EXCHANGE_ManagementUpdateAmlOfficerResponse *ar)
+set_officer_cb (
+ struct SetOfficerState *ds,
+ const struct TALER_EXCHANGE_PostManagementAmlOfficersResponse *ar)
{
- struct SetOfficerState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &ar->hr;
ds->dh = NULL;
@@ -194,7 +199,7 @@ set_officer_run (void *cls,
master_priv,
&master_sig);
}
- ds->dh = TALER_EXCHANGE_management_update_aml_officer (
+ ds->dh = TALER_EXCHANGE_post_management_aml_officers_create (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
&ds->officer_pub,
@@ -202,15 +207,18 @@ set_officer_run (void *cls,
now,
ds->is_active,
ds->read_only,
- &master_sig,
- &set_officer_cb,
- ds);
+ &master_sig);
if (NULL == ds->dh)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
+ GNUNET_assert (TALER_EC_NONE ==
+ TALER_EXCHANGE_post_management_aml_officers_start (
+ ds->dh,
+ &set_officer_cb,
+ ds));
}
@@ -231,7 +239,7 @@ set_officer_cleanup (void *cls,
{
TALER_TESTING_command_incomplete (ds->is,
cmd->label);
- TALER_EXCHANGE_management_update_aml_officer_cancel (ds->dh);
+ TALER_EXCHANGE_post_management_aml_officers_cancel (ds->dh);
ds->dh = NULL;
}
GNUNET_free (ds);