commit 2f414cadfe8a5be1d7ec4e3724e5ac098e9fe0d5
parent d6507a9a86198a4b2f1f884d6fd630aa4a3b921b
Author: Christian Grothoff <grothoff@gnu.org>
Date: Sun, 22 Feb 2026 22:39:09 +0100
complete migration of /management/* endpoints to NG API
Diffstat:
34 files changed, 1928 insertions(+), 1798 deletions(-)
diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2020-2024 Taler Systems SA
+ Copyright (C) 2020-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
@@ -27,7 +27,73 @@ 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"
+
+struct DenomRevocationRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_DENOMINATIONS_REVOKE_RESULT_CLOSURE \
+ struct DenomRevocationRequest
+#include \
+ "taler/taler-exchange/post-management-denominations-H_DENOM_PUB-revoke.h"
+
+struct SignkeyRevocationRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_SIGNKEYS_REVOKE_RESULT_CLOSURE \
+ struct SignkeyRevocationRequest
+#include \
+ "taler/taler-exchange/post-management-signkeys-EXCHANGE_PUB-revoke.h"
+
+struct AuditorAddRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_AUDITORS_RESULT_CLOSURE \
+ struct AuditorAddRequest
+#include "taler/taler-exchange/post-management-auditors.h"
+
+struct AuditorDelRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_AUDITORS_DISABLE_RESULT_CLOSURE \
+ struct AuditorDelRequest
+#include "taler/taler-exchange/post-management-auditors-AUDITOR_PUB-disable.h"
+
+struct WireAddRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_WIRE_RESULT_CLOSURE \
+ struct WireAddRequest
+#include "taler/taler-exchange/post-management-wire.h"
+
+struct WireDelRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_WIRE_DISABLE_RESULT_CLOSURE \
+ struct WireDelRequest
+#include "taler/taler-exchange/post-management-wire-disable.h"
+
+struct WireFeeRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_WIRE_FEES_RESULT_CLOSURE \
+ struct WireFeeRequest
+#include "taler/taler-exchange/post-management-wire-fee.h"
+
+struct GlobalFeeRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_GLOBAL_FEES_RESULT_CLOSURE \
+ struct GlobalFeeRequest
+#include "taler/taler-exchange/post-management-global-fees.h"
+
+struct DrainProfitsRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_DRAIN_RESULT_CLOSURE \
+ struct DrainProfitsRequest
+#include "taler/taler-exchange/post-management-drain.h"
+
+struct UploadKeysRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_KEYS_RESULT_CLOSURE \
+ struct UploadKeysRequest
+#include "taler/taler-exchange/post-management-keys.h"
+
+struct UploadExtensionsRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_EXTENSIONS_RESULT_CLOSURE \
+ struct UploadExtensionsRequest
+#include "taler/taler-exchange/post-management-extensions.h"
+
+struct PartnerAddRequest;
+#define TALER_EXCHANGE_POST_MANAGEMENT_PARTNERS_RESULT_CLOSURE \
+ struct PartnerAddRequest
+#include "taler/taler-exchange/post-management-partners.h"
+
+#define TALER_EXCHANGE_GET_MANAGEMENT_KEYS_RESULT_CLOSURE \
+ char *const
+#include "taler/taler-exchange/get-management-keys.h"
+
#include "taler/taler_extensions.h"
#include <regex.h>
@@ -229,7 +295,7 @@ struct DenomRevocationRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *h;
+ struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *h;
/**
* Array index of the associated command.
@@ -257,7 +323,7 @@ struct SignkeyRevocationRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *h;
+ struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle *h;
/**
* Array index of the associated command.
@@ -285,7 +351,7 @@ struct AuditorAddRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementAuditorEnableHandle *h;
+ struct TALER_EXCHANGE_PostManagementAuditorsHandle *h;
/**
* Array index of the associated command.
@@ -313,7 +379,7 @@ struct AuditorDelRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementAuditorDisableHandle *h;
+ struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle *h;
/**
* Array index of the associated command.
@@ -341,7 +407,7 @@ struct WireAddRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementWireEnableHandle *h;
+ struct TALER_EXCHANGE_PostManagementWireHandle *h;
/**
* Array index of the associated command.
@@ -369,7 +435,7 @@ struct WireDelRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementWireDisableHandle *h;
+ struct TALER_EXCHANGE_PostManagementWireDisableHandle *h;
/**
* Array index of the associated command.
@@ -397,7 +463,7 @@ struct WireFeeRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementSetWireFeeHandle *h;
+ struct TALER_EXCHANGE_PostManagementWireFeesHandle *h;
/**
* Array index of the associated command.
@@ -425,7 +491,7 @@ struct DrainProfitsRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementDrainProfitsHandle *h;
+ struct TALER_EXCHANGE_PostManagementDrainHandle *h;
/**
* Array index of the associated command.
@@ -453,7 +519,7 @@ struct GlobalFeeRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *h;
+ struct TALER_EXCHANGE_PostManagementGlobalFeesHandle *h;
/**
* Array index of the associated command.
@@ -480,7 +546,7 @@ struct UploadKeysRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementPostKeysHandle *h;
+ struct TALER_EXCHANGE_PostManagementKeysHandle *h;
/**
* Operation index.
@@ -506,7 +572,7 @@ struct UploadExtensionsRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementPostExtensionsHandle *h;
+ struct TALER_EXCHANGE_PostManagementExtensionsHandle *h;
/**
* Operation index.
@@ -562,7 +628,7 @@ struct PartnerAddRequest
/**
* Operation handle.
*/
- struct TALER_EXCHANGE_ManagementAddPartner *h;
+ struct TALER_EXCHANGE_PostManagementPartnersHandle *h;
/**
* Array index of the associated command.
@@ -745,7 +811,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete partner add request #%u\n",
(unsigned int) par->idx);
- TALER_EXCHANGE_management_add_partner_cancel (par->h);
+ TALER_EXCHANGE_post_management_partners_cancel (par->h);
GNUNET_CONTAINER_DLL_remove (par_head,
par_tail,
par);
@@ -760,7 +826,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete denomination revocation #%u\n",
(unsigned int) drr->idx);
- TALER_EXCHANGE_management_revoke_denomination_key_cancel (drr->h);
+ TALER_EXCHANGE_post_management_denominations_revoke_cancel (drr->h);
GNUNET_CONTAINER_DLL_remove (drr_head,
drr_tail,
drr);
@@ -775,7 +841,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete signkey revocation #%u\n",
(unsigned int) srr->idx);
- TALER_EXCHANGE_management_revoke_signing_key_cancel (srr->h);
+ TALER_EXCHANGE_post_management_signkeys_revoke_cancel (srr->h);
GNUNET_CONTAINER_DLL_remove (srr_head,
srr_tail,
srr);
@@ -791,7 +857,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete auditor add #%u\n",
(unsigned int) aar->idx);
- TALER_EXCHANGE_management_enable_auditor_cancel (aar->h);
+ TALER_EXCHANGE_post_management_auditors_cancel (aar->h);
GNUNET_CONTAINER_DLL_remove (aar_head,
aar_tail,
aar);
@@ -806,7 +872,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete auditor del #%u\n",
(unsigned int) adr->idx);
- TALER_EXCHANGE_management_disable_auditor_cancel (adr->h);
+ TALER_EXCHANGE_post_management_auditors_disable_cancel (adr->h);
GNUNET_CONTAINER_DLL_remove (adr_head,
adr_tail,
adr);
@@ -821,7 +887,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete wire add #%u\n",
(unsigned int) war->idx);
- TALER_EXCHANGE_management_enable_wire_cancel (war->h);
+ TALER_EXCHANGE_post_management_wire_cancel (war->h);
GNUNET_CONTAINER_DLL_remove (war_head,
war_tail,
war);
@@ -836,7 +902,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete wire del #%u\n",
(unsigned int) wdr->idx);
- TALER_EXCHANGE_management_disable_wire_cancel (wdr->h);
+ TALER_EXCHANGE_post_management_wire_disable_cancel (wdr->h);
GNUNET_CONTAINER_DLL_remove (wdr_head,
wdr_tail,
wdr);
@@ -851,7 +917,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete wire fee #%u\n",
(unsigned int) wfr->idx);
- TALER_EXCHANGE_management_set_wire_fees_cancel (wfr->h);
+ TALER_EXCHANGE_post_management_wire_fees_cancel (wfr->h);
GNUNET_CONTAINER_DLL_remove (wfr_head,
wfr_tail,
wfr);
@@ -866,7 +932,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete global fee #%u\n",
(unsigned int) gfr->idx);
- TALER_EXCHANGE_management_set_global_fees_cancel (gfr->h);
+ TALER_EXCHANGE_post_management_global_fees_cancel (gfr->h);
GNUNET_CONTAINER_DLL_remove (gfr_head,
gfr_tail,
gfr);
@@ -896,7 +962,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete extensions signature upload #%u\n",
(unsigned int) uer->idx);
- TALER_EXCHANGE_management_post_extensions_cancel (uer->h);
+ TALER_EXCHANGE_post_management_extensions_cancel (uer->h);
GNUNET_CONTAINER_DLL_remove (uer_head,
uer_tail,
uer);
@@ -912,7 +978,7 @@ do_shutdown (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Aborting incomplete drain profits request #%u\n",
(unsigned int) dpr->idx);
- TALER_EXCHANGE_management_drain_profits_cancel (dpr->h);
+ TALER_EXCHANGE_post_management_drain_cancel (dpr->h);
GNUNET_CONTAINER_DLL_remove (dpr_head,
dpr_tail,
dpr);
@@ -1125,15 +1191,14 @@ load_offline_key (int do_create)
/**
* Function called with information about the post revocation operation result.
*
- * @param cls closure with a `struct DenomRevocationRequest`
+ * @param drr the revocation request
* @param dr response data
*/
static void
denom_revocation_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementRevokeDenominationResponse *dr)
+ struct DenomRevocationRequest *drr,
+ const struct TALER_EXCHANGE_PostManagementDenominationsRevokeResponse *dr)
{
- struct DenomRevocationRequest *drr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &dr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -1200,12 +1265,14 @@ upload_denom_revocation (const char *exchange_url,
drr = GNUNET_new (struct DenomRevocationRequest);
drr->idx = idx;
drr->h =
- TALER_EXCHANGE_management_revoke_denomination_key (ctx,
- exchange_url,
- &h_denom_pub,
- &master_sig,
- &denom_revocation_cb,
- drr);
+ TALER_EXCHANGE_post_management_denominations_revoke_create (ctx,
+ exchange_url,
+ &h_denom_pub,
+ &master_sig);
+ TALER_EXCHANGE_post_management_denominations_revoke_start (drr->h,
+ &
+ denom_revocation_cb,
+ drr);
GNUNET_CONTAINER_DLL_insert (drr_head,
drr_tail,
drr);
@@ -1215,15 +1282,14 @@ upload_denom_revocation (const char *exchange_url,
/**
* Function called with information about the post revocation operation result.
*
- * @param cls closure with a `struct SignkeyRevocationRequest`
+ * @param srr the revocation request
* @param sr response data
*/
static void
signkey_revocation_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementRevokeSigningKeyResponse *sr)
+ struct SignkeyRevocationRequest *srr,
+ const struct TALER_EXCHANGE_PostManagementSignkeysRevokeResponse *sr)
{
- struct SignkeyRevocationRequest *srr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &sr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -1290,12 +1356,13 @@ upload_signkey_revocation (const char *exchange_url,
srr = GNUNET_new (struct SignkeyRevocationRequest);
srr->idx = idx;
srr->h =
- TALER_EXCHANGE_management_revoke_signing_key (ctx,
- exchange_url,
- &exchange_pub,
- &master_sig,
- &signkey_revocation_cb,
- srr);
+ TALER_EXCHANGE_post_management_signkeys_revoke_create (ctx,
+ exchange_url,
+ &exchange_pub,
+ &master_sig);
+ TALER_EXCHANGE_post_management_signkeys_revoke_start (srr->h,
+ &signkey_revocation_cb,
+ srr);
GNUNET_CONTAINER_DLL_insert (srr_head,
srr_tail,
srr);
@@ -1305,15 +1372,14 @@ upload_signkey_revocation (const char *exchange_url,
/**
* Function called with information about the post auditor add operation result.
*
- * @param cls closure with a `struct AuditorAddRequest`
+ * @param aar the auditor add request
* @param mer response data
*/
static void
auditor_add_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementAuditorEnableResponse *mer)
+ struct AuditorAddRequest *aar,
+ const struct TALER_EXCHANGE_PostManagementAuditorsResponse *mer)
{
- struct AuditorAddRequest *aar = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &mer->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -1389,15 +1455,16 @@ upload_auditor_add (const char *exchange_url,
aar = GNUNET_new (struct AuditorAddRequest);
aar->idx = idx;
aar->h =
- TALER_EXCHANGE_management_enable_auditor (ctx,
- exchange_url,
- &auditor_pub,
- auditor_url,
- auditor_name,
- start_time,
- &master_sig,
- &auditor_add_cb,
- aar);
+ TALER_EXCHANGE_post_management_auditors_create (ctx,
+ exchange_url,
+ &auditor_pub,
+ auditor_url,
+ auditor_name,
+ start_time,
+ &master_sig);
+ TALER_EXCHANGE_post_management_auditors_start (aar->h,
+ &auditor_add_cb,
+ aar);
GNUNET_CONTAINER_DLL_insert (aar_head,
aar_tail,
aar);
@@ -1407,15 +1474,14 @@ upload_auditor_add (const char *exchange_url,
/**
* Function called with information about the post auditor del operation result.
*
- * @param cls closure with a `struct AuditorDelRequest`
+ * @param adr auditor delete request
* @param mdr response data
*/
static void
-auditor_del_cb (void *cls,
- const struct
- TALER_EXCHANGE_ManagementAuditorDisableResponse *mdr)
+auditor_del_cb (
+ struct AuditorDelRequest *adr,
+ const struct TALER_EXCHANGE_PostManagementAuditorsDisableResponse *mdr)
{
- struct AuditorDelRequest *adr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &mdr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -1485,13 +1551,14 @@ upload_auditor_del (const char *exchange_url,
adr = GNUNET_new (struct AuditorDelRequest);
adr->idx = idx;
adr->h =
- TALER_EXCHANGE_management_disable_auditor (ctx,
- exchange_url,
- &auditor_pub,
- end_time,
- &master_sig,
- &auditor_del_cb,
- adr);
+ TALER_EXCHANGE_post_management_auditors_disable_create (ctx,
+ exchange_url,
+ &auditor_pub,
+ end_time,
+ &master_sig);
+ TALER_EXCHANGE_post_management_auditors_disable_start (adr->h,
+ &auditor_del_cb,
+ adr);
GNUNET_CONTAINER_DLL_insert (adr_head,
adr_tail,
adr);
@@ -1501,14 +1568,14 @@ upload_auditor_del (const char *exchange_url,
/**
* Function called with information about the post wire add operation result.
*
- * @param cls closure with a `struct WireAddRequest`
+ * @param war the wire add request
* @param wer response data
*/
static void
-wire_add_cb (void *cls,
- const struct TALER_EXCHANGE_ManagementWireEnableResponse *wer)
+wire_add_cb (
+ struct WireAddRequest *war,
+ const struct TALER_EXCHANGE_PostManagementWireResponse *wer)
{
- struct WireAddRequest *war = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &wer->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -1629,19 +1696,22 @@ upload_wire_add (const char *exchange_url,
war = GNUNET_new (struct WireAddRequest);
war->idx = idx;
war->h =
- TALER_EXCHANGE_management_enable_wire (ctx,
- exchange_url,
- payto_uri,
- conversion_url,
- debit_restrictions,
- credit_restrictions,
- start_time,
- &master_sig_add,
- &master_sig_wire,
- bank_label,
- priority,
- &wire_add_cb,
- war);
+ TALER_EXCHANGE_post_management_wire_create (ctx,
+ exchange_url,
+ payto_uri,
+ conversion_url,
+ debit_restrictions,
+ credit_restrictions,
+ start_time,
+ &master_sig_add,
+ &master_sig_wire);
+ TALER_EXCHANGE_post_management_wire_set_options (
+ war->h,
+ TALER_EXCHANGE_post_management_wire_option_bank_label (bank_label),
+ TALER_EXCHANGE_post_management_wire_option_priority (priority));
+ TALER_EXCHANGE_post_management_wire_start (war->h,
+ &wire_add_cb,
+ war);
GNUNET_CONTAINER_DLL_insert (war_head,
war_tail,
war);
@@ -1651,14 +1721,14 @@ upload_wire_add (const char *exchange_url,
/**
* Function called with information about the post wire del operation result.
*
- * @param cls closure with a `struct WireDelRequest`
+ * @param wdr request to delete wire account
* @param wdres response data
*/
static void
-wire_del_cb (void *cls,
- const struct TALER_EXCHANGE_ManagementWireDisableResponse *wdres)
+wire_del_cb (
+ struct WireDelRequest *wdr,
+ const struct TALER_EXCHANGE_PostManagementWireDisableResponse *wdres)
{
- struct WireDelRequest *wdr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &wdres->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -1728,13 +1798,14 @@ upload_wire_del (const char *exchange_url,
wdr = GNUNET_new (struct WireDelRequest);
wdr->idx = idx;
wdr->h =
- TALER_EXCHANGE_management_disable_wire (ctx,
- exchange_url,
- payto_uri,
- end_time,
- &master_sig,
- &wire_del_cb,
- wdr);
+ TALER_EXCHANGE_post_management_wire_disable_create (ctx,
+ exchange_url,
+ payto_uri,
+ end_time,
+ &master_sig);
+ TALER_EXCHANGE_post_management_wire_disable_start (wdr->h,
+ &wire_del_cb,
+ wdr);
GNUNET_CONTAINER_DLL_insert (wdr_head,
wdr_tail,
wdr);
@@ -1744,15 +1815,14 @@ upload_wire_del (const char *exchange_url,
/**
* Function called with information about the post wire fee operation result.
*
- * @param cls closure with a `struct WireFeeRequest`
+ * @param wfr the wire fee request
* @param swr response data
*/
static void
wire_fee_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementSetWireFeeResponse *swr)
+ struct WireFeeRequest *wfr,
+ const struct TALER_EXCHANGE_PostManagementWireFeesResponse *swr)
{
- struct WireFeeRequest *wfr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &swr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -1832,15 +1902,16 @@ upload_wire_fee (const char *exchange_url,
wfr = GNUNET_new (struct WireFeeRequest);
wfr->idx = idx;
wfr->h =
- TALER_EXCHANGE_management_set_wire_fees (ctx,
- exchange_url,
- wire_method,
- start_time,
- end_time,
- &fees,
- &master_sig,
- &wire_fee_cb,
- wfr);
+ TALER_EXCHANGE_post_management_wire_fees_create (ctx,
+ exchange_url,
+ wire_method,
+ start_time,
+ end_time,
+ &fees,
+ &master_sig);
+ TALER_EXCHANGE_post_management_wire_fees_start (wfr->h,
+ &wire_fee_cb,
+ wfr);
GNUNET_CONTAINER_DLL_insert (wfr_head,
wfr_tail,
wfr);
@@ -1850,15 +1921,14 @@ upload_wire_fee (const char *exchange_url,
/**
* Function called with information about the post global fee operation result.
*
- * @param cls closure with a `struct WireFeeRequest`
+ * @param gfr the global fee request
* @param gr response data
*/
static void
global_fee_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse *gr)
+ struct GlobalFeeRequest *gfr,
+ const struct TALER_EXCHANGE_PostManagementGlobalFeesResponse *gr)
{
- struct GlobalFeeRequest *gfr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &gr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -1947,17 +2017,18 @@ upload_global_fee (const char *exchange_url,
gfr = GNUNET_new (struct GlobalFeeRequest);
gfr->idx = idx;
gfr->h =
- TALER_EXCHANGE_management_set_global_fees (ctx,
- exchange_url,
- start_time,
- end_time,
- &fees,
- purse_timeout,
- history_expiration,
- purse_account_limit,
- &master_sig,
- &global_fee_cb,
- gfr);
+ TALER_EXCHANGE_post_management_global_fees_create (ctx,
+ exchange_url,
+ start_time,
+ end_time,
+ &fees,
+ purse_timeout,
+ history_expiration,
+ purse_account_limit,
+ &master_sig);
+ TALER_EXCHANGE_post_management_global_fees_start (gfr->h,
+ &global_fee_cb,
+ gfr);
GNUNET_CONTAINER_DLL_insert (gfr_head,
gfr_tail,
gfr);
@@ -1967,15 +2038,14 @@ upload_global_fee (const char *exchange_url,
/**
* Function called with information about the drain profits operation.
*
- * @param cls closure with a `struct DrainProfitsRequest`
+ * @param dpr the drain profits request
* @param mdr response data
*/
static void
drain_profits_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementDrainResponse *mdr)
+ struct DrainProfitsRequest *dpr,
+ const struct TALER_EXCHANGE_PostManagementDrainResponse *mdr)
{
- struct DrainProfitsRequest *dpr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &mdr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -2055,16 +2125,17 @@ upload_drain (const char *exchange_url,
dpr = GNUNET_new (struct DrainProfitsRequest);
dpr->idx = idx;
dpr->h =
- TALER_EXCHANGE_management_drain_profits (ctx,
- exchange_url,
- &wtid,
- &amount,
- date,
- account_section,
- payto_uri,
- &master_sig,
- &drain_profits_cb,
- dpr);
+ TALER_EXCHANGE_post_management_drain_create (ctx,
+ exchange_url,
+ &wtid,
+ &amount,
+ date,
+ account_section,
+ payto_uri,
+ &master_sig);
+ TALER_EXCHANGE_post_management_drain_start (dpr->h,
+ &drain_profits_cb,
+ dpr);
GNUNET_CONTAINER_DLL_insert (dpr_head,
dpr_tail,
dpr);
@@ -2074,15 +2145,14 @@ upload_drain (const char *exchange_url,
/**
* Function called with information about the post upload keys operation result.
*
- * @param cls closure with a `struct UploadKeysRequest`
+ * @param ukr the upload keys request
* @param mr response data
*/
static void
keys_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementPostKeysResponse *mr)
+ struct UploadKeysRequest *ukr,
+ const struct TALER_EXCHANGE_PostManagementKeysResponse *mr)
{
- struct UploadKeysRequest *ukr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &mr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -2225,11 +2295,12 @@ upload_keys (const char *exchange_url,
ukr = GNUNET_new (struct UploadKeysRequest);
ukr->idx = idx;
ukr->h =
- TALER_EXCHANGE_post_management_keys (ctx,
- exchange_url,
- &pkd,
- &keys_cb,
- ukr);
+ TALER_EXCHANGE_post_management_keys_create (ctx,
+ exchange_url,
+ &pkd);
+ TALER_EXCHANGE_post_management_keys_start (ukr->h,
+ &keys_cb,
+ ukr);
GNUNET_CONTAINER_DLL_insert (ukr_head,
ukr_tail,
ukr);
@@ -2247,15 +2318,14 @@ upload_keys (const char *exchange_url,
/**
* Function called with information about the post upload extensions operation result.
*
- * @param cls closure with a `struct UploadExtensionsRequest`
+ * @param uer extension upload request
* @param er response data
*/
static void
extensions_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementPostExtensionsResponse *er)
+ struct UploadExtensionsRequest *uer,
+ const struct TALER_EXCHANGE_PostManagementExtensionsResponse *er)
{
- struct UploadExtensionsRequest *uer = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &er->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -2362,12 +2432,13 @@ upload_extensions (const char *exchange_url,
= GNUNET_new (struct UploadExtensionsRequest);
uer->idx = idx;
- uer->h = TALER_EXCHANGE_management_post_extensions (
+ uer->h = TALER_EXCHANGE_post_management_extensions_create (
ctx,
exchange_url,
- &ped,
- &extensions_cb,
- uer);
+ &ped);
+ TALER_EXCHANGE_post_management_extensions_start (uer->h,
+ &extensions_cb,
+ uer);
GNUNET_CONTAINER_DLL_insert (uer_head,
uer_tail,
uer);
@@ -2378,15 +2449,14 @@ upload_extensions (const char *exchange_url,
/**
* Function called with information about the add partner operation.
*
- * @param cls closure with a `struct PartnerAddRequest`
+ * @param par the request
* @param apr response data
*/
static void
add_partner_cb (
- void *cls,
- const struct TALER_EXCHANGE_ManagementAddPartnerResponse *apr)
+ struct PartnerAddRequest *par,
+ const struct TALER_EXCHANGE_PostManagementPartnersResponse *apr)
{
- struct PartnerAddRequest *par = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &apr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status)
@@ -2469,17 +2539,18 @@ add_partner (const char *exchange_url,
par = GNUNET_new (struct PartnerAddRequest);
par->idx = idx;
par->h =
- TALER_EXCHANGE_management_add_partner (ctx,
- exchange_url,
- &partner_pub,
- start_date,
- end_date,
- wad_frequency,
- &wad_fee,
- partner_base_url,
- &master_sig,
- &add_partner_cb,
- par);
+ TALER_EXCHANGE_post_management_partners_create (ctx,
+ exchange_url,
+ &partner_pub,
+ start_date,
+ end_date,
+ wad_frequency,
+ &wad_fee,
+ partner_base_url,
+ &master_sig);
+ TALER_EXCHANGE_post_management_partners_start (par->h,
+ &add_partner_cb,
+ par);
GNUNET_CONTAINER_DLL_insert (par_head,
par_tail,
par);
@@ -3960,14 +4031,13 @@ enable_aml_staff (char *const *args)
* (on success), either into an internal buffer or to stdout (depending on
* whether there are subsequent commands).
*
- * @param cls closure with the `char **` remaining args
+ * @param args the remaining args
* @param mgr response data
*/
static void
-download_cb (void *cls,
- const struct TALER_EXCHANGE_ManagementGetKeysResponse *mgr)
+download_cb (char *const *args,
+ const struct TALER_EXCHANGE_GetManagementKeysResponse *mgr)
{
- char *const *args = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &mgr->hr;
mgkh = NULL;
@@ -4030,10 +4100,11 @@ do_download (char *const *args)
global_ret = EXIT_NOTCONFIGURED;
return;
}
- mgkh = TALER_EXCHANGE_get_management_keys (ctx,
- CFG_exchange_url,
- &download_cb,
- (void *) args);
+ mgkh = TALER_EXCHANGE_get_management_keys_create (ctx,
+ CFG_exchange_url);
+ TALER_EXCHANGE_get_management_keys_start (mgkh,
+ &download_cb,
+ (void *) args);
}
diff --git a/src/include/taler/taler-exchange/get-management-keys.h b/src/include/taler/taler-exchange/get-management-keys.h
@@ -204,7 +204,6 @@ struct TALER_EXCHANGE_GetManagementKeysResponse
};
-
#ifndef TALER_EXCHANGE_GET_MANAGEMENT_KEYS_RESULT_CLOSURE
/**
* Type of the closure used by
@@ -268,44 +267,4 @@ TALER_EXCHANGE_get_management_keys_cancel (
struct TALER_EXCHANGE_GetManagementKeysHandle *gmkh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_GetManagementKeysResponse instead.
- */
-struct TALER_EXCHANGE_ManagementGetKeysResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
- union
- {
- struct
- {
- struct TALER_EXCHANGE_FutureKeys keys;
- } ok;
- } details;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_GetManagementKeysCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementGetKeysCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementGetKeysResponse *mgr);
-
-
-/**
- * @deprecated
- */
-struct TALER_EXCHANGE_GetManagementKeysHandle *
-TALER_EXCHANGE_get_management_keys (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- TALER_EXCHANGE_ManagementGetKeysCallback cb,
- void *cb_cls);
-
-/* Note: cancel uses TALER_EXCHANGE_get_management_keys_cancel() declared above. */
-
-
#endif /* _TALER_EXCHANGE__GET_MANAGEMENT_KEYS_H */
diff --git a/src/include/taler/taler-exchange/post-management-auditors-AUDITOR_PUB-disable.h b/src/include/taler/taler-exchange/post-management-auditors-AUDITOR_PUB-disable.h
@@ -110,50 +110,5 @@ TALER_EXCHANGE_post_management_auditors_disable_cancel (
struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle *pmadh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementAuditorsDisableResponse instead.
- */
-struct TALER_EXCHANGE_ManagementAuditorDisableResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementAuditorsDisableCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementAuditorDisableCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementAuditorDisableResponse *adr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementAuditorsDisableHandle instead.
- */
-struct TALER_EXCHANGE_ManagementAuditorDisableHandle;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_auditors_disable_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementAuditorDisableHandle *
-TALER_EXCHANGE_management_disable_auditor (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- const struct TALER_AuditorPublicKeyP *auditor_pub,
- struct GNUNET_TIME_Timestamp validity_end,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementAuditorDisableCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_auditors_disable_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_disable_auditor_cancel (
- struct TALER_EXCHANGE_ManagementAuditorDisableHandle *ah);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_AUDITORS_AUDITOR_PUB_DISABLE_H */
diff --git a/src/include/taler/taler-exchange/post-management-auditors.h b/src/include/taler/taler-exchange/post-management-auditors.h
@@ -114,52 +114,5 @@ TALER_EXCHANGE_post_management_auditors_cancel (
struct TALER_EXCHANGE_PostManagementAuditorsHandle *pmah);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementAuditorsResponse instead.
- */
-struct TALER_EXCHANGE_ManagementAuditorEnableResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementAuditorsCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementAuditorEnableCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementAuditorEnableResponse *r);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementAuditorsHandle instead.
- */
-struct TALER_EXCHANGE_ManagementAuditorEnableHandle;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_auditors_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementAuditorEnableHandle *
-TALER_EXCHANGE_management_enable_auditor (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- const struct TALER_AuditorPublicKeyP *auditor_pub,
- const char *auditor_url,
- const char *auditor_name,
- struct GNUNET_TIME_Timestamp validity_start,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementAuditorEnableCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_auditors_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_enable_auditor_cancel (
- struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_AUDITORS_H */
diff --git a/src/include/taler/taler-exchange/post-management-denominations-H_DENOM_PUB-revoke.h b/src/include/taler/taler-exchange/post-management-denominations-H_DENOM_PUB-revoke.h
@@ -111,51 +111,5 @@ TALER_EXCHANGE_post_management_denominations_revoke_cancel (
struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *pmdrh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementDenominationsRevokeResponse instead.
- */
-struct TALER_EXCHANGE_ManagementRevokeDenominationResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementDenominationsRevokeCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementRevokeDenominationResponse *hr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementDenominationsRevokeHandle instead.
- */
-struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle;
-
-/**
- * @deprecated Use
- * #TALER_EXCHANGE_post_management_denominations_revoke_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *
-TALER_EXCHANGE_management_revoke_denomination_key (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- const struct TALER_DenominationHashP *h_denom_pub,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use
- * #TALER_EXCHANGE_post_management_denominations_revoke_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_revoke_denomination_key_cancel (
- struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *rh);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_DENOMINATIONS_H_DENOM_PUB_REVOKE_H */
diff --git a/src/include/taler/taler-exchange/post-management-drain.h b/src/include/taler/taler-exchange/post-management-drain.h
@@ -116,53 +116,5 @@ TALER_EXCHANGE_post_management_drain_cancel (
struct TALER_EXCHANGE_PostManagementDrainHandle *pmdh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementDrainResponse instead.
- */
-struct TALER_EXCHANGE_ManagementDrainResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementDrainCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementDrainProfitsCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementDrainResponse *hr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementDrainHandle instead.
- */
-struct TALER_EXCHANGE_ManagementDrainProfitsHandle;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_drain_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementDrainProfitsHandle *
-TALER_EXCHANGE_management_drain_profits (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- const struct TALER_WireTransferIdentifierRawP *wtid,
- const struct TALER_Amount *amount,
- struct GNUNET_TIME_Timestamp date,
- const char *account_section,
- const struct TALER_FullPayto payto_uri,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementDrainProfitsCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_drain_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_drain_profits_cancel (
- struct TALER_EXCHANGE_ManagementDrainProfitsHandle *dp);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_DRAIN_H */
diff --git a/src/include/taler/taler-exchange/post-management-extensions.h b/src/include/taler/taler-exchange/post-management-extensions.h
@@ -119,48 +119,5 @@ TALER_EXCHANGE_post_management_extensions_cancel (
struct TALER_EXCHANGE_PostManagementExtensionsHandle *pmeh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementExtensionsResponse instead.
- */
-struct TALER_EXCHANGE_ManagementPostExtensionsResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementExtensionsCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementPostExtensionsCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementPostExtensionsResponse *hr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementExtensionsHandle instead.
- */
-struct TALER_EXCHANGE_ManagementPostExtensionsHandle;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_extensions_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementPostExtensionsHandle *
-TALER_EXCHANGE_management_post_extensions (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- const struct TALER_EXCHANGE_ManagementPostExtensionsData *ped,
- TALER_EXCHANGE_ManagementPostExtensionsCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_extensions_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_post_extensions_cancel (
- struct TALER_EXCHANGE_ManagementPostExtensionsHandle *ph);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_EXTENSIONS_H */
diff --git a/src/include/taler/taler-exchange/post-management-global-fees.h b/src/include/taler/taler-exchange/post-management-global-fees.h
@@ -119,54 +119,5 @@ TALER_EXCHANGE_post_management_global_fees_cancel (
struct TALER_EXCHANGE_PostManagementGlobalFeesHandle *pmgfh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementGlobalFeesResponse instead.
- */
-struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementGlobalFeesCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementSetGlobalFeeCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse *gfr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementGlobalFeesHandle instead.
- */
-struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_global_fees_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *
-TALER_EXCHANGE_management_set_global_fees (
- struct GNUNET_CURL_Context *ctx,
- const char *exchange_base_url,
- struct GNUNET_TIME_Timestamp validity_start,
- struct GNUNET_TIME_Timestamp validity_end,
- const struct TALER_GlobalFeeSet *fees,
- struct GNUNET_TIME_Relative purse_timeout,
- struct GNUNET_TIME_Relative history_expiration,
- uint32_t purse_account_limit,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementSetGlobalFeeCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_global_fees_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_set_global_fees_cancel (
- struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_GLOBAL_FEES_H */
diff --git a/src/include/taler/taler-exchange/post-management-keys.h b/src/include/taler/taler-exchange/post-management-keys.h
@@ -95,8 +95,6 @@ struct TALER_EXCHANGE_ManagementPostKeysData
struct TALER_EXCHANGE_PostManagementKeysHandle;
-#if NEW_API
-
/**
* Set up POST /management/keys operation.
@@ -174,49 +172,5 @@ void
TALER_EXCHANGE_post_management_keys_cancel (
struct TALER_EXCHANGE_PostManagementKeysHandle *pmkh);
-#endif
-
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated
- */
-struct TALER_EXCHANGE_ManagementPostKeysResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated
- */
-typedef void
-(*TALER_EXCHANGE_ManagementPostKeysCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementPostKeysResponse *mr);
-
-/**
- * @deprecated
- */
-struct TALER_EXCHANGE_ManagementPostKeysHandle;
-
-/**
- * @deprecated
- */
-struct TALER_EXCHANGE_ManagementPostKeysHandle *
-TALER_EXCHANGE_post_management_keys (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- const struct TALER_EXCHANGE_ManagementPostKeysData *pkd,
- TALER_EXCHANGE_ManagementPostKeysCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated
- */
-void
-TALER_EXCHANGE_post_management_keys_cancel (
- struct TALER_EXCHANGE_ManagementPostKeysHandle *ph);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_KEYS_H */
diff --git a/src/include/taler/taler-exchange/post-management-partners.h b/src/include/taler/taler-exchange/post-management-partners.h
@@ -118,54 +118,5 @@ TALER_EXCHANGE_post_management_partners_cancel (
struct TALER_EXCHANGE_PostManagementPartnersHandle *pmph);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementPartnersResponse instead.
- */
-struct TALER_EXCHANGE_ManagementAddPartnerResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementPartnersCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementAddPartnerCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementAddPartnerResponse *apr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementPartnersHandle instead.
- */
-struct TALER_EXCHANGE_ManagementAddPartner;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_partners_create() and
- * the new API instead.
- */
-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);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_partners_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_add_partner_cancel (
- struct TALER_EXCHANGE_ManagementAddPartner *rh);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_PARTNERS_H */
diff --git a/src/include/taler/taler-exchange/post-management-signkeys-EXCHANGE_PUB-revoke.h b/src/include/taler/taler-exchange/post-management-signkeys-EXCHANGE_PUB-revoke.h
@@ -109,51 +109,5 @@ TALER_EXCHANGE_post_management_signkeys_revoke_cancel (
struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle *pmsrh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementSignkeysRevokeResponse instead.
- */
-struct TALER_EXCHANGE_ManagementRevokeSigningKeyResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementSignkeysRevokeCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementRevokeSigningKeyCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementRevokeSigningKeyResponse *hr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementSignkeysRevokeHandle instead.
- */
-struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle;
-
-/**
- * @deprecated Use
- * #TALER_EXCHANGE_post_management_signkeys_revoke_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *
-TALER_EXCHANGE_management_revoke_signing_key (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- const struct TALER_ExchangePublicKeyP *exchange_pub,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementRevokeSigningKeyCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use
- * #TALER_EXCHANGE_post_management_signkeys_revoke_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_revoke_signing_key_cancel (
- struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *rh);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_SIGNKEYS_EXCHANGE_PUB_REVOKE_H */
diff --git a/src/include/taler/taler-exchange/post-management-wire-disable.h b/src/include/taler/taler-exchange/post-management-wire-disable.h
@@ -111,50 +111,5 @@ TALER_EXCHANGE_post_management_wire_disable_cancel (
struct TALER_EXCHANGE_PostManagementWireDisableHandle *pmwdh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementWireDisableResponse instead.
- */
-struct TALER_EXCHANGE_ManagementWireDisableResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementWireDisableCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementWireDisableCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementWireDisableResponse *wdr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementWireDisableHandle instead.
- */
-struct TALER_EXCHANGE_ManagementWireDisableHandle;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_wire_disable_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementWireDisableHandle *
-TALER_EXCHANGE_management_disable_wire (
- struct GNUNET_CURL_Context *ctx,
- const char *exchange_url,
- const struct TALER_FullPayto payto_uri,
- struct GNUNET_TIME_Timestamp validity_end,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementWireDisableCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_wire_disable_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_disable_wire_cancel (
- struct TALER_EXCHANGE_ManagementWireDisableHandle *wh);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_WIRE_DISABLE_H */
diff --git a/src/include/taler/taler-exchange/post-management-wire-fee.h b/src/include/taler/taler-exchange/post-management-wire-fee.h
@@ -115,52 +115,5 @@ TALER_EXCHANGE_post_management_wire_fees_cancel (
struct TALER_EXCHANGE_PostManagementWireFeesHandle *pmwfh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementWireFeesResponse instead.
- */
-struct TALER_EXCHANGE_ManagementSetWireFeeResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementWireFeesCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementSetWireFeeCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementSetWireFeeResponse *wfr);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementWireFeesHandle instead.
- */
-struct TALER_EXCHANGE_ManagementSetWireFeeHandle;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_wire_fees_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementSetWireFeeHandle *
-TALER_EXCHANGE_management_set_wire_fees (
- struct GNUNET_CURL_Context *ctx,
- const char *exchange_base_url,
- const char *wire_method,
- struct GNUNET_TIME_Timestamp validity_start,
- struct GNUNET_TIME_Timestamp validity_end,
- const struct TALER_WireFeeSet *fees,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementSetWireFeeCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_wire_fees_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_set_wire_fees_cancel (
- struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh);
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_WIRE_FEE_H */
diff --git a/src/include/taler/taler-exchange/post-management-wire.h b/src/include/taler/taler-exchange/post-management-wire.h
@@ -163,7 +163,9 @@ TALER_EXCHANGE_post_management_wire_create (
*
* @param pmwh the request to set the options for
* @param num_options length of the @a options array
- * @param options an array of options
+ * @param options an array of options of length @a num_array,
+ * or alternatively terminated by
+ * TALER_EXCHANGE_post_management_wire_option_end_()
* @return #GNUNET_OK on success,
* #GNUNET_NO on failure,
* #GNUNET_SYSERR on internal error
@@ -172,8 +174,7 @@ enum GNUNET_GenericReturnValue
TALER_EXCHANGE_post_management_wire_set_options_ (
struct TALER_EXCHANGE_PostManagementWireHandle *pmwh,
unsigned int num_options,
- struct TALER_EXCHANGE_PostManagementWireOptionValue options[
- static num_options]);
+ const struct TALER_EXCHANGE_PostManagementWireOptionValue options[]);
/**
@@ -259,56 +260,4 @@ TALER_EXCHANGE_post_management_wire_cancel (
struct TALER_EXCHANGE_PostManagementWireHandle *pmwh);
-/* **************** deprecated legacy API ***************** */
-
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementWireResponse instead.
- */
-struct TALER_EXCHANGE_ManagementWireEnableResponse
-{
- struct TALER_EXCHANGE_HttpResponse hr;
-};
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementWireCallback instead.
- */
-typedef void
-(*TALER_EXCHANGE_ManagementWireEnableCallback) (
- void *cls,
- const struct TALER_EXCHANGE_ManagementWireEnableResponse *wer);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_PostManagementWireHandle instead.
- */
-struct TALER_EXCHANGE_ManagementWireEnableHandle;
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_wire_create() and
- * the new API instead.
- */
-struct TALER_EXCHANGE_ManagementWireEnableHandle *
-TALER_EXCHANGE_management_enable_wire (
- struct GNUNET_CURL_Context *ctx,
- const char *url,
- const struct TALER_FullPayto payto_uri,
- const char *conversion_url,
- const json_t *debit_restrictions,
- const json_t *credit_restrictions,
- struct GNUNET_TIME_Timestamp validity_start,
- const struct TALER_MasterSignatureP *master_sig1,
- const struct TALER_MasterSignatureP *master_sig2,
- const char *bank_label,
- int64_t priority,
- TALER_EXCHANGE_ManagementWireEnableCallback cb,
- void *cb_cls);
-
-/**
- * @deprecated Use #TALER_EXCHANGE_post_management_wire_cancel() instead.
- */
-void
-TALER_EXCHANGE_management_enable_wire_cancel (
- struct TALER_EXCHANGE_ManagementWireEnableHandle *wh);
-
-
#endif /* _TALER_EXCHANGE__POST_MANAGEMENT_WIRE_H */
diff --git a/src/lib/exchange_api_get-management-keys.c b/src/lib/exchange_api_get-management-keys.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2023 Taler Systems SA
+ Copyright (C) 2015-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
@@ -24,11 +24,11 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/get-management-keys.h"
#include "exchange_api_curl_defaults.h"
#include "taler/taler_signatures.h"
#include "taler/taler_curl_lib.h"
#include "taler/taler_util.h"
-#include "taler/taler_json_lib.h"
/**
* Set to 1 for extra debug logging.
@@ -43,7 +43,12 @@ struct TALER_EXCHANGE_GetManagementKeysHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -55,32 +60,33 @@ struct TALER_EXCHANGE_GetManagementKeysHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementGetKeysCallback cb;
+ TALER_EXCHANGE_GetManagementKeysCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_GET_MANAGEMENT_KEYS_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
};
/**
* Handle the case that the response was of type #MHD_HTTP_OK.
*
- * @param[in,out] gh request handle
+ * @param[in,out] gmkh request handle
* @param response the response
* @return #GNUNET_OK if the response was well-formed
*/
static enum GNUNET_GenericReturnValue
-handle_ok (struct TALER_EXCHANGE_GetManagementKeysHandle *gh,
+handle_ok (struct TALER_EXCHANGE_GetManagementKeysHandle *gmkh,
const json_t *response)
{
- struct TALER_EXCHANGE_ManagementGetKeysResponse gkr = {
+ struct TALER_EXCHANGE_GetManagementKeysResponse gkr = {
.hr.http_status = MHD_HTTP_OK,
.hr.reply = response,
};
@@ -122,7 +128,7 @@ handle_ok (struct TALER_EXCHANGE_GetManagementKeysHandle *gh,
fk->num_denom_keys,
struct TALER_EXCHANGE_FutureDenomPublicKey);
ok = true;
- for (unsigned int i = 0; i<fk->num_sign_keys; i++)
+ for (unsigned int i = 0; i < fk->num_sign_keys; i++)
{
json_t *j = json_array_get (sk,
i);
@@ -170,7 +176,7 @@ handle_ok (struct TALER_EXCHANGE_GetManagementKeysHandle *gh,
}
}
}
- for (unsigned int i = 0; i<fk->num_denom_keys; i++)
+ for (unsigned int i = 0; i < fk->num_denom_keys; i++)
{
json_t *j = json_array_get (dk,
i);
@@ -284,10 +290,10 @@ handle_ok (struct TALER_EXCHANGE_GetManagementKeysHandle *gh,
}
if (ok)
{
- gh->cb (gh->cb_cls,
- &gkr);
+ gmkh->cb (gmkh->cb_cls,
+ &gkr);
}
- for (unsigned int i = 0; i<fk->num_denom_keys; i++)
+ for (unsigned int i = 0; i < fk->num_denom_keys; i++)
TALER_denom_pub_free (&fk->denom_keys[i].key);
GNUNET_free (fk->sign_keys);
GNUNET_free (fk->denom_keys);
@@ -299,7 +305,7 @@ handle_ok (struct TALER_EXCHANGE_GetManagementKeysHandle *gh,
* Function called when we're done processing the
* HTTP GET /management/keys request.
*
- * @param cls the `struct TALER_EXCHANGE_GetManagementKeysHandle *`
+ * @param cls the `struct TALER_EXCHANGE_GetManagementKeysHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
@@ -308,22 +314,22 @@ handle_get_keys_finished (void *cls,
long response_code,
const void *response)
{
- struct TALER_EXCHANGE_GetManagementKeysHandle *gh = cls;
+ struct TALER_EXCHANGE_GetManagementKeysHandle *gmkh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementGetKeysResponse gkr = {
+ struct TALER_EXCHANGE_GetManagementKeysResponse gkr = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- gh->job = NULL;
+ gmkh->job = NULL;
switch (response_code)
{
case MHD_HTTP_OK:
if (GNUNET_OK ==
- handle_ok (gh,
+ handle_ok (gmkh,
response))
{
- gh->cb = NULL;
+ gmkh->cb = NULL;
}
else
{
@@ -333,7 +339,7 @@ handle_get_keys_finished (void *cls,
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",
- gh->url);
+ gmkh->url);
if (NULL != json)
{
gkr.hr.ec = TALER_JSON_get_error_code (json);
@@ -363,65 +369,80 @@ handle_get_keys_finished (void *cls,
(int) gkr.hr.ec);
break;
}
- if (NULL != gh->cb)
+ if (NULL != gmkh->cb)
{
- gh->cb (gh->cb_cls,
- &gkr);
- gh->cb = NULL;
+ gmkh->cb (gmkh->cb_cls,
+ &gkr);
+ gmkh->cb = NULL;
}
- TALER_EXCHANGE_get_management_keys_cancel (gh);
-};
+ TALER_EXCHANGE_get_management_keys_cancel (gmkh);
+}
struct TALER_EXCHANGE_GetManagementKeysHandle *
-TALER_EXCHANGE_get_management_keys (struct GNUNET_CURL_Context *ctx,
- const char *url,
- TALER_EXCHANGE_ManagementGetKeysCallback cb,
- void *cb_cls)
+TALER_EXCHANGE_get_management_keys_create (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url)
+{
+ struct TALER_EXCHANGE_GetManagementKeysHandle *gmkh;
+
+ gmkh = GNUNET_new (struct TALER_EXCHANGE_GetManagementKeysHandle);
+ gmkh->ctx = ctx;
+ gmkh->base_url = GNUNET_strdup (url);
+ return gmkh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_get_management_keys_start (
+ struct TALER_EXCHANGE_GetManagementKeysHandle *gmkh,
+ TALER_EXCHANGE_GetManagementKeysCallback cb,
+ TALER_EXCHANGE_GET_MANAGEMENT_KEYS_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_GetManagementKeysHandle *gh;
CURL *eh;
- gh = GNUNET_new (struct TALER_EXCHANGE_GetManagementKeysHandle);
- gh->cb = cb;
- gh->cb_cls = cb_cls;
- gh->ctx = ctx;
- gh->url = TALER_url_join (url,
- "management/keys",
- NULL);
- if (NULL == gh->url)
+ gmkh->cb = cb;
+ gmkh->cb_cls = cb_cls;
+ gmkh->url = TALER_url_join (gmkh->base_url,
+ "management/keys",
+ NULL);
+ if (NULL == gmkh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (gh);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
- eh = TALER_EXCHANGE_curl_easy_get_ (gh->url);
+ eh = TALER_EXCHANGE_curl_easy_get_ (gmkh->url);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
- gh->url);
- gh->job = GNUNET_CURL_job_add (ctx,
- eh,
- &handle_get_keys_finished,
- gh);
- if (NULL == gh->job)
+ gmkh->url);
+ gmkh->job = GNUNET_CURL_job_add (gmkh->ctx,
+ eh,
+ &handle_get_keys_finished,
+ gmkh);
+ if (NULL == gmkh->job)
{
- TALER_EXCHANGE_get_management_keys_cancel (gh);
- return NULL;
+ GNUNET_free (gmkh->url);
+ gmkh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return gh;
+ return TALER_EC_NONE;
}
void
TALER_EXCHANGE_get_management_keys_cancel (
- struct TALER_EXCHANGE_GetManagementKeysHandle *gh)
+ struct TALER_EXCHANGE_GetManagementKeysHandle *gmkh)
{
- if (NULL != gh->job)
+ if (NULL != gmkh->job)
{
- GNUNET_CURL_job_cancel (gh->job);
- gh->job = NULL;
+ GNUNET_CURL_job_cancel (gmkh->job);
+ gmkh->job = NULL;
}
- GNUNET_free (gh->url);
- GNUNET_free (gh);
+ GNUNET_free (gmkh->url);
+ GNUNET_free (gmkh->base_url);
+ GNUNET_free (gmkh);
}
+
+
+/* end of exchange_api_get-management-keys.c */
diff --git a/src/lib/exchange_api_post-management-auditors-AUDITOR_PUB-disable.c b/src/lib/exchange_api_post-management-auditors-AUDITOR_PUB-disable.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2021 Taler Systems SA
+ Copyright (C) 2015-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
@@ -24,19 +24,25 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-auditors-AUDITOR_PUB-disable.h"
#include "exchange_api_curl_defaults.h"
#include "taler/taler_signatures.h"
#include "taler/taler_curl_lib.h"
-#include "taler/taler_json_lib.h"
+
/**
* @brief Handle for a POST /management/auditors/$AUDITOR_PUB/disable request.
*/
-struct TALER_EXCHANGE_ManagementAuditorDisableHandle
+struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -53,103 +59,133 @@ struct TALER_EXCHANGE_ManagementAuditorDisableHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementAuditorDisableCallback cb;
+ TALER_EXCHANGE_PostManagementAuditorsDisableCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_AUDITORS_DISABLE_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Public signing key of the auditor.
+ */
+ struct TALER_AuditorPublicKeyP auditor_pub;
+
+ /**
+ * When was this decided?
+ */
+ struct GNUNET_TIME_Timestamp validity_end;
+
+ /**
+ * Signature affirming the auditor disablement.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
};
/**
* Function called when we're done processing the
- * HTTP /management/auditors/%s/disable request.
+ * HTTP POST /management/auditors/$AUDITOR_PUB/disable request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementAuditorDisableHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle`
* @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_auditors_disable_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementAuditorDisableHandle *ah = cls;
+ struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle *pmadh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementAuditorDisableResponse adr = {
+ struct TALER_EXCHANGE_PostManagementAuditorsDisableResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- ah->job = NULL;
+ pmadh->job = NULL;
switch (response_code)
{
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- adr.hr.ec = TALER_JSON_get_error_code (json);
- adr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_NOT_FOUND:
- adr.hr.ec = TALER_JSON_get_error_code (json);
- adr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_CONFLICT:
- adr.hr.ec = TALER_JSON_get_error_code (json);
- adr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- adr.hr.ec = TALER_JSON_get_error_code (json);
- adr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management auditor disable\n",
(unsigned int) response_code,
- (int) adr.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != ah->cb)
+ if (NULL != pmadh->cb)
{
- ah->cb (ah->cb_cls,
- &adr);
- ah->cb = NULL;
+ pmadh->cb (pmadh->cb_cls,
+ &res);
+ pmadh->cb = NULL;
}
- TALER_EXCHANGE_management_disable_auditor_cancel (ah);
+ TALER_EXCHANGE_post_management_auditors_disable_cancel (pmadh);
}
-struct TALER_EXCHANGE_ManagementAuditorDisableHandle *
-TALER_EXCHANGE_management_disable_auditor (
+struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle *
+TALER_EXCHANGE_post_management_auditors_disable_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_AuditorPublicKeyP *auditor_pub,
struct GNUNET_TIME_Timestamp validity_end,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementAuditorDisableCallback cb,
- void *cb_cls)
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle *pmadh;
+
+ pmadh = GNUNET_new (
+ struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle);
+ pmadh->ctx = ctx;
+ pmadh->base_url = GNUNET_strdup (url);
+ pmadh->auditor_pub = *auditor_pub;
+ pmadh->validity_end = validity_end;
+ pmadh->master_sig = *master_sig;
+ return pmadh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_auditors_disable_start (
+ struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle *pmadh,
+ TALER_EXCHANGE_PostManagementAuditorsDisableCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_AUDITORS_DISABLE_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementAuditorDisableHandle *ah;
CURL *eh;
json_t *body;
- ah = GNUNET_new (struct TALER_EXCHANGE_ManagementAuditorDisableHandle);
- ah->cb = cb;
- ah->cb_cls = cb_cls;
- ah->ctx = ctx;
+ pmadh->cb = cb;
+ pmadh->cb_cls = cb_cls;
{
- char epub_str[sizeof (*auditor_pub) * 2];
+ char epub_str[sizeof (pmadh->auditor_pub) * 2];
char arg_str[sizeof (epub_str) + 64];
char *end;
- end = GNUNET_STRINGS_data_to_string (auditor_pub,
- sizeof (*auditor_pub),
+ end = GNUNET_STRINGS_data_to_string (&pmadh->auditor_pub,
+ sizeof (pmadh->auditor_pub),
epub_str,
sizeof (epub_str));
*end = '\0';
@@ -157,64 +193,70 @@ TALER_EXCHANGE_management_disable_auditor (
sizeof (arg_str),
"management/auditors/%s/disable",
epub_str);
- ah->url = TALER_url_join (url,
- arg_str,
- NULL);
+ pmadh->url = TALER_url_join (pmadh->base_url,
+ arg_str,
+ NULL);
}
- if (NULL == ah->url)
+ if (NULL == pmadh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (ah);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
- master_sig),
+ &pmadh->master_sig),
GNUNET_JSON_pack_timestamp ("validity_end",
- validity_end));
- eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
+ pmadh->validity_end));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmadh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&ah->post_ctx,
+ TALER_curl_easy_post (&pmadh->post_ctx,
eh,
- body)))
+ body)) )
{
GNUNET_break (0);
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (ah->url);
- return NULL;
+ GNUNET_free (pmadh->url);
+ pmadh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
json_decref (body);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
- ah->url);
- ah->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- ah->post_ctx.headers,
- &handle_auditor_disable_finished,
- ah);
- if (NULL == ah->job)
+ pmadh->url);
+ pmadh->job = GNUNET_CURL_job_add2 (pmadh->ctx,
+ eh,
+ pmadh->post_ctx.headers,
+ &handle_auditors_disable_finished,
+ pmadh);
+ if (NULL == pmadh->job)
{
- TALER_EXCHANGE_management_disable_auditor_cancel (ah);
- return NULL;
+ TALER_curl_easy_post_finished (&pmadh->post_ctx);
+ GNUNET_free (pmadh->url);
+ pmadh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return ah;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_disable_auditor_cancel (
- struct TALER_EXCHANGE_ManagementAuditorDisableHandle *ah)
+TALER_EXCHANGE_post_management_auditors_disable_cancel (
+ struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle *pmadh)
{
- if (NULL != ah->job)
+ if (NULL != pmadh->job)
{
- GNUNET_CURL_job_cancel (ah->job);
- ah->job = NULL;
+ GNUNET_CURL_job_cancel (pmadh->job);
+ pmadh->job = NULL;
}
- TALER_curl_easy_post_finished (&ah->post_ctx);
- GNUNET_free (ah->url);
- GNUNET_free (ah);
+ TALER_curl_easy_post_finished (&pmadh->post_ctx);
+ GNUNET_free (pmadh->url);
+ GNUNET_free (pmadh->base_url);
+ GNUNET_free (pmadh);
}
+
+
+/* end of exchange_api_post-management-auditors-AUDITOR_PUB-disable.c */
diff --git a/src/lib/exchange_api_post-management-auditors.c b/src/lib/exchange_api_post-management-auditors.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2021 Taler Systems SA
+ Copyright (C) 2015-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
@@ -24,20 +24,25 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-auditors.h"
#include "exchange_api_curl_defaults.h"
#include "taler/taler_signatures.h"
#include "taler/taler_curl_lib.h"
-#include "taler/taler_json_lib.h"
/**
* @brief Handle for a POST /management/auditors request.
*/
-struct TALER_EXCHANGE_ManagementAuditorEnableHandle
+struct TALER_EXCHANGE_PostManagementAuditorsHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -54,17 +59,43 @@ struct TALER_EXCHANGE_ManagementAuditorEnableHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementAuditorEnableCallback cb;
+ TALER_EXCHANGE_PostManagementAuditorsCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_AUDITORS_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Public signing key of the auditor.
+ */
+ struct TALER_AuditorPublicKeyP auditor_pub;
+
+ /**
+ * Base URL of the auditor.
+ */
+ char *auditor_url;
+
+ /**
+ * Human-readable name of the auditor.
+ */
+ char *auditor_name;
+
+ /**
+ * When was this decided?
+ */
+ struct GNUNET_TIME_Timestamp validity_start;
+
+ /**
+ * Signature affirming the auditor addition.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
};
@@ -72,156 +103,177 @@ struct TALER_EXCHANGE_ManagementAuditorEnableHandle
* Function called when we're done processing the
* HTTP POST /management/auditors request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementAuditorEnableHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementAuditorsHandle`
* @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_auditors_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah = cls;
+ struct TALER_EXCHANGE_PostManagementAuditorsHandle *pmah = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementAuditorEnableResponse auditor_enable_response
- = {
+ struct TALER_EXCHANGE_PostManagementAuditorsResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
- };
+ };
- ah->job = NULL;
+ pmah->job = NULL;
switch (response_code)
{
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- auditor_enable_response.hr.ec = TALER_JSON_get_error_code (json);
- auditor_enable_response.hr.hint = TALER_JSON_get_error_hint (json);
+ 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",
- ah->url);
+ pmah->url);
if (NULL != json)
{
- auditor_enable_response.hr.ec = TALER_JSON_get_error_code (json);
- auditor_enable_response.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
}
else
{
- auditor_enable_response.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- auditor_enable_response.hr.hint = TALER_ErrorCode_get_hint (
- auditor_enable_response.hr.ec);
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = TALER_ErrorCode_get_hint (res.hr.ec);
}
break;
case MHD_HTTP_CONFLICT:
- auditor_enable_response.hr.ec = TALER_JSON_get_error_code (json);
- auditor_enable_response.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- auditor_enable_response.hr.ec = TALER_JSON_get_error_code (json);
- auditor_enable_response.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management auditor enable\n",
(unsigned int) response_code,
- (int) auditor_enable_response.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != ah->cb)
+ if (NULL != pmah->cb)
{
- ah->cb (ah->cb_cls,
- &auditor_enable_response);
- ah->cb = NULL;
+ pmah->cb (pmah->cb_cls,
+ &res);
+ pmah->cb = NULL;
}
- TALER_EXCHANGE_management_enable_auditor_cancel (ah);
+ TALER_EXCHANGE_post_management_auditors_cancel (pmah);
}
-struct TALER_EXCHANGE_ManagementAuditorEnableHandle *
-TALER_EXCHANGE_management_enable_auditor (
+struct TALER_EXCHANGE_PostManagementAuditorsHandle *
+TALER_EXCHANGE_post_management_auditors_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_AuditorPublicKeyP *auditor_pub,
const char *auditor_url,
const char *auditor_name,
struct GNUNET_TIME_Timestamp validity_start,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementAuditorEnableCallback cb,
- void *cb_cls)
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_EXCHANGE_PostManagementAuditorsHandle *pmah;
+
+ pmah = GNUNET_new (struct TALER_EXCHANGE_PostManagementAuditorsHandle);
+ pmah->ctx = ctx;
+ pmah->base_url = GNUNET_strdup (url);
+ pmah->auditor_pub = *auditor_pub;
+ pmah->auditor_url = GNUNET_strdup (auditor_url);
+ pmah->auditor_name = GNUNET_strdup (auditor_name);
+ pmah->validity_start = validity_start;
+ pmah->master_sig = *master_sig;
+ return pmah;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_auditors_start (
+ struct TALER_EXCHANGE_PostManagementAuditorsHandle *pmah,
+ TALER_EXCHANGE_PostManagementAuditorsCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_AUDITORS_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah;
CURL *eh;
json_t *body;
- ah = GNUNET_new (struct TALER_EXCHANGE_ManagementAuditorEnableHandle);
- ah->cb = cb;
- ah->cb_cls = cb_cls;
- ah->ctx = ctx;
- ah->url = TALER_url_join (url,
- "management/auditors",
- NULL);
- if (NULL == ah->url)
+ pmah->cb = cb;
+ pmah->cb_cls = cb_cls;
+ pmah->url = TALER_url_join (pmah->base_url,
+ "management/auditors",
+ NULL);
+ if (NULL == pmah->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (ah);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("auditor_url",
- auditor_url),
+ pmah->auditor_url),
GNUNET_JSON_pack_string ("auditor_name",
- auditor_name),
+ pmah->auditor_name),
GNUNET_JSON_pack_data_auto ("auditor_pub",
- auditor_pub),
+ &pmah->auditor_pub),
GNUNET_JSON_pack_data_auto ("master_sig",
- master_sig),
+ &pmah->master_sig),
GNUNET_JSON_pack_timestamp ("validity_start",
- validity_start));
- eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
+ pmah->validity_start));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmah->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&ah->post_ctx,
+ TALER_curl_easy_post (&pmah->post_ctx,
eh,
body)) )
{
GNUNET_break (0);
- json_decref (body);
if (NULL != eh)
curl_easy_cleanup (eh);
- GNUNET_free (ah->url);
- return NULL;
+ json_decref (body);
+ GNUNET_free (pmah->url);
+ pmah->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
json_decref (body);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
- ah->url);
- ah->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- ah->post_ctx.headers,
- &handle_auditor_enable_finished,
- ah);
- if (NULL == ah->job)
+ pmah->url);
+ pmah->job = GNUNET_CURL_job_add2 (pmah->ctx,
+ eh,
+ pmah->post_ctx.headers,
+ &handle_auditors_finished,
+ pmah);
+ if (NULL == pmah->job)
{
- TALER_EXCHANGE_management_enable_auditor_cancel (ah);
- return NULL;
+ TALER_curl_easy_post_finished (&pmah->post_ctx);
+ GNUNET_free (pmah->url);
+ pmah->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return ah;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_enable_auditor_cancel (
- struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah)
+TALER_EXCHANGE_post_management_auditors_cancel (
+ struct TALER_EXCHANGE_PostManagementAuditorsHandle *pmah)
{
- if (NULL != ah->job)
+ if (NULL != pmah->job)
{
- GNUNET_CURL_job_cancel (ah->job);
- ah->job = NULL;
+ GNUNET_CURL_job_cancel (pmah->job);
+ pmah->job = NULL;
}
- TALER_curl_easy_post_finished (&ah->post_ctx);
- GNUNET_free (ah->url);
- GNUNET_free (ah);
+ TALER_curl_easy_post_finished (&pmah->post_ctx);
+ GNUNET_free (pmah->auditor_url);
+ GNUNET_free (pmah->auditor_name);
+ GNUNET_free (pmah->url);
+ GNUNET_free (pmah->base_url);
+ GNUNET_free (pmah);
}
+
+
+/* end of exchange_api_post-management-auditors.c */
diff --git a/src/lib/exchange_api_post-management-denominations-H_DENOM_PUB-revoke.c b/src/lib/exchange_api_post-management-denominations-H_DENOM_PUB-revoke.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2024 Taler Systems SA
+ Copyright (C) 2015-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
@@ -24,20 +24,26 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "taler/taler_exchange_service.h"
+#include \
+ "taler/taler-exchange/post-management-denominations-H_DENOM_PUB-revoke.h"
#include "exchange_api_curl_defaults.h"
#include "taler/taler_signatures.h"
#include "taler/taler_curl_lib.h"
-#include "taler/taler_json_lib.h"
/**
* @brief Handle for a POST /management/denominations/$H_DENOM_PUB/revoke request.
*/
-struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle
+struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -54,99 +60,123 @@ struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb;
+ TALER_EXCHANGE_PostManagementDenominationsRevokeCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_DENOMINATIONS_REVOKE_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Hash of the denomination public key to revoke.
+ */
+ struct TALER_DenominationHashP h_denom_pub;
+
+ /**
+ * Signature affirming the revocation.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
};
/**
* Function called when we're done processing the
- * HTTP /management/denominations/$H_DENOM_PUB/revoke request.
+ * HTTP POST /management/denominations/$H_DENOM_PUB/revoke request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_revoke_denomination_finished (void *cls,
- long response_code,
- const void *response)
+handle_denominations_revoke_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *rh = cls;
+ struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *pmdrh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementRevokeDenominationResponse rdr = {
+ struct TALER_EXCHANGE_PostManagementDenominationsRevokeResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- rh->job = NULL;
+ pmdrh->job = NULL;
switch (response_code)
{
case 0:
/* no reply */
- rdr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- rdr.hr.hint = "server offline?";
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = "server offline?";
break;
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- rdr.hr.ec = TALER_JSON_get_error_code (json);
- rdr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- rdr.hr.ec = TALER_JSON_get_error_code (json);
- rdr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management revoke denomination\n",
(unsigned int) response_code,
- (int) rdr.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != rh->cb)
+ if (NULL != pmdrh->cb)
{
- rh->cb (rh->cb_cls,
- &rdr);
- rh->cb = NULL;
+ pmdrh->cb (pmdrh->cb_cls,
+ &res);
+ pmdrh->cb = NULL;
}
- TALER_EXCHANGE_management_revoke_denomination_key_cancel (rh);
+ TALER_EXCHANGE_post_management_denominations_revoke_cancel (pmdrh);
}
-struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *
-TALER_EXCHANGE_management_revoke_denomination_key (
+struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *
+TALER_EXCHANGE_post_management_denominations_revoke_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_DenominationHashP *h_denom_pub,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementRevokeDenominationKeyCallback cb,
- void *cb_cls)
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *pmdrh;
+
+ pmdrh = GNUNET_new (
+ struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle);
+ pmdrh->ctx = ctx;
+ pmdrh->base_url = GNUNET_strdup (url);
+ pmdrh->h_denom_pub = *h_denom_pub;
+ pmdrh->master_sig = *master_sig;
+ return pmdrh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_denominations_revoke_start (
+ struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *pmdrh,
+ TALER_EXCHANGE_PostManagementDenominationsRevokeCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_DENOMINATIONS_REVOKE_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *rh;
CURL *eh;
json_t *body;
- rh = GNUNET_new (struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle);
- rh->cb = cb;
- rh->cb_cls = cb_cls;
- rh->ctx = ctx;
+ pmdrh->cb = cb;
+ pmdrh->cb_cls = cb_cls;
{
- char epub_str[sizeof (*h_denom_pub) * 2];
+ char epub_str[sizeof (pmdrh->h_denom_pub) * 2];
char arg_str[sizeof (epub_str) + 64];
char *end;
- end = GNUNET_STRINGS_data_to_string (h_denom_pub,
- sizeof (*h_denom_pub),
+ end = GNUNET_STRINGS_data_to_string (&pmdrh->h_denom_pub,
+ sizeof (pmdrh->h_denom_pub),
epub_str,
sizeof (epub_str));
*end = '\0';
@@ -154,31 +184,23 @@ TALER_EXCHANGE_management_revoke_denomination_key (
sizeof (arg_str),
"management/denominations/%s/revoke",
epub_str);
- rh->url = TALER_url_join (url,
- arg_str,
- NULL);
+ pmdrh->url = TALER_url_join (pmdrh->base_url,
+ arg_str,
+ NULL);
}
- if (NULL == rh->url)
+ if (NULL == pmdrh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (rh);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
- master_sig));
- if (NULL == body)
- {
- GNUNET_break (0);
- GNUNET_free (rh->url);
- GNUNET_free (rh);
- return NULL;
- }
- eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
+ &pmdrh->master_sig));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmdrh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&rh->post_ctx,
+ TALER_curl_easy_post (&pmdrh->post_ctx,
eh,
body)) )
{
@@ -186,38 +208,45 @@ TALER_EXCHANGE_management_revoke_denomination_key (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (rh->url);
- GNUNET_free (rh);
- return NULL;
+ GNUNET_free (pmdrh->url);
+ pmdrh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
json_decref (body);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
- rh->url);
- rh->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- rh->post_ctx.headers,
- &handle_revoke_denomination_finished,
- rh);
- if (NULL == rh->job)
+ pmdrh->url);
+ pmdrh->job = GNUNET_CURL_job_add2 (pmdrh->ctx,
+ eh,
+ pmdrh->post_ctx.headers,
+ &handle_denominations_revoke_finished,
+ pmdrh);
+ if (NULL == pmdrh->job)
{
- TALER_EXCHANGE_management_revoke_denomination_key_cancel (rh);
- return NULL;
+ GNUNET_break (0);
+ TALER_curl_easy_post_finished (&pmdrh->post_ctx);
+ GNUNET_free (pmdrh->url);
+ pmdrh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return rh;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_revoke_denomination_key_cancel (
- struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *rh)
+TALER_EXCHANGE_post_management_denominations_revoke_cancel (
+ struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *pmdrh)
{
- if (NULL != rh->job)
+ if (NULL != pmdrh->job)
{
- GNUNET_CURL_job_cancel (rh->job);
- rh->job = NULL;
+ GNUNET_CURL_job_cancel (pmdrh->job);
+ pmdrh->job = NULL;
}
- TALER_curl_easy_post_finished (&rh->post_ctx);
- GNUNET_free (rh->url);
- GNUNET_free (rh);
+ TALER_curl_easy_post_finished (&pmdrh->post_ctx);
+ GNUNET_free (pmdrh->url);
+ GNUNET_free (pmdrh->base_url);
+ GNUNET_free (pmdrh);
}
+
+
+/* end of exchange_api_post-management-denominations-H_DENOM_PUB-revoke.c */
diff --git a/src/lib/exchange_api_post-management-drain.c b/src/lib/exchange_api_post-management-drain.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2020-2023 Taler Systems SA
+ Copyright (C) 2020-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
@@ -16,25 +16,30 @@
*/
/**
* @file lib/exchange_api_post-management-drain.c
- * @brief functions to set wire fees at an exchange
+ * @brief functions to drain profits from an exchange account
* @author Christian Grothoff
*/
#include "taler/platform.h"
#include "taler/taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
-#include "exchange_api_curl_defaults.h"
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-drain.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_ManagementDrainProfitsHandle
+struct TALER_EXCHANGE_PostManagementDrainHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -51,80 +56,111 @@ struct TALER_EXCHANGE_ManagementDrainProfitsHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementDrainProfitsCallback cb;
+ TALER_EXCHANGE_PostManagementDrainCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_DRAIN_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Wire transfer identifier to use.
+ */
+ struct TALER_WireTransferIdentifierRawP wtid;
+
+ /**
+ * Total to transfer.
+ */
+ struct TALER_Amount amount;
+
+ /**
+ * When was the request created.
+ */
+ struct GNUNET_TIME_Timestamp date;
+
+ /**
+ * Configuration section identifying account to debit.
+ */
+ char *account_section;
+
+ /**
+ * Payto URI of the account to credit.
+ */
+ char *payto_uri_str;
+
+ /**
+ * Signature affirming the operation.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
};
/**
* Function called when we're done processing the
- * HTTP /management/drain request.
+ * HTTP POST /management/drain request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementDrainProfitsHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementDrainHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_drain_profits_finished (void *cls,
- long response_code,
- const void *response)
+handle_drain_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementDrainProfitsHandle *dp = cls;
+ struct TALER_EXCHANGE_PostManagementDrainHandle *pmdh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementDrainResponse dr = {
+ struct TALER_EXCHANGE_PostManagementDrainResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- dp->job = NULL;
+ pmdh->job = NULL;
switch (response_code)
{
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- dr.hr.ec = TALER_JSON_get_error_code (json);
- dr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_CONFLICT:
- dr.hr.ec = TALER_JSON_get_error_code (json);
- dr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_PRECONDITION_FAILED:
- dr.hr.ec = TALER_JSON_get_error_code (json);
- dr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- dr.hr.ec = TALER_JSON_get_error_code (json);
- dr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management drain profits\n",
(unsigned int) response_code,
- (int) dr.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != dp->cb)
+ if (NULL != pmdh->cb)
{
- dp->cb (dp->cb_cls,
- &dr);
- dp->cb = NULL;
+ pmdh->cb (pmdh->cb_cls,
+ &res);
+ pmdh->cb = NULL;
}
- TALER_EXCHANGE_management_drain_profits_cancel (dp);
+ TALER_EXCHANGE_post_management_drain_cancel (pmdh);
}
-struct TALER_EXCHANGE_ManagementDrainProfitsHandle *
-TALER_EXCHANGE_management_drain_profits (
+struct TALER_EXCHANGE_PostManagementDrainHandle *
+TALER_EXCHANGE_post_management_drain_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_WireTransferIdentifierRawP *wtid,
@@ -132,45 +168,63 @@ TALER_EXCHANGE_management_drain_profits (
struct GNUNET_TIME_Timestamp date,
const char *account_section,
const struct TALER_FullPayto payto_uri,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementDrainProfitsCallback cb,
- void *cb_cls)
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_EXCHANGE_PostManagementDrainHandle *pmdh;
+
+ pmdh = GNUNET_new (struct TALER_EXCHANGE_PostManagementDrainHandle);
+ pmdh->ctx = ctx;
+ pmdh->base_url = GNUNET_strdup (url);
+ pmdh->wtid = *wtid;
+ pmdh->amount = *amount;
+ pmdh->date = date;
+ pmdh->account_section = GNUNET_strdup (account_section);
+ pmdh->payto_uri_str = GNUNET_strdup (payto_uri.full_payto);
+ pmdh->master_sig = *master_sig;
+ return pmdh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_drain_start (
+ struct TALER_EXCHANGE_PostManagementDrainHandle *pmdh,
+ TALER_EXCHANGE_PostManagementDrainCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_DRAIN_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementDrainProfitsHandle *dp;
CURL *eh;
json_t *body;
+ struct TALER_FullPayto payto_uri = {
+ .full_payto = pmdh->payto_uri_str
+ };
- dp = GNUNET_new (struct TALER_EXCHANGE_ManagementDrainProfitsHandle);
- dp->cb = cb;
- dp->cb_cls = cb_cls;
- dp->ctx = ctx;
- dp->url = TALER_url_join (url,
- "management/drain",
- NULL);
- if (NULL == dp->url)
+ pmdh->cb = cb;
+ pmdh->cb_cls = cb_cls;
+ pmdh->url = TALER_url_join (pmdh->base_url,
+ "management/drain",
+ NULL);
+ if (NULL == pmdh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (dp);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("debit_account_section",
- account_section),
+ pmdh->account_section),
TALER_JSON_pack_full_payto ("credit_payto_uri",
payto_uri),
GNUNET_JSON_pack_data_auto ("wtid",
- wtid),
+ &pmdh->wtid),
GNUNET_JSON_pack_data_auto ("master_sig",
- master_sig),
+ &pmdh->master_sig),
GNUNET_JSON_pack_timestamp ("date",
- date),
+ pmdh->date),
TALER_JSON_pack_amount ("amount",
- amount));
- eh = TALER_EXCHANGE_curl_easy_get_ (dp->url);
+ &pmdh->amount));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmdh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&dp->post_ctx,
+ TALER_curl_easy_post (&pmdh->post_ctx,
eh,
body)) )
{
@@ -178,37 +232,46 @@ TALER_EXCHANGE_management_drain_profits (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (dp->url);
- return NULL;
+ GNUNET_free (pmdh->url);
+ pmdh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
json_decref (body);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
- dp->url);
- dp->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- dp->post_ctx.headers,
- &handle_drain_profits_finished,
- dp);
- if (NULL == dp->job)
+ pmdh->url);
+ pmdh->job = GNUNET_CURL_job_add2 (pmdh->ctx,
+ eh,
+ pmdh->post_ctx.headers,
+ &handle_drain_finished,
+ pmdh);
+ if (NULL == pmdh->job)
{
- TALER_EXCHANGE_management_drain_profits_cancel (dp);
- return NULL;
+ TALER_curl_easy_post_finished (&pmdh->post_ctx);
+ GNUNET_free (pmdh->url);
+ pmdh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return dp;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_drain_profits_cancel (
- struct TALER_EXCHANGE_ManagementDrainProfitsHandle *dp)
+TALER_EXCHANGE_post_management_drain_cancel (
+ struct TALER_EXCHANGE_PostManagementDrainHandle *pmdh)
{
- if (NULL != dp->job)
+ if (NULL != pmdh->job)
{
- GNUNET_CURL_job_cancel (dp->job);
- dp->job = NULL;
+ GNUNET_CURL_job_cancel (pmdh->job);
+ pmdh->job = NULL;
}
- TALER_curl_easy_post_finished (&dp->post_ctx);
- GNUNET_free (dp->url);
- GNUNET_free (dp);
+ TALER_curl_easy_post_finished (&pmdh->post_ctx);
+ GNUNET_free (pmdh->account_section);
+ GNUNET_free (pmdh->payto_uri_str);
+ GNUNET_free (pmdh->url);
+ GNUNET_free (pmdh->base_url);
+ GNUNET_free (pmdh);
}
+
+
+/* end of exchange_api_post-management-drain.c */
diff --git a/src/lib/exchange_api_post-management-extensions.c b/src/lib/exchange_api_post-management-extensions.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2023 Taler Systems SA
+ Copyright (C) 2015-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
@@ -23,21 +23,26 @@
#include "taler/taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include "taler/taler_extensions.h"
-#include "exchange_api_curl_defaults.h"
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-extensions.h"
+#include "exchange_api_curl_defaults.h"
#include "taler/taler_signatures.h"
#include "taler/taler_curl_lib.h"
-#include "taler/taler_json_lib.h"
/**
* @brief Handle for a POST /management/extensions request.
*/
-struct TALER_EXCHANGE_ManagementPostExtensionsHandle
+struct TALER_EXCHANGE_PostManagementExtensionsHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -54,17 +59,28 @@ struct TALER_EXCHANGE_ManagementPostExtensionsHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementPostExtensionsCallback cb;
+ TALER_EXCHANGE_PostManagementExtensionsCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_EXTENSIONS_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Extension configuration data (we hold a reference).
+ */
+ json_t *extensions;
+
+ /**
+ * Signature over the extension configuration.
+ */
+ struct TALER_MasterSignatureP extensions_sig;
+
};
@@ -72,7 +88,7 @@ struct TALER_EXCHANGE_ManagementPostExtensionsHandle
* Function called when we're done processing the
* HTTP POST /management/extensions request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementPostExtensionsHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementExtensionsHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
@@ -81,95 +97,108 @@ handle_post_extensions_finished (void *cls,
long response_code,
const void *response)
{
- struct TALER_EXCHANGE_ManagementPostExtensionsHandle *ph = cls;
+ struct TALER_EXCHANGE_PostManagementExtensionsHandle *pmeh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementPostExtensionsResponse per = {
+ struct TALER_EXCHANGE_PostManagementExtensionsResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- ph->job = NULL;
+ pmeh->job = NULL;
switch (response_code)
{
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- per.hr.ec = TALER_JSON_get_error_code (json);
- per.hr.hint = TALER_JSON_get_error_hint (json);
+ 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",
- ph->url);
+ pmeh->url);
if (NULL != json)
{
- per.hr.ec = TALER_JSON_get_error_code (json);
- per.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
}
else
{
- per.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- per.hr.hint = TALER_ErrorCode_get_hint (per.hr.ec);
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = TALER_ErrorCode_get_hint (res.hr.ec);
}
break;
default:
/* unexpected response code */
GNUNET_break_op (0);
- per.hr.ec = TALER_JSON_get_error_code (json);
- per.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management post extensions\n",
(unsigned int) response_code,
- (int) per.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != ph->cb)
+ if (NULL != pmeh->cb)
{
- ph->cb (ph->cb_cls,
- &per);
- ph->cb = NULL;
+ pmeh->cb (pmeh->cb_cls,
+ &res);
+ pmeh->cb = NULL;
}
- TALER_EXCHANGE_management_post_extensions_cancel (ph);
+ TALER_EXCHANGE_post_management_extensions_cancel (pmeh);
}
-struct TALER_EXCHANGE_ManagementPostExtensionsHandle *
-TALER_EXCHANGE_management_post_extensions (
+struct TALER_EXCHANGE_PostManagementExtensionsHandle *
+TALER_EXCHANGE_post_management_extensions_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
- const struct TALER_EXCHANGE_ManagementPostExtensionsData *ped,
- TALER_EXCHANGE_ManagementPostExtensionsCallback cb,
- void *cb_cls)
+ const struct TALER_EXCHANGE_ManagementPostExtensionsData *ped)
+{
+ struct TALER_EXCHANGE_PostManagementExtensionsHandle *pmeh;
+
+ pmeh = GNUNET_new (struct TALER_EXCHANGE_PostManagementExtensionsHandle);
+ pmeh->ctx = ctx;
+ pmeh->base_url = GNUNET_strdup (url);
+ pmeh->extensions = json_incref ((json_t *) ped->extensions);
+ pmeh->extensions_sig = ped->extensions_sig;
+ return pmeh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_extensions_start (
+ struct TALER_EXCHANGE_PostManagementExtensionsHandle *pmeh,
+ TALER_EXCHANGE_PostManagementExtensionsCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_EXTENSIONS_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementPostExtensionsHandle *ph;
CURL *eh = NULL;
json_t *body = NULL;
-
- ph = GNUNET_new (struct TALER_EXCHANGE_ManagementPostExtensionsHandle);
- ph->cb = cb;
- ph->cb_cls = cb_cls;
- ph->ctx = ctx;
- ph->url = TALER_url_join (url,
- "management/extensions",
- NULL);
- if (NULL == ph->url)
+ json_t *extensions;
+
+ pmeh->cb = cb;
+ pmeh->cb_cls = cb_cls;
+ pmeh->url = TALER_url_join (pmeh->base_url,
+ "management/extensions",
+ NULL);
+ if (NULL == pmeh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (ph);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
-
+ /* Transfer our reference to the body via steal; set to NULL first */
+ extensions = pmeh->extensions;
+ pmeh->extensions = NULL;
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_object_steal ("extensions",
- (json_t *) ped->extensions),
+ extensions),
GNUNET_JSON_pack_data_auto ("extensions_sig",
- &ped->extensions_sig));
-
- eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
+ &pmeh->extensions_sig));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmeh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&ph->post_ctx,
+ TALER_curl_easy_post (&pmeh->post_ctx,
eh,
body)) )
{
@@ -177,37 +206,49 @@ TALER_EXCHANGE_management_post_extensions (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (ph->url);
- return NULL;
+ GNUNET_free (pmeh->url);
+ pmeh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
json_decref (body);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Requesting URL '%s'\n",
- ph->url);
- ph->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- ph->post_ctx.headers,
- &handle_post_extensions_finished,
- ph);
- if (NULL == ph->job)
+ pmeh->url);
+ pmeh->job = GNUNET_CURL_job_add2 (pmeh->ctx,
+ eh,
+ pmeh->post_ctx.headers,
+ &handle_post_extensions_finished,
+ pmeh);
+ if (NULL == pmeh->job)
{
- TALER_EXCHANGE_management_post_extensions_cancel (ph);
- return NULL;
+ TALER_curl_easy_post_finished (&pmeh->post_ctx);
+ GNUNET_free (pmeh->url);
+ pmeh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return ph;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_post_extensions_cancel (
- struct TALER_EXCHANGE_ManagementPostExtensionsHandle *ph)
+TALER_EXCHANGE_post_management_extensions_cancel (
+ struct TALER_EXCHANGE_PostManagementExtensionsHandle *pmeh)
{
- if (NULL != ph->job)
+ if (NULL != pmeh->job)
+ {
+ GNUNET_CURL_job_cancel (pmeh->job);
+ pmeh->job = NULL;
+ }
+ TALER_curl_easy_post_finished (&pmeh->post_ctx);
+ if (NULL != pmeh->extensions)
{
- GNUNET_CURL_job_cancel (ph->job);
- ph->job = NULL;
+ json_decref (pmeh->extensions);
+ pmeh->extensions = NULL;
}
- TALER_curl_easy_post_finished (&ph->post_ctx);
- GNUNET_free (ph->url);
- GNUNET_free (ph);
+ GNUNET_free (pmeh->url);
+ GNUNET_free (pmeh->base_url);
+ GNUNET_free (pmeh);
}
+
+
+/* end of exchange_api_post-management-extensions.c */
diff --git a/src/lib/exchange_api_post-management-global-fees.c b/src/lib/exchange_api_post-management-global-fees.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2020-2022 Taler Systems SA
+ Copyright (C) 2020-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
@@ -23,18 +23,23 @@
#include "taler/taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
-#include "exchange_api_curl_defaults.h"
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-global-fees.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_ManagementSetGlobalFeeHandle
+struct TALER_EXCHANGE_PostManagementGlobalFeesHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -51,95 +56,131 @@ struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementSetGlobalFeeCallback cb;
+ TALER_EXCHANGE_PostManagementGlobalFeesCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_GLOBAL_FEES_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Start of validity period.
+ */
+ struct GNUNET_TIME_Timestamp validity_start;
+
+ /**
+ * End of validity period.
+ */
+ struct GNUNET_TIME_Timestamp validity_end;
+
+ /**
+ * Global fees for this time period.
+ */
+ struct TALER_GlobalFeeSet fees;
+
+ /**
+ * When do purses time out.
+ */
+ struct GNUNET_TIME_Relative purse_timeout;
+
+ /**
+ * How long are account histories preserved.
+ */
+ struct GNUNET_TIME_Relative history_expiration;
+
+ /**
+ * How many purses are free per account.
+ */
+ uint32_t purse_account_limit;
+
+ /**
+ * Signature affirming the global fees.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
};
/**
* Function called when we're done processing the
- * HTTP /management/global request.
+ * HTTP POST /management/global-fees request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementAuditorEnableHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementGlobalFeesHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_set_global_fee_finished (void *cls,
- long response_code,
- const void *response)
+handle_global_fees_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh = cls;
+ struct TALER_EXCHANGE_PostManagementGlobalFeesHandle *pmgfh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse sfr = {
+ struct TALER_EXCHANGE_PostManagementGlobalFeesResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- sgfh->job = NULL;
+ pmgfh->job = NULL;
switch (response_code)
{
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- sfr.hr.ec = TALER_JSON_get_error_code (json);
- sfr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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",
- sgfh->url);
+ pmgfh->url);
if (NULL != json)
{
- sfr.hr.ec = TALER_JSON_get_error_code (json);
- sfr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
}
else
{
- sfr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- sfr.hr.hint = TALER_ErrorCode_get_hint (sfr.hr.ec);
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = TALER_ErrorCode_get_hint (res.hr.ec);
}
break;
case MHD_HTTP_CONFLICT:
- sfr.hr.ec = TALER_JSON_get_error_code (json);
- sfr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_PRECONDITION_FAILED:
- sfr.hr.ec = TALER_JSON_get_error_code (json);
- sfr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- sfr.hr.ec = TALER_JSON_get_error_code (json);
- sfr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management set global fee\n",
(unsigned int) response_code,
- (int) sfr.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != sgfh->cb)
+ if (NULL != pmgfh->cb)
{
- sgfh->cb (sgfh->cb_cls,
- &sfr);
- sgfh->cb = NULL;
+ pmgfh->cb (pmgfh->cb_cls,
+ &res);
+ pmgfh->cb = NULL;
}
- TALER_EXCHANGE_management_set_global_fees_cancel (sgfh);
+ TALER_EXCHANGE_post_management_global_fees_cancel (pmgfh);
}
-struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *
-TALER_EXCHANGE_management_set_global_fees (
+struct TALER_EXCHANGE_PostManagementGlobalFeesHandle *
+TALER_EXCHANGE_post_management_global_fees_create (
struct GNUNET_CURL_Context *ctx,
const char *exchange_base_url,
struct GNUNET_TIME_Timestamp validity_start,
@@ -148,51 +189,67 @@ TALER_EXCHANGE_management_set_global_fees (
struct GNUNET_TIME_Relative purse_timeout,
struct GNUNET_TIME_Relative history_expiration,
uint32_t purse_account_limit,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementSetGlobalFeeCallback cb,
- void *cb_cls)
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_EXCHANGE_PostManagementGlobalFeesHandle *pmgfh;
+
+ pmgfh = GNUNET_new (struct TALER_EXCHANGE_PostManagementGlobalFeesHandle);
+ pmgfh->ctx = ctx;
+ pmgfh->base_url = GNUNET_strdup (exchange_base_url);
+ pmgfh->validity_start = validity_start;
+ pmgfh->validity_end = validity_end;
+ pmgfh->fees = *fees;
+ pmgfh->purse_timeout = purse_timeout;
+ pmgfh->history_expiration = history_expiration;
+ pmgfh->purse_account_limit = purse_account_limit;
+ pmgfh->master_sig = *master_sig;
+ return pmgfh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_global_fees_start (
+ struct TALER_EXCHANGE_PostManagementGlobalFeesHandle *pmgfh,
+ TALER_EXCHANGE_PostManagementGlobalFeesCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_GLOBAL_FEES_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh;
CURL *eh;
json_t *body;
- sgfh = GNUNET_new (struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle);
- sgfh->cb = cb;
- sgfh->cb_cls = cb_cls;
- sgfh->ctx = ctx;
- sgfh->url = TALER_url_join (exchange_base_url,
- "management/global-fee",
- NULL);
- if (NULL == sgfh->url)
+ pmgfh->cb = cb;
+ pmgfh->cb_cls = cb_cls;
+ pmgfh->url = TALER_url_join (pmgfh->base_url,
+ "management/global-fee",
+ NULL);
+ if (NULL == pmgfh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (sgfh);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
- master_sig),
+ &pmgfh->master_sig),
GNUNET_JSON_pack_timestamp ("fee_start",
- validity_start),
+ pmgfh->validity_start),
GNUNET_JSON_pack_timestamp ("fee_end",
- validity_end),
+ pmgfh->validity_end),
TALER_JSON_pack_amount ("history_fee",
- &fees->history),
+ &pmgfh->fees.history),
TALER_JSON_pack_amount ("account_fee",
- &fees->account),
+ &pmgfh->fees.account),
TALER_JSON_pack_amount ("purse_fee",
- &fees->purse),
+ &pmgfh->fees.purse),
GNUNET_JSON_pack_time_rel ("purse_timeout",
- purse_timeout),
+ pmgfh->purse_timeout),
GNUNET_JSON_pack_time_rel ("history_expiration",
- history_expiration),
+ pmgfh->history_expiration),
GNUNET_JSON_pack_uint64 ("purse_account_limit",
- purse_account_limit));
- eh = TALER_EXCHANGE_curl_easy_get_ (sgfh->url);
+ pmgfh->purse_account_limit));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmgfh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&sgfh->post_ctx,
+ TALER_curl_easy_post (&pmgfh->post_ctx,
eh,
body)) )
{
@@ -200,38 +257,45 @@ TALER_EXCHANGE_management_set_global_fees (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (sgfh->url);
- GNUNET_free (sgfh);
- return NULL;
+ GNUNET_free (pmgfh->url);
+ pmgfh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
json_decref (body);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
- sgfh->url);
- sgfh->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- sgfh->post_ctx.headers,
- &handle_set_global_fee_finished,
- sgfh);
- if (NULL == sgfh->job)
+ pmgfh->url);
+ pmgfh->job = GNUNET_CURL_job_add2 (pmgfh->ctx,
+ eh,
+ pmgfh->post_ctx.headers,
+ &handle_global_fees_finished,
+ pmgfh);
+ if (NULL == pmgfh->job)
{
- TALER_EXCHANGE_management_set_global_fees_cancel (sgfh);
- return NULL;
+ GNUNET_break (0);
+ TALER_curl_easy_post_finished (&pmgfh->post_ctx);
+ GNUNET_free (pmgfh->url);
+ pmgfh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return sgfh;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_set_global_fees_cancel (
- struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh)
+TALER_EXCHANGE_post_management_global_fees_cancel (
+ struct TALER_EXCHANGE_PostManagementGlobalFeesHandle *pmgfh)
{
- if (NULL != sgfh->job)
+ if (NULL != pmgfh->job)
{
- GNUNET_CURL_job_cancel (sgfh->job);
- sgfh->job = NULL;
+ GNUNET_CURL_job_cancel (pmgfh->job);
+ pmgfh->job = NULL;
}
- TALER_curl_easy_post_finished (&sgfh->post_ctx);
- GNUNET_free (sgfh->url);
- GNUNET_free (sgfh);
+ TALER_curl_easy_post_finished (&pmgfh->post_ctx);
+ GNUNET_free (pmgfh->url);
+ GNUNET_free (pmgfh->base_url);
+ GNUNET_free (pmgfh);
}
+
+
+/* end of exchange_api_post-management-global-fees.c */
diff --git a/src/lib/exchange_api_post-management-keys.c b/src/lib/exchange_api_post-management-keys.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2021 Taler Systems SA
+ Copyright (C) 2015-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
@@ -24,20 +24,25 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-keys.h"
#include "exchange_api_curl_defaults.h"
#include "taler/taler_signatures.h"
#include "taler/taler_curl_lib.h"
-#include "taler/taler_json_lib.h"
/**
* @brief Handle for a POST /management/keys request.
*/
-struct TALER_EXCHANGE_ManagementPostKeysHandle
+struct TALER_EXCHANGE_PostManagementKeysHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -54,17 +59,38 @@ struct TALER_EXCHANGE_ManagementPostKeysHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementPostKeysCallback cb;
+ TALER_EXCHANGE_PostManagementKeysCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_KEYS_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Array of master signatures for the exchange's online signing keys.
+ */
+ struct TALER_EXCHANGE_SigningKeySignature *sign_sigs;
+
+ /**
+ * Length of the @e sign_sigs array.
+ */
+ unsigned int num_sign_sigs;
+
+ /**
+ * Array of master signatures for the exchange's denomination keys.
+ */
+ struct TALER_EXCHANGE_DenominationKeySignature *denom_sigs;
+
+ /**
+ * Length of the @e denom_sigs array.
+ */
+ unsigned int num_denom_sigs;
+
};
@@ -72,7 +98,7 @@ struct TALER_EXCHANGE_ManagementPostKeysHandle
* Function called when we're done processing the
* HTTP POST /management/keys request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementPostKeysHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementKeysHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
@@ -81,85 +107,104 @@ handle_post_keys_finished (void *cls,
long response_code,
const void *response)
{
- struct TALER_EXCHANGE_ManagementPostKeysHandle *ph = cls;
+ struct TALER_EXCHANGE_PostManagementKeysHandle *pmkh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementPostKeysResponse pkr = {
+ struct TALER_EXCHANGE_PostManagementKeysResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- ph->job = NULL;
+ pmkh->job = NULL;
switch (response_code)
{
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- pkr.hr.ec = TALER_JSON_get_error_code (json);
- pkr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_NOT_FOUND:
- pkr.hr.ec = TALER_JSON_get_error_code (json);
- pkr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_REQUEST_ENTITY_TOO_LARGE:
- pkr.hr.ec = TALER_JSON_get_error_code (json);
- pkr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- pkr.hr.ec = TALER_JSON_get_error_code (json);
- pkr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management post keys\n",
(unsigned int) response_code,
- (int) pkr.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != ph->cb)
+ if (NULL != pmkh->cb)
{
- ph->cb (ph->cb_cls,
- &pkr);
- ph->cb = NULL;
+ pmkh->cb (pmkh->cb_cls,
+ &res);
+ pmkh->cb = NULL;
}
- TALER_EXCHANGE_post_management_keys_cancel (ph);
+ TALER_EXCHANGE_post_management_keys_cancel (pmkh);
}
-struct TALER_EXCHANGE_ManagementPostKeysHandle *
-TALER_EXCHANGE_post_management_keys (
+struct TALER_EXCHANGE_PostManagementKeysHandle *
+TALER_EXCHANGE_post_management_keys_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
- const struct TALER_EXCHANGE_ManagementPostKeysData *pkd,
- TALER_EXCHANGE_ManagementPostKeysCallback cb,
- void *cb_cls)
+ const struct TALER_EXCHANGE_ManagementPostKeysData *pkd)
+{
+ struct TALER_EXCHANGE_PostManagementKeysHandle *pmkh;
+
+ pmkh = GNUNET_new (struct TALER_EXCHANGE_PostManagementKeysHandle);
+ pmkh->ctx = ctx;
+ pmkh->base_url = GNUNET_strdup (url);
+ pmkh->num_sign_sigs = pkd->num_sign_sigs;
+ pmkh->num_denom_sigs = pkd->num_denom_sigs;
+ pmkh->sign_sigs = GNUNET_memdup (pkd->sign_sigs,
+ pkd->num_sign_sigs
+ * sizeof (struct
+ TALER_EXCHANGE_SigningKeySignature));
+ pmkh->denom_sigs = GNUNET_memdup (pkd->denom_sigs,
+ pkd->num_denom_sigs
+ * sizeof (struct
+ TALER_EXCHANGE_DenominationKeySignature));
+ return pmkh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_keys_start (
+ struct TALER_EXCHANGE_PostManagementKeysHandle *pmkh,
+ TALER_EXCHANGE_PostManagementKeysCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_KEYS_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementPostKeysHandle *ph;
CURL *eh;
json_t *body;
json_t *denom_sigs;
json_t *signkey_sigs;
- ph = GNUNET_new (struct TALER_EXCHANGE_ManagementPostKeysHandle);
- ph->cb = cb;
- ph->cb_cls = cb_cls;
- ph->ctx = ctx;
- ph->url = TALER_url_join (url,
- "management/keys",
- NULL);
- if (NULL == ph->url)
+ pmkh->cb = cb;
+ pmkh->cb_cls = cb_cls;
+ pmkh->url = TALER_url_join (pmkh->base_url,
+ "management/keys",
+ NULL);
+ if (NULL == pmkh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (ph);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
denom_sigs = json_array ();
GNUNET_assert (NULL != denom_sigs);
- for (unsigned int i = 0; i<pkd->num_denom_sigs; i++)
+ for (unsigned int i = 0; i < pmkh->num_denom_sigs; i++)
{
const struct TALER_EXCHANGE_DenominationKeySignature *dks
- = &pkd->denom_sigs[i];
+ = &pmkh->denom_sigs[i];
GNUNET_assert (0 ==
json_array_append_new (
@@ -172,10 +217,10 @@ TALER_EXCHANGE_post_management_keys (
}
signkey_sigs = json_array ();
GNUNET_assert (NULL != signkey_sigs);
- for (unsigned int i = 0; i<pkd->num_sign_sigs; i++)
+ for (unsigned int i = 0; i < pmkh->num_sign_sigs; i++)
{
const struct TALER_EXCHANGE_SigningKeySignature *sks
- = &pkd->sign_sigs[i];
+ = &pmkh->sign_sigs[i];
GNUNET_assert (0 ==
json_array_append_new (
@@ -191,10 +236,10 @@ TALER_EXCHANGE_post_management_keys (
denom_sigs),
GNUNET_JSON_pack_array_steal ("signkey_sigs",
signkey_sigs));
- eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmkh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&ph->post_ctx,
+ TALER_curl_easy_post (&pmkh->post_ctx,
eh,
body)) )
{
@@ -202,37 +247,46 @@ TALER_EXCHANGE_post_management_keys (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (ph->url);
- return NULL;
+ GNUNET_free (pmkh->url);
+ pmkh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
json_decref (body);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
- ph->url);
- ph->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- ph->post_ctx.headers,
- &handle_post_keys_finished,
- ph);
- if (NULL == ph->job)
+ pmkh->url);
+ pmkh->job = GNUNET_CURL_job_add2 (pmkh->ctx,
+ eh,
+ pmkh->post_ctx.headers,
+ &handle_post_keys_finished,
+ pmkh);
+ if (NULL == pmkh->job)
{
- TALER_EXCHANGE_post_management_keys_cancel (ph);
- return NULL;
+ TALER_curl_easy_post_finished (&pmkh->post_ctx);
+ GNUNET_free (pmkh->url);
+ pmkh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return ph;
+ return TALER_EC_NONE;
}
void
TALER_EXCHANGE_post_management_keys_cancel (
- struct TALER_EXCHANGE_ManagementPostKeysHandle *ph)
+ struct TALER_EXCHANGE_PostManagementKeysHandle *pmkh)
{
- if (NULL != ph->job)
+ if (NULL != pmkh->job)
{
- GNUNET_CURL_job_cancel (ph->job);
- ph->job = NULL;
+ GNUNET_CURL_job_cancel (pmkh->job);
+ pmkh->job = NULL;
}
- TALER_curl_easy_post_finished (&ph->post_ctx);
- GNUNET_free (ph->url);
- GNUNET_free (ph);
+ TALER_curl_easy_post_finished (&pmkh->post_ctx);
+ GNUNET_free (pmkh->sign_sigs);
+ GNUNET_free (pmkh->denom_sigs);
+ GNUNET_free (pmkh->url);
+ GNUNET_free (pmkh->base_url);
+ GNUNET_free (pmkh);
}
+
+
+/* end of exchange_api_post-management-keys.c */
diff --git a/src/lib/exchange_api_post-management-partners.c b/src/lib/exchange_api_post-management-partners.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2023 Taler Systems SA
+ 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
@@ -16,7 +16,7 @@
*/
/**
* @file lib/exchange_api_post-management-partners.c
- * @brief functions to add an partner by an AML officer
+ * @brief functions to add a partner exchange
* @author Christian Grothoff
*/
#include "taler/platform.h"
@@ -24,17 +24,22 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-partners.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_ManagementAddPartner
+struct TALER_EXCHANGE_PostManagementPartnersHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -51,17 +56,53 @@ struct TALER_EXCHANGE_ManagementAddPartner
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementAddPartnerCallback cb;
+ TALER_EXCHANGE_PostManagementPartnersCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_PARTNERS_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Offline signing key of the partner.
+ */
+ struct TALER_MasterPublicKeyP partner_pub;
+
+ /**
+ * Validity period start.
+ */
+ struct GNUNET_TIME_Timestamp start_date;
+
+ /**
+ * Validity period end.
+ */
+ struct GNUNET_TIME_Timestamp end_date;
+
+ /**
+ * How often will we do wad transfers to this partner.
+ */
+ struct GNUNET_TIME_Relative wad_frequency;
+
+ /**
+ * Wad fee to this partner.
+ */
+ struct TALER_Amount wad_fee;
+
+ /**
+ * Base URL of the partner exchange.
+ */
+ char *partner_base_url;
+
+ /**
+ * Signature.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
};
@@ -69,63 +110,63 @@ struct TALER_EXCHANGE_ManagementAddPartner
* Function called when we're done processing the
* HTTP POST /management/partners request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementAddPartner *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementPartnersHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_add_partner_finished (void *cls,
- long response_code,
- const void *response)
+handle_partners_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementAddPartner *wh = cls;
+ struct TALER_EXCHANGE_PostManagementPartnersHandle *pmph = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementAddPartnerResponse apr = {
+ struct TALER_EXCHANGE_PostManagementPartnersResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- wh->job = NULL;
+ pmph->job = NULL;
switch (response_code)
{
case 0:
/* no reply */
- apr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- apr.hr.hint = "server offline?";
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = "server offline?";
break;
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- apr.hr.ec = TALER_JSON_get_error_code (json);
- apr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_CONFLICT:
- apr.hr.ec = TALER_JSON_get_error_code (json);
- apr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- apr.hr.ec = TALER_JSON_get_error_code (json);
- apr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 adding exchange partner\n",
(unsigned int) response_code,
- (int) apr.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != wh->cb)
+ if (NULL != pmph->cb)
{
- wh->cb (wh->cb_cls,
- &apr);
- wh->cb = NULL;
+ pmph->cb (pmph->cb_cls,
+ &res);
+ pmph->cb = NULL;
}
- TALER_EXCHANGE_management_add_partner_cancel (wh);
+ TALER_EXCHANGE_post_management_partners_cancel (pmph);
}
-struct TALER_EXCHANGE_ManagementAddPartner *
-TALER_EXCHANGE_management_add_partner (
+struct TALER_EXCHANGE_PostManagementPartnersHandle *
+TALER_EXCHANGE_post_management_partners_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_MasterPublicKeyP *partner_pub,
@@ -134,48 +175,63 @@ TALER_EXCHANGE_management_add_partner (
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)
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_EXCHANGE_PostManagementPartnersHandle *pmph;
+
+ pmph = GNUNET_new (struct TALER_EXCHANGE_PostManagementPartnersHandle);
+ pmph->ctx = ctx;
+ pmph->base_url = GNUNET_strdup (url);
+ pmph->partner_pub = *partner_pub;
+ pmph->start_date = start_date;
+ pmph->end_date = end_date;
+ pmph->wad_frequency = wad_frequency;
+ pmph->wad_fee = *wad_fee;
+ pmph->partner_base_url = GNUNET_strdup (partner_base_url);
+ pmph->master_sig = *master_sig;
+ return pmph;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_partners_start (
+ struct TALER_EXCHANGE_PostManagementPartnersHandle *pmph,
+ TALER_EXCHANGE_PostManagementPartnersCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_PARTNERS_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementAddPartner *wh;
CURL *eh;
json_t *body;
- 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/partners",
- NULL);
- if (NULL == wh->url)
+ pmph->cb = cb;
+ pmph->cb_cls = cb_cls;
+ pmph->url = TALER_url_join (pmph->base_url,
+ "management/partners",
+ NULL);
+ if (NULL == pmph->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (wh);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("partner_base_url",
- partner_base_url),
+ pmph->partner_base_url),
GNUNET_JSON_pack_timestamp ("start_date",
- start_date),
+ pmph->start_date),
GNUNET_JSON_pack_timestamp ("end_date",
- end_date),
+ pmph->end_date),
GNUNET_JSON_pack_time_rel ("wad_frequency",
- wad_frequency),
+ pmph->wad_frequency),
GNUNET_JSON_pack_data_auto ("partner_pub",
- &partner_pub),
+ &pmph->partner_pub),
GNUNET_JSON_pack_data_auto ("master_sig",
- &master_sig),
+ &pmph->master_sig),
TALER_JSON_pack_amount ("wad_fee",
- wad_fee)
- );
- eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
+ &pmph->wad_fee));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmph->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&wh->post_ctx,
+ TALER_curl_easy_post (&pmph->post_ctx,
eh,
body)) )
{
@@ -183,37 +239,45 @@ TALER_EXCHANGE_management_add_partner (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (wh->url);
- return NULL;
+ GNUNET_free (pmph->url);
+ pmph->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
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_add_partner_finished,
- wh);
- if (NULL == wh->job)
+ pmph->url);
+ pmph->job = GNUNET_CURL_job_add2 (pmph->ctx,
+ eh,
+ pmph->post_ctx.headers,
+ &handle_partners_finished,
+ pmph);
+ if (NULL == pmph->job)
{
- TALER_EXCHANGE_management_add_partner_cancel (wh);
- return NULL;
+ TALER_curl_easy_post_finished (&pmph->post_ctx);
+ GNUNET_free (pmph->url);
+ pmph->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return wh;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_add_partner_cancel (
- struct TALER_EXCHANGE_ManagementAddPartner *wh)
+TALER_EXCHANGE_post_management_partners_cancel (
+ struct TALER_EXCHANGE_PostManagementPartnersHandle *pmph)
{
- if (NULL != wh->job)
+ if (NULL != pmph->job)
{
- GNUNET_CURL_job_cancel (wh->job);
- wh->job = NULL;
+ GNUNET_CURL_job_cancel (pmph->job);
+ pmph->job = NULL;
}
- TALER_curl_easy_post_finished (&wh->post_ctx);
- GNUNET_free (wh->url);
- GNUNET_free (wh);
+ TALER_curl_easy_post_finished (&pmph->post_ctx);
+ GNUNET_free (pmph->partner_base_url);
+ GNUNET_free (pmph->url);
+ GNUNET_free (pmph->base_url);
+ GNUNET_free (pmph);
}
+
+
+/* end of exchange_api_post-management-partners.c */
diff --git a/src/lib/exchange_api_post-management-signkeys-EXCHANGE_PUB-revoke.c b/src/lib/exchange_api_post-management-signkeys-EXCHANGE_PUB-revoke.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2021 Taler Systems SA
+ Copyright (C) 2015-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
@@ -24,17 +24,22 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-signkeys-EXCHANGE_PUB-revoke.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_ManagementRevokeSigningKeyHandle
+struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -51,99 +56,123 @@ struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementRevokeSigningKeyCallback cb;
+ TALER_EXCHANGE_PostManagementSignkeysRevokeCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_SIGNKEYS_REVOKE_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * The public signing key that was revoked.
+ */
+ struct TALER_ExchangePublicKeyP exchange_pub;
+
+ /**
+ * Signature affirming the revocation.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
};
/**
* Function called when we're done processing the
- * HTTP /management/signkeys/%s/revoke request.
+ * HTTP POST /management/signkeys/$EXCHANGE_PUB/revoke request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_revoke_signing_finished (void *cls,
- long response_code,
- const void *response)
+handle_signkeys_revoke_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *rh = cls;
+ struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle *pmsrh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementRevokeSigningKeyResponse rsr = {
+ struct TALER_EXCHANGE_PostManagementSignkeysRevokeResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- rh->job = NULL;
+ pmsrh->job = NULL;
switch (response_code)
{
case 0:
/* no reply */
- rsr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- rsr.hr.hint = "server offline?";
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = "server offline?";
break;
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- rsr.hr.ec = TALER_JSON_get_error_code (json);
- rsr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- rsr.hr.ec = TALER_JSON_get_error_code (json);
- rsr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management revoke signkey\n",
(unsigned int) response_code,
- (int) rsr.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != rh->cb)
+ if (NULL != pmsrh->cb)
{
- rh->cb (rh->cb_cls,
- &rsr);
- rh->cb = NULL;
+ pmsrh->cb (pmsrh->cb_cls,
+ &res);
+ pmsrh->cb = NULL;
}
- TALER_EXCHANGE_management_revoke_signing_key_cancel (rh);
+ TALER_EXCHANGE_post_management_signkeys_revoke_cancel (pmsrh);
}
-struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *
-TALER_EXCHANGE_management_revoke_signing_key (
+struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle *
+TALER_EXCHANGE_post_management_signkeys_revoke_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_ExchangePublicKeyP *exchange_pub,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementRevokeSigningKeyCallback cb,
- void *cb_cls)
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle *pmsrh;
+
+ pmsrh = GNUNET_new (
+ struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle);
+ pmsrh->ctx = ctx;
+ pmsrh->base_url = GNUNET_strdup (url);
+ pmsrh->exchange_pub = *exchange_pub;
+ pmsrh->master_sig = *master_sig;
+ return pmsrh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_signkeys_revoke_start (
+ struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle *pmsrh,
+ TALER_EXCHANGE_PostManagementSignkeysRevokeCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_SIGNKEYS_REVOKE_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *rh;
CURL *eh;
json_t *body;
- rh = GNUNET_new (struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle);
- rh->cb = cb;
- rh->cb_cls = cb_cls;
- rh->ctx = ctx;
+ pmsrh->cb = cb;
+ pmsrh->cb_cls = cb_cls;
{
- char epub_str[sizeof (*exchange_pub) * 2];
+ char epub_str[sizeof (pmsrh->exchange_pub) * 2];
char arg_str[sizeof (epub_str) + 64];
char *end;
- end = GNUNET_STRINGS_data_to_string (exchange_pub,
- sizeof (*exchange_pub),
+ end = GNUNET_STRINGS_data_to_string (&pmsrh->exchange_pub,
+ sizeof (pmsrh->exchange_pub),
epub_str,
sizeof (epub_str));
*end = '\0';
@@ -151,24 +180,23 @@ TALER_EXCHANGE_management_revoke_signing_key (
sizeof (arg_str),
"management/signkeys/%s/revoke",
epub_str);
- rh->url = TALER_url_join (url,
- arg_str,
- NULL);
+ pmsrh->url = TALER_url_join (pmsrh->base_url,
+ arg_str,
+ NULL);
}
- if (NULL == rh->url)
+ if (NULL == pmsrh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (rh);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("master_sig",
- master_sig));
- eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
+ &pmsrh->master_sig));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmsrh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&rh->post_ctx,
+ TALER_curl_easy_post (&pmsrh->post_ctx,
eh,
body)) )
{
@@ -176,38 +204,44 @@ TALER_EXCHANGE_management_revoke_signing_key (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (rh->url);
- GNUNET_free (rh);
- return NULL;
+ GNUNET_free (pmsrh->url);
+ pmsrh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
json_decref (body);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
- rh->url);
- rh->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- rh->post_ctx.headers,
- &handle_revoke_signing_finished,
- rh);
- if (NULL == rh->job)
+ pmsrh->url);
+ pmsrh->job = GNUNET_CURL_job_add2 (pmsrh->ctx,
+ eh,
+ pmsrh->post_ctx.headers,
+ &handle_signkeys_revoke_finished,
+ pmsrh);
+ if (NULL == pmsrh->job)
{
- TALER_EXCHANGE_management_revoke_signing_key_cancel (rh);
- return NULL;
+ TALER_curl_easy_post_finished (&pmsrh->post_ctx);
+ GNUNET_free (pmsrh->url);
+ pmsrh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return rh;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_revoke_signing_key_cancel (
- struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *rh)
+TALER_EXCHANGE_post_management_signkeys_revoke_cancel (
+ struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle *pmsrh)
{
- if (NULL != rh->job)
+ if (NULL != pmsrh->job)
{
- GNUNET_CURL_job_cancel (rh->job);
- rh->job = NULL;
+ GNUNET_CURL_job_cancel (pmsrh->job);
+ pmsrh->job = NULL;
}
- TALER_curl_easy_post_finished (&rh->post_ctx);
- GNUNET_free (rh->url);
- GNUNET_free (rh);
+ TALER_curl_easy_post_finished (&pmsrh->post_ctx);
+ GNUNET_free (pmsrh->url);
+ GNUNET_free (pmsrh->base_url);
+ GNUNET_free (pmsrh);
}
+
+
+/* end of exchange_api_post-management-signkeys-EXCHANGE_PUB-revoke.c */
diff --git a/src/lib/exchange_api_post-management-wire-disable.c b/src/lib/exchange_api_post-management-wire-disable.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2023 Taler Systems SA
+ Copyright (C) 2015-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
@@ -24,17 +24,22 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-wire-disable.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_ManagementWireDisableHandle
+struct TALER_EXCHANGE_PostManagementWireDisableHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -51,133 +56,164 @@ struct TALER_EXCHANGE_ManagementWireDisableHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementWireDisableCallback cb;
+ TALER_EXCHANGE_PostManagementWireDisableCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_WIRE_DISABLE_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Payto URI of the account to disable.
+ */
+ char *payto_uri_str;
+
+ /**
+ * When was this decided?
+ */
+ struct GNUNET_TIME_Timestamp validity_end;
+
+ /**
+ * Signature affirming the wire disablement.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
};
/**
* Function called when we're done processing the
- * HTTP /management/wire/disable request.
+ * HTTP POST /management/wire/disable request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementAuditorDisableHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementWireDisableHandle`
* @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_wire_disable_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementWireDisableHandle *wh = cls;
+ struct TALER_EXCHANGE_PostManagementWireDisableHandle *pmwdh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementWireDisableResponse wdr = {
+ struct TALER_EXCHANGE_PostManagementWireDisableResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- wh->job = NULL;
+ pmwdh->job = NULL;
switch (response_code)
{
case 0:
/* no reply */
- wdr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- wdr.hr.hint = "server offline?";
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = "server offline?";
break;
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- wdr.hr.ec = TALER_JSON_get_error_code (json);
- wdr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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",
- wh->url);
+ pmwdh->url);
if (NULL != json)
{
- wdr.hr.ec = TALER_JSON_get_error_code (json);
- wdr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
}
else
{
- wdr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- wdr.hr.hint = TALER_ErrorCode_get_hint (wdr.hr.ec);
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = TALER_ErrorCode_get_hint (res.hr.ec);
}
break;
case MHD_HTTP_CONFLICT:
- wdr.hr.ec = TALER_JSON_get_error_code (json);
- wdr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- wdr.hr.ec = TALER_JSON_get_error_code (json);
- wdr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 exchange management disable wire\n",
+ "Unexpected response code %u/%d for exchange management disable wire\n",
(unsigned int) response_code,
- (int) wdr.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != wh->cb)
+ if (NULL != pmwdh->cb)
{
- wh->cb (wh->cb_cls,
- &wdr);
- wh->cb = NULL;
+ pmwdh->cb (pmwdh->cb_cls,
+ &res);
+ pmwdh->cb = NULL;
}
- TALER_EXCHANGE_management_disable_wire_cancel (wh);
+ TALER_EXCHANGE_post_management_wire_disable_cancel (pmwdh);
}
-struct TALER_EXCHANGE_ManagementWireDisableHandle *
-TALER_EXCHANGE_management_disable_wire (
+struct TALER_EXCHANGE_PostManagementWireDisableHandle *
+TALER_EXCHANGE_post_management_wire_disable_create (
struct GNUNET_CURL_Context *ctx,
- const char *url,
+ const char *exchange_url,
const struct TALER_FullPayto payto_uri,
struct GNUNET_TIME_Timestamp validity_end,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementWireDisableCallback cb,
- void *cb_cls)
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_EXCHANGE_PostManagementWireDisableHandle *pmwdh;
+
+ pmwdh = GNUNET_new (struct TALER_EXCHANGE_PostManagementWireDisableHandle);
+ pmwdh->ctx = ctx;
+ pmwdh->base_url = GNUNET_strdup (exchange_url);
+ pmwdh->payto_uri_str = GNUNET_strdup (payto_uri.full_payto);
+ pmwdh->validity_end = validity_end;
+ pmwdh->master_sig = *master_sig;
+ return pmwdh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_wire_disable_start (
+ struct TALER_EXCHANGE_PostManagementWireDisableHandle *pmwdh,
+ TALER_EXCHANGE_PostManagementWireDisableCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_WIRE_DISABLE_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementWireDisableHandle *wh;
CURL *eh;
json_t *body;
+ struct TALER_FullPayto payto_uri = {
+ .full_payto = pmwdh->payto_uri_str
+ };
- wh = GNUNET_new (struct TALER_EXCHANGE_ManagementWireDisableHandle);
- wh->cb = cb;
- wh->cb_cls = cb_cls;
- wh->ctx = ctx;
- wh->url = TALER_url_join (url,
- "management/wire/disable",
- NULL);
- if (NULL == wh->url)
+ pmwdh->cb = cb;
+ pmwdh->cb_cls = cb_cls;
+ pmwdh->url = TALER_url_join (pmwdh->base_url,
+ "management/wire/disable",
+ NULL);
+ if (NULL == pmwdh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (wh);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
TALER_JSON_pack_full_payto ("payto_uri",
payto_uri),
GNUNET_JSON_pack_data_auto ("master_sig_del",
- master_sig),
+ &pmwdh->master_sig),
GNUNET_JSON_pack_timestamp ("validity_end",
- validity_end));
- eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
+ pmwdh->validity_end));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmwdh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&wh->post_ctx,
+ TALER_curl_easy_post (&pmwdh->post_ctx,
eh,
body)) )
{
@@ -185,38 +221,45 @@ TALER_EXCHANGE_management_disable_wire (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (wh->url);
- GNUNET_free (wh);
- return NULL;
+ GNUNET_free (pmwdh->url);
+ pmwdh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
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_auditor_disable_finished,
- wh);
- if (NULL == wh->job)
+ pmwdh->url);
+ pmwdh->job = GNUNET_CURL_job_add2 (pmwdh->ctx,
+ eh,
+ pmwdh->post_ctx.headers,
+ &handle_wire_disable_finished,
+ pmwdh);
+ if (NULL == pmwdh->job)
{
- TALER_EXCHANGE_management_disable_wire_cancel (wh);
- return NULL;
+ TALER_curl_easy_post_finished (&pmwdh->post_ctx);
+ GNUNET_free (pmwdh->url);
+ pmwdh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return wh;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_disable_wire_cancel (
- struct TALER_EXCHANGE_ManagementWireDisableHandle *wh)
+TALER_EXCHANGE_post_management_wire_disable_cancel (
+ struct TALER_EXCHANGE_PostManagementWireDisableHandle *pmwdh)
{
- if (NULL != wh->job)
+ if (NULL != pmwdh->job)
{
- GNUNET_CURL_job_cancel (wh->job);
- wh->job = NULL;
+ GNUNET_CURL_job_cancel (pmwdh->job);
+ pmwdh->job = NULL;
}
- TALER_curl_easy_post_finished (&wh->post_ctx);
- GNUNET_free (wh->url);
- GNUNET_free (wh);
+ TALER_curl_easy_post_finished (&pmwdh->post_ctx);
+ GNUNET_free (pmwdh->payto_uri_str);
+ GNUNET_free (pmwdh->url);
+ GNUNET_free (pmwdh->base_url);
+ GNUNET_free (pmwdh);
}
+
+
+/* end of exchange_api_post-management-wire-disable.c */
diff --git a/src/lib/exchange_api_post-management-wire-fee.c b/src/lib/exchange_api_post-management-wire-fee.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2020-2022 Taler Systems SA
+ Copyright (C) 2020-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
@@ -23,18 +23,23 @@
#include "taler/taler_json_lib.h"
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
-#include "exchange_api_curl_defaults.h"
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-wire-fee.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_ManagementSetWireFeeHandle
+struct TALER_EXCHANGE_PostManagementWireFeesHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -51,140 +56,180 @@ struct TALER_EXCHANGE_ManagementSetWireFeeHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementSetWireFeeCallback cb;
+ TALER_EXCHANGE_PostManagementWireFeesCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_WIRE_FEES_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Wire method these fees are for.
+ */
+ char *wire_method;
+
+ /**
+ * Start of validity period.
+ */
+ struct GNUNET_TIME_Timestamp validity_start;
+
+ /**
+ * End of validity period.
+ */
+ struct GNUNET_TIME_Timestamp validity_end;
+
+ /**
+ * Wire fees for this time period.
+ */
+ struct TALER_WireFeeSet fees;
+
+ /**
+ * Signature affirming the wire fees.
+ */
+ struct TALER_MasterSignatureP master_sig;
+
};
/**
* Function called when we're done processing the
- * HTTP /management/wire request.
+ * HTTP POST /management/wire-fees request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementAuditorEnableHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementWireFeesHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_set_wire_fee_finished (void *cls,
- long response_code,
- const void *response)
+handle_wire_fees_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh = cls;
+ struct TALER_EXCHANGE_PostManagementWireFeesHandle *pmwfh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementSetWireFeeResponse swr = {
+ struct TALER_EXCHANGE_PostManagementWireFeesResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- swfh->job = NULL;
+ pmwfh->job = NULL;
switch (response_code)
{
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- swr.hr.ec = TALER_JSON_get_error_code (json);
- swr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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",
- swfh->url);
+ pmwfh->url);
if (NULL != json)
{
- swr.hr.ec = TALER_JSON_get_error_code (json);
- swr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
}
else
{
- swr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- swr.hr.hint = TALER_ErrorCode_get_hint (swr.hr.ec);
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = TALER_ErrorCode_get_hint (res.hr.ec);
}
break;
case MHD_HTTP_CONFLICT:
- swr.hr.ec = TALER_JSON_get_error_code (json);
- swr.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_PRECONDITION_FAILED:
- swr.hr.ec = TALER_JSON_get_error_code (json);
- swr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- swr.hr.ec = TALER_JSON_get_error_code (json);
- swr.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management set wire fee\n",
(unsigned int) response_code,
- (int) swr.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != swfh->cb)
+ if (NULL != pmwfh->cb)
{
- swfh->cb (swfh->cb_cls,
- &swr);
- swfh->cb = NULL;
+ pmwfh->cb (pmwfh->cb_cls,
+ &res);
+ pmwfh->cb = NULL;
}
- TALER_EXCHANGE_management_set_wire_fees_cancel (swfh);
+ TALER_EXCHANGE_post_management_wire_fees_cancel (pmwfh);
}
-struct TALER_EXCHANGE_ManagementSetWireFeeHandle *
-TALER_EXCHANGE_management_set_wire_fees (
+struct TALER_EXCHANGE_PostManagementWireFeesHandle *
+TALER_EXCHANGE_post_management_wire_fees_create (
struct GNUNET_CURL_Context *ctx,
const char *exchange_base_url,
const char *wire_method,
struct GNUNET_TIME_Timestamp validity_start,
struct GNUNET_TIME_Timestamp validity_end,
const struct TALER_WireFeeSet *fees,
- const struct TALER_MasterSignatureP *master_sig,
- TALER_EXCHANGE_ManagementSetWireFeeCallback cb,
- void *cb_cls)
+ const struct TALER_MasterSignatureP *master_sig)
+{
+ struct TALER_EXCHANGE_PostManagementWireFeesHandle *pmwfh;
+
+ pmwfh = GNUNET_new (struct TALER_EXCHANGE_PostManagementWireFeesHandle);
+ pmwfh->ctx = ctx;
+ pmwfh->base_url = GNUNET_strdup (exchange_base_url);
+ pmwfh->wire_method = GNUNET_strdup (wire_method);
+ pmwfh->validity_start = validity_start;
+ pmwfh->validity_end = validity_end;
+ pmwfh->fees = *fees;
+ pmwfh->master_sig = *master_sig;
+ return pmwfh;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_wire_fees_start (
+ struct TALER_EXCHANGE_PostManagementWireFeesHandle *pmwfh,
+ TALER_EXCHANGE_PostManagementWireFeesCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_WIRE_FEES_RESULT_CLOSURE *cb_cls)
{
- struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh;
CURL *eh;
json_t *body;
- swfh = GNUNET_new (struct TALER_EXCHANGE_ManagementSetWireFeeHandle);
- swfh->cb = cb;
- swfh->cb_cls = cb_cls;
- swfh->ctx = ctx;
- swfh->url = TALER_url_join (exchange_base_url,
- "management/wire-fee",
- NULL);
- if (NULL == swfh->url)
+ pmwfh->cb = cb;
+ pmwfh->cb_cls = cb_cls;
+ pmwfh->url = TALER_url_join (pmwfh->base_url,
+ "management/wire-fee",
+ NULL);
+ if (NULL == pmwfh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (swfh);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("wire_method",
- wire_method),
+ pmwfh->wire_method),
GNUNET_JSON_pack_data_auto ("master_sig",
- master_sig),
+ &pmwfh->master_sig),
GNUNET_JSON_pack_timestamp ("fee_start",
- validity_start),
+ pmwfh->validity_start),
GNUNET_JSON_pack_timestamp ("fee_end",
- validity_end),
+ pmwfh->validity_end),
TALER_JSON_pack_amount ("closing_fee",
- &fees->closing),
+ &pmwfh->fees.closing),
TALER_JSON_pack_amount ("wire_fee",
- &fees->wire));
- eh = TALER_EXCHANGE_curl_easy_get_ (swfh->url);
+ &pmwfh->fees.wire));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmwfh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&swfh->post_ctx,
+ TALER_curl_easy_post (&pmwfh->post_ctx,
eh,
body)) )
{
@@ -192,38 +237,45 @@ TALER_EXCHANGE_management_set_wire_fees (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (swfh->url);
- GNUNET_free (swfh);
- return NULL;
+ GNUNET_free (pmwfh->url);
+ pmwfh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
json_decref (body);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Requesting URL '%s'\n",
- swfh->url);
- swfh->job = GNUNET_CURL_job_add2 (ctx,
- eh,
- swfh->post_ctx.headers,
- &handle_set_wire_fee_finished,
- swfh);
- if (NULL == swfh->job)
+ pmwfh->url);
+ pmwfh->job = GNUNET_CURL_job_add2 (pmwfh->ctx,
+ eh,
+ pmwfh->post_ctx.headers,
+ &handle_wire_fees_finished,
+ pmwfh);
+ if (NULL == pmwfh->job)
{
- TALER_EXCHANGE_management_set_wire_fees_cancel (swfh);
- return NULL;
+ TALER_curl_easy_post_finished (&pmwfh->post_ctx);
+ GNUNET_free (pmwfh->url);
+ pmwfh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return swfh;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_set_wire_fees_cancel (
- struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh)
+TALER_EXCHANGE_post_management_wire_fees_cancel (
+ struct TALER_EXCHANGE_PostManagementWireFeesHandle *pmwfh)
{
- if (NULL != swfh->job)
+ if (NULL != pmwfh->job)
{
- GNUNET_CURL_job_cancel (swfh->job);
- swfh->job = NULL;
+ GNUNET_CURL_job_cancel (pmwfh->job);
+ pmwfh->job = NULL;
}
- TALER_curl_easy_post_finished (&swfh->post_ctx);
- GNUNET_free (swfh->url);
- GNUNET_free (swfh);
+ TALER_curl_easy_post_finished (&pmwfh->post_ctx);
+ GNUNET_free (pmwfh->wire_method);
+ GNUNET_free (pmwfh->url);
+ GNUNET_free (pmwfh->base_url);
+ GNUNET_free (pmwfh);
}
+
+
+/* end of exchange_api_post-management-wire-fee.c */
diff --git a/src/lib/exchange_api_post-management-wire.c b/src/lib/exchange_api_post-management-wire.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015-2023 Taler Systems SA
+ Copyright (C) 2015-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
@@ -24,17 +24,22 @@
#include <gnunet/gnunet_curl_lib.h>
#include <microhttpd.h>
#include "taler/taler_exchange_service.h"
+#include "taler/taler-exchange/post-management-wire.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_ManagementWireEnableHandle
+struct TALER_EXCHANGE_PostManagementWireHandle
{
/**
- * The url for this request.
+ * The base URL for this request.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request, set during _start.
*/
char *url;
@@ -51,96 +56,142 @@ struct TALER_EXCHANGE_ManagementWireEnableHandle
/**
* Function to call with the result.
*/
- TALER_EXCHANGE_ManagementWireEnableCallback cb;
+ TALER_EXCHANGE_PostManagementWireCallback cb;
/**
* Closure for @a cb.
*/
- void *cb_cls;
+ TALER_EXCHANGE_POST_MANAGEMENT_WIRE_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
*/
struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Payto URI of the exchange's bank account.
+ */
+ char *payto_uri_str;
+
+ /**
+ * URL of the conversion service, or NULL.
+ */
+ char *conversion_url;
+
+ /**
+ * JSON encoding of debit restrictions (we hold a reference).
+ */
+ json_t *debit_restrictions;
+
+ /**
+ * JSON encoding of credit restrictions (we hold a reference).
+ */
+ json_t *credit_restrictions;
+
+ /**
+ * When was this decided?
+ */
+ struct GNUNET_TIME_Timestamp validity_start;
+
+ /**
+ * Signature affirming the wire addition.
+ */
+ struct TALER_MasterSignatureP master_sig1;
+
+ /**
+ * Signature affirming the validity of the account for clients.
+ */
+ struct TALER_MasterSignatureP master_sig2;
+
+ /**
+ * Label to use when showing the account to users (or NULL).
+ */
+ char *bank_label;
+
+ /**
+ * Priority for ordering the bank accounts.
+ */
+ int64_t priority;
+
};
/**
* Function called when we're done processing the
- * HTTP /management/wire request.
+ * HTTP POST /management/wire request.
*
- * @param cls the `struct TALER_EXCHANGE_ManagementAuditorEnableHandle *`
+ * @param cls the `struct TALER_EXCHANGE_PostManagementWireHandle`
* @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_wire_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_EXCHANGE_ManagementWireEnableHandle *wh = cls;
+ struct TALER_EXCHANGE_PostManagementWireHandle *pmwh = cls;
const json_t *json = response;
- struct TALER_EXCHANGE_ManagementWireEnableResponse wer = {
+ struct TALER_EXCHANGE_PostManagementWireResponse res = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- wh->job = NULL;
+ pmwh->job = NULL;
switch (response_code)
{
case 0:
/* no reply */
- wer.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- wer.hr.hint = "server offline?";
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = "server offline?";
break;
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_FORBIDDEN:
- wer.hr.ec = TALER_JSON_get_error_code (json);
- wer.hr.hint = TALER_JSON_get_error_hint (json);
+ 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",
- wh->url);
+ pmwh->url);
if (NULL != json)
{
- wer.hr.ec = TALER_JSON_get_error_code (json);
- wer.hr.hint = TALER_JSON_get_error_hint (json);
+ res.hr.ec = TALER_JSON_get_error_code (json);
+ res.hr.hint = TALER_JSON_get_error_hint (json);
}
else
{
- wer.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
- wer.hr.hint = TALER_ErrorCode_get_hint (wer.hr.ec);
+ res.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+ res.hr.hint = TALER_ErrorCode_get_hint (res.hr.ec);
}
break;
case MHD_HTTP_CONFLICT:
- wer.hr.ec = TALER_JSON_get_error_code (json);
- wer.hr.hint = TALER_JSON_get_error_hint (json);
+ 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);
- wer.hr.ec = TALER_JSON_get_error_code (json);
- wer.hr.hint = TALER_JSON_get_error_hint (json);
+ 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 management enable wire\n",
(unsigned int) response_code,
- (int) wer.hr.ec);
+ (int) res.hr.ec);
break;
}
- if (NULL != wh->cb)
+ if (NULL != pmwh->cb)
{
- wh->cb (wh->cb_cls,
- &wer);
- wh->cb = NULL;
+ pmwh->cb (pmwh->cb_cls,
+ &res);
+ pmwh->cb = NULL;
}
- TALER_EXCHANGE_management_enable_wire_cancel (wh);
+ TALER_EXCHANGE_post_management_wire_cancel (pmwh);
}
-struct TALER_EXCHANGE_ManagementWireEnableHandle *
-TALER_EXCHANGE_management_enable_wire (
+struct TALER_EXCHANGE_PostManagementWireHandle *
+TALER_EXCHANGE_post_management_wire_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
const struct TALER_FullPayto payto_uri,
@@ -149,67 +200,117 @@ TALER_EXCHANGE_management_enable_wire (
const json_t *credit_restrictions,
struct GNUNET_TIME_Timestamp validity_start,
const struct TALER_MasterSignatureP *master_sig1,
- const struct TALER_MasterSignatureP *master_sig2,
- const char *bank_label,
- int64_t priority,
- TALER_EXCHANGE_ManagementWireEnableCallback cb,
- void *cb_cls)
+ const struct TALER_MasterSignatureP *master_sig2)
{
- struct TALER_EXCHANGE_ManagementWireEnableHandle *wh;
- CURL *eh;
- json_t *body;
+ struct TALER_EXCHANGE_PostManagementWireHandle *pmwh;
+ char *msg;
+
+ 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;
+ }
+ pmwh = GNUNET_new (struct TALER_EXCHANGE_PostManagementWireHandle);
+ pmwh->ctx = ctx;
+ pmwh->base_url = GNUNET_strdup (url);
+ pmwh->payto_uri_str = GNUNET_strdup (payto_uri.full_payto);
+ pmwh->conversion_url = (NULL != conversion_url)
+ ? GNUNET_strdup (conversion_url)
+ : NULL;
+ pmwh->debit_restrictions = json_incref ((json_t *) debit_restrictions);
+ pmwh->credit_restrictions = json_incref ((json_t *) credit_restrictions);
+ pmwh->validity_start = validity_start;
+ pmwh->master_sig1 = *master_sig1;
+ pmwh->master_sig2 = *master_sig2;
+ return pmwh;
+}
+
+enum GNUNET_GenericReturnValue
+TALER_EXCHANGE_post_management_wire_set_options_ (
+ struct TALER_EXCHANGE_PostManagementWireHandle *pmwh,
+ unsigned int num_options,
+ const struct TALER_EXCHANGE_PostManagementWireOptionValue options[])
+{
+ for (unsigned int i = 0; i < num_options; i++)
{
- char *msg = TALER_payto_validate (payto_uri);
+ const struct TALER_EXCHANGE_PostManagementWireOptionValue *opt
+ = &options[i];
- if (NULL != msg)
+ switch (opt->option)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "payto URI is malformed: %s\n",
- msg);
- GNUNET_free (msg);
- return NULL;
+ case TALER_EXCHANGE_POST_MANAGEMENT_WIRE_OPTION_END:
+ return GNUNET_OK;
+ case TALER_EXCHANGE_POST_MANAGEMENT_WIRE_OPTION_BANK_LABEL:
+ GNUNET_free (pmwh->bank_label);
+ pmwh->bank_label = (NULL != opt->details.bank_label)
+ ? GNUNET_strdup (opt->details.bank_label)
+ : NULL;
+ break;
+ case TALER_EXCHANGE_POST_MANAGEMENT_WIRE_OPTION_PRIORITY:
+ pmwh->priority = opt->details.priority;
+ break;
+ default:
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
}
}
- wh = GNUNET_new (struct TALER_EXCHANGE_ManagementWireEnableHandle);
- wh->cb = cb;
- wh->cb_cls = cb_cls;
- wh->ctx = ctx;
- wh->url = TALER_url_join (url,
- "management/wire",
- NULL);
- if (NULL == wh->url)
+ return GNUNET_OK;
+}
+
+
+enum TALER_ErrorCode
+TALER_EXCHANGE_post_management_wire_start (
+ struct TALER_EXCHANGE_PostManagementWireHandle *pmwh,
+ TALER_EXCHANGE_PostManagementWireCallback cb,
+ TALER_EXCHANGE_POST_MANAGEMENT_WIRE_RESULT_CLOSURE *cb_cls)
+{
+ CURL *eh;
+ json_t *body;
+ struct TALER_FullPayto payto_uri = {
+ .full_payto = pmwh->payto_uri_str
+ };
+
+ pmwh->cb = cb;
+ pmwh->cb_cls = cb_cls;
+ pmwh->url = TALER_url_join (pmwh->base_url,
+ "management/wire",
+ NULL);
+ if (NULL == pmwh->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not construct request URL.\n");
- GNUNET_free (wh);
- return NULL;
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
}
body = GNUNET_JSON_PACK (
TALER_JSON_pack_full_payto ("payto_uri",
payto_uri),
GNUNET_JSON_pack_array_incref ("debit_restrictions",
- (json_t *) debit_restrictions),
+ pmwh->debit_restrictions),
GNUNET_JSON_pack_array_incref ("credit_restrictions",
- (json_t *) credit_restrictions),
+ pmwh->credit_restrictions),
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_string ("conversion_url",
- conversion_url)),
+ pmwh->conversion_url)),
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_string ("bank_label",
- bank_label)),
+ pmwh->bank_label)),
GNUNET_JSON_pack_int64 ("priority",
- priority),
+ pmwh->priority),
GNUNET_JSON_pack_data_auto ("master_sig_add",
- master_sig1),
+ &pmwh->master_sig1),
GNUNET_JSON_pack_data_auto ("master_sig_wire",
- master_sig2),
+ &pmwh->master_sig2),
GNUNET_JSON_pack_timestamp ("validity_start",
- validity_start));
- eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
+ pmwh->validity_start));
+ eh = TALER_EXCHANGE_curl_easy_get_ (pmwh->url);
if ( (NULL == eh) ||
(GNUNET_OK !=
- TALER_curl_easy_post (&wh->post_ctx,
+ TALER_curl_easy_post (&pmwh->post_ctx,
eh,
body)) )
{
@@ -217,38 +318,49 @@ TALER_EXCHANGE_management_enable_wire (
if (NULL != eh)
curl_easy_cleanup (eh);
json_decref (body);
- GNUNET_free (wh->url);
- GNUNET_free (wh);
- return NULL;
+ GNUNET_free (pmwh->url);
+ pmwh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
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_auditor_enable_finished,
- wh);
- if (NULL == wh->job)
+ pmwh->url);
+ pmwh->job = GNUNET_CURL_job_add2 (pmwh->ctx,
+ eh,
+ pmwh->post_ctx.headers,
+ &handle_wire_finished,
+ pmwh);
+ if (NULL == pmwh->job)
{
- TALER_EXCHANGE_management_enable_wire_cancel (wh);
- return NULL;
+ TALER_curl_easy_post_finished (&pmwh->post_ctx);
+ GNUNET_free (pmwh->url);
+ pmwh->url = NULL;
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
}
- return wh;
+ return TALER_EC_NONE;
}
void
-TALER_EXCHANGE_management_enable_wire_cancel (
- struct TALER_EXCHANGE_ManagementWireEnableHandle *wh)
+TALER_EXCHANGE_post_management_wire_cancel (
+ struct TALER_EXCHANGE_PostManagementWireHandle *pmwh)
{
- if (NULL != wh->job)
+ if (NULL != pmwh->job)
{
- GNUNET_CURL_job_cancel (wh->job);
- wh->job = NULL;
+ GNUNET_CURL_job_cancel (pmwh->job);
+ pmwh->job = NULL;
}
- TALER_curl_easy_post_finished (&wh->post_ctx);
- GNUNET_free (wh->url);
- GNUNET_free (wh);
+ TALER_curl_easy_post_finished (&pmwh->post_ctx);
+ json_decref (pmwh->debit_restrictions);
+ json_decref (pmwh->credit_restrictions);
+ GNUNET_free (pmwh->payto_uri_str);
+ GNUNET_free (pmwh->conversion_url);
+ GNUNET_free (pmwh->bank_label);
+ GNUNET_free (pmwh->url);
+ GNUNET_free (pmwh->base_url);
+ GNUNET_free (pmwh);
}
+
+
+/* end of exchange_api_post-management-wire.c */
diff --git a/src/testing/testing_api_cmd_auditor_add.c b/src/testing/testing_api_cmd_auditor_add.c
@@ -38,7 +38,7 @@ struct AuditorAddState
/**
* Auditor enable handle while operation is running.
*/
- struct TALER_EXCHANGE_ManagementAuditorEnableHandle *dh;
+ struct TALER_EXCHANGE_PostManagementAuditorsHandle *dh;
/**
* Our interpreter.
@@ -67,7 +67,7 @@ struct AuditorAddState
static void
auditor_add_cb (
void *cls,
- const struct TALER_EXCHANGE_ManagementAuditorEnableResponse *r)
+ const struct TALER_EXCHANGE_PostManagementAuditorsResponse *r)
{
struct AuditorAddState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &r->hr;
@@ -155,22 +155,21 @@ auditor_add_run (void *cls,
master_priv,
&master_sig);
}
- ds->dh = TALER_EXCHANGE_management_enable_auditor (
+ ds->dh = TALER_EXCHANGE_post_management_auditors_create (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
auditor_pub,
auditor_url,
"test-case auditor", /* human-readable auditor name */
now,
- &master_sig,
- &auditor_add_cb,
- ds);
+ &master_sig);
if (NULL == ds->dh)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
+ TALER_EXCHANGE_post_management_auditors_start (ds->dh, &auditor_add_cb, ds);
}
@@ -191,7 +190,7 @@ auditor_add_cleanup (void *cls,
{
TALER_TESTING_command_incomplete (ds->is,
cmd->label);
- TALER_EXCHANGE_management_enable_auditor_cancel (ds->dh);
+ TALER_EXCHANGE_post_management_auditors_cancel (ds->dh);
ds->dh = NULL;
}
GNUNET_free (ds);
diff --git a/src/testing/testing_api_cmd_auditor_del.c b/src/testing/testing_api_cmd_auditor_del.c
@@ -38,7 +38,7 @@ struct AuditorDelState
/**
* Auditor enable handle while operation is running.
*/
- struct TALER_EXCHANGE_ManagementAuditorDisableHandle *dh;
+ struct TALER_EXCHANGE_PostManagementAuditorsDisableHandle *dh;
/**
* Our interpreter.
@@ -67,7 +67,7 @@ struct AuditorDelState
static void
auditor_del_cb (
void *cls,
- const struct TALER_EXCHANGE_ManagementAuditorDisableResponse *adr)
+ const struct TALER_EXCHANGE_PostManagementAuditorsDisableResponse *adr)
{
struct AuditorDelState *ds = cls;
@@ -148,20 +148,19 @@ auditor_del_run (void *cls,
master_priv,
&master_sig);
}
- ds->dh = TALER_EXCHANGE_management_disable_auditor (
+ ds->dh = TALER_EXCHANGE_post_management_auditors_disable_create (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
auditor_pub,
now,
- &master_sig,
- &auditor_del_cb,
- ds);
+ &master_sig);
if (NULL == ds->dh)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
+ TALER_EXCHANGE_post_management_auditors_disable_start (ds->dh, &auditor_del_cb, ds);
}
@@ -182,7 +181,7 @@ auditor_del_cleanup (void *cls,
{
TALER_TESTING_command_incomplete (ds->is,
cmd->label);
- TALER_EXCHANGE_management_disable_auditor_cancel (ds->dh);
+ TALER_EXCHANGE_post_management_auditors_disable_cancel (ds->dh);
ds->dh = NULL;
}
GNUNET_free (ds);
diff --git a/src/testing/testing_api_cmd_revoke_denom_key.c b/src/testing/testing_api_cmd_revoke_denom_key.c
@@ -51,7 +51,7 @@ struct RevokeState
/**
* Handle for the operation.
*/
- struct TALER_EXCHANGE_ManagementRevokeDenominationKeyHandle *kh;
+ struct TALER_EXCHANGE_PostManagementDenominationsRevokeHandle *kh;
/**
* Should we use a bogus signature?
@@ -70,7 +70,7 @@ struct RevokeState
static void
success_cb (
void *cls,
- const struct TALER_EXCHANGE_ManagementRevokeDenominationResponse *rdr)
+ const struct TALER_EXCHANGE_PostManagementDenominationsRevokeResponse *rdr)
{
struct RevokeState *rs = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &rdr->hr;
@@ -101,7 +101,7 @@ revoke_cleanup (void *cls,
if (NULL != rs->kh)
{
- TALER_EXCHANGE_management_revoke_denomination_key_cancel (rs->kh);
+ TALER_EXCHANGE_post_management_denominations_revoke_cancel (rs->kh);
rs->kh = NULL;
}
GNUNET_free (rs);
@@ -213,19 +213,18 @@ revoke_run (void *cls,
master_priv,
&master_sig);
}
- rs->kh = TALER_EXCHANGE_management_revoke_denomination_key (
+ rs->kh = TALER_EXCHANGE_post_management_denominations_revoke_create (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
&denom_pub->h_key,
- &master_sig,
- &success_cb,
- rs);
+ &master_sig);
if (NULL == rs->kh)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
+ TALER_EXCHANGE_post_management_denominations_revoke_start (rs->kh, &success_cb, rs);
}
diff --git a/src/testing/testing_api_cmd_revoke_sign_key.c b/src/testing/testing_api_cmd_revoke_sign_key.c
@@ -51,7 +51,7 @@ struct RevokeState
/**
* Handle for the operation.
*/
- struct TALER_EXCHANGE_ManagementRevokeSigningKeyHandle *kh;
+ struct TALER_EXCHANGE_PostManagementSignkeysRevokeHandle *kh;
/**
* Should we use a bogus signature?
@@ -70,7 +70,7 @@ struct RevokeState
static void
success_cb (
void *cls,
- const struct TALER_EXCHANGE_ManagementRevokeSigningKeyResponse *rsr)
+ const struct TALER_EXCHANGE_PostManagementSignkeysRevokeResponse *rsr)
{
struct RevokeState *rs = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &rsr->hr;
@@ -101,7 +101,7 @@ revoke_cleanup (void *cls,
if (NULL != rs->kh)
{
- TALER_EXCHANGE_management_revoke_signing_key_cancel (rs->kh);
+ TALER_EXCHANGE_post_management_signkeys_revoke_cancel (rs->kh);
rs->kh = NULL;
}
GNUNET_free (rs);
@@ -213,19 +213,18 @@ revoke_run (void *cls,
master_priv,
&master_sig);
}
- rs->kh = TALER_EXCHANGE_management_revoke_signing_key (
+ rs->kh = TALER_EXCHANGE_post_management_signkeys_revoke_create (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
exchange_pub,
- &master_sig,
- &success_cb,
- rs);
+ &master_sig);
if (NULL == rs->kh)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
+ TALER_EXCHANGE_post_management_signkeys_revoke_start (rs->kh, &success_cb, rs);
}
diff --git a/src/testing/testing_api_cmd_set_wire_fee.c b/src/testing/testing_api_cmd_set_wire_fee.c
@@ -38,7 +38,7 @@ struct WireFeeState
/**
* Wire enable handle while operation is running.
*/
- struct TALER_EXCHANGE_ManagementSetWireFeeHandle *dh;
+ struct TALER_EXCHANGE_PostManagementWireFeesHandle *dh;
/**
* Our interpreter.
@@ -81,7 +81,7 @@ struct WireFeeState
*/
static void
wire_add_cb (void *cls,
- const struct TALER_EXCHANGE_ManagementSetWireFeeResponse *sfr)
+ const struct TALER_EXCHANGE_PostManagementWireFeesResponse *sfr)
{
struct WireFeeState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &sfr->hr;
@@ -183,22 +183,21 @@ wire_add_run (void *cls,
master_priv,
&master_sig);
}
- ds->dh = TALER_EXCHANGE_management_set_wire_fees (
+ ds->dh = TALER_EXCHANGE_post_management_wire_fees_create (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
ds->wire_method,
start_time,
end_time,
&fees,
- &master_sig,
- &wire_add_cb,
- ds);
+ &master_sig);
if (NULL == ds->dh)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
+ TALER_EXCHANGE_post_management_wire_fees_start (ds->dh, &wire_add_cb, ds);
}
@@ -219,7 +218,7 @@ wire_add_cleanup (void *cls,
{
TALER_TESTING_command_incomplete (ds->is,
cmd->label);
- TALER_EXCHANGE_management_set_wire_fees_cancel (ds->dh);
+ TALER_EXCHANGE_post_management_wire_fees_cancel (ds->dh);
ds->dh = NULL;
}
GNUNET_free (ds);
diff --git a/src/testing/testing_api_cmd_wire_add.c b/src/testing/testing_api_cmd_wire_add.c
@@ -38,7 +38,7 @@ struct WireAddState
/**
* Wire enable handle while operation is running.
*/
- struct TALER_EXCHANGE_ManagementWireEnableHandle *dh;
+ struct TALER_EXCHANGE_PostManagementWireHandle *dh;
/**
* Our interpreter.
@@ -71,7 +71,7 @@ struct WireAddState
*/
static void
wire_add_cb (void *cls,
- const struct TALER_EXCHANGE_ManagementWireEnableResponse *wer)
+ const struct TALER_EXCHANGE_PostManagementWireResponse *wer)
{
struct WireAddState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &wer->hr;
@@ -167,7 +167,7 @@ wire_add_run (void *cls,
master_priv,
&master_sig2);
}
- ds->dh = TALER_EXCHANGE_management_enable_wire (
+ ds->dh = TALER_EXCHANGE_post_management_wire_create (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
ds->payto_uri,
@@ -176,11 +176,7 @@ wire_add_run (void *cls,
credit_rest,
now,
&master_sig1,
- &master_sig2,
- NULL,
- 0LL,
- &wire_add_cb,
- ds);
+ &master_sig2);
json_decref (debit_rest);
json_decref (credit_rest);
if (NULL == ds->dh)
@@ -189,6 +185,7 @@ wire_add_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
+ TALER_EXCHANGE_post_management_wire_start (ds->dh, &wire_add_cb, ds);
}
@@ -209,7 +206,7 @@ wire_add_cleanup (void *cls,
{
TALER_TESTING_command_incomplete (ds->is,
cmd->label);
- TALER_EXCHANGE_management_enable_wire_cancel (ds->dh);
+ TALER_EXCHANGE_post_management_wire_cancel (ds->dh);
ds->dh = NULL;
}
GNUNET_free (ds);
diff --git a/src/testing/testing_api_cmd_wire_del.c b/src/testing/testing_api_cmd_wire_del.c
@@ -38,7 +38,7 @@ struct WireDelState
/**
* Wire enable handle while operation is running.
*/
- struct TALER_EXCHANGE_ManagementWireDisableHandle *dh;
+ struct TALER_EXCHANGE_PostManagementWireDisableHandle *dh;
/**
* Our interpreter.
@@ -71,7 +71,7 @@ struct WireDelState
*/
static void
wire_del_cb (void *cls,
- const struct TALER_EXCHANGE_ManagementWireDisableResponse *wdr)
+ const struct TALER_EXCHANGE_PostManagementWireDisableResponse *wdr)
{
struct WireDelState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &wdr->hr;
@@ -151,20 +151,19 @@ wire_del_run (void *cls,
master_priv,
&master_sig);
}
- ds->dh = TALER_EXCHANGE_management_disable_wire (
+ ds->dh = TALER_EXCHANGE_post_management_wire_disable_create (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
ds->payto_uri,
now,
- &master_sig,
- &wire_del_cb,
- ds);
+ &master_sig);
if (NULL == ds->dh)
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (is);
return;
}
+ TALER_EXCHANGE_post_management_wire_disable_start (ds->dh, &wire_del_cb, ds);
}
@@ -185,7 +184,7 @@ wire_del_cleanup (void *cls,
{
TALER_TESTING_command_incomplete (ds->is,
cmd->label);
- TALER_EXCHANGE_management_disable_wire_cancel (ds->dh);
+ TALER_EXCHANGE_post_management_wire_disable_cancel (ds->dh);
ds->dh = NULL;
}
GNUNET_free (ds);