commit 8a0b9213289869830a18167fa60626b4d51468c0
parent 82cb92a7ba419d9baba2c486525cc30d9511fe4e
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 25 Mar 2026 00:26:53 +0100
add missing implementation of 2nd token deletion endpoint
Diffstat:
8 files changed, 405 insertions(+), 81 deletions(-)
diff --git a/src/include/taler/taler-merchant/Makefile.am b/src/include/taler/taler-merchant/Makefile.am
@@ -11,6 +11,7 @@ talermerchantinclude_HEADERS = \
delete-private-otp-devices-DEVICE_ID.h \
delete-private-products-PRODUCT_ID.h \
delete-private-templates-TEMPLATE_ID.h \
+ delete-private-token.h \
delete-private-tokens-SERIAL.h \
delete-private-transfers-TID.h \
delete-private-units-UNIT.h \
diff --git a/src/include/taler/taler-merchant/delete-private-token.h b/src/include/taler/taler-merchant/delete-private-token.h
@@ -0,0 +1,110 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2014-2026 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License along with
+ TALER; see the file COPYING.LGPL. If not, see
+ <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file include/taler/taler-merchant/delete-private-token.h
+ * @brief C interface for DELETE /private/token
+ * @author Christian Grothoff
+ */
+#ifndef _TALER_MERCHANT__DELETE_PRIVATE_TOKEN_H
+#define _TALER_MERCHANT__DELETE_PRIVATE_TOKEN_H
+
+#include <taler/taler-merchant/common.h>
+
+
+/**
+ * Handle for a DELETE /private/token operation.
+ */
+struct TALER_MERCHANT_DeletePrivateTokenHandle;
+
+
+/**
+ * Set up DELETE /private/token operation.
+ * Note that you must explicitly start the operation after setup.
+ *
+ * @param ctx curl context
+ * @param url merchant backend base URL
+ * @param instance_id identifier of the instance
+ * @return handle to operation, NULL on error
+ */
+struct TALER_MERCHANT_DeletePrivateTokenHandle *
+TALER_MERCHANT_delete_private_token_create (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const char *instance_id);
+
+
+/**
+ * Response details for a DELETE /private/token request.
+ */
+struct TALER_MERCHANT_DeletePrivateTokenResponse
+{
+ /**
+ * HTTP response details.
+ */
+ struct TALER_MERCHANT_HttpResponse hr;
+};
+
+
+#ifndef TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE
+/**
+ * Type of the closure used by
+ * the #TALER_MERCHANT_DeletePrivateTokenCallback.
+ */
+#define TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE void
+#endif /* TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE */
+
+/**
+ * Type of the function that receives the result of a
+ * DELETE /private/token request.
+ *
+ * @param cls closure
+ * @param result result returned by the HTTP server
+ */
+typedef void
+(*TALER_MERCHANT_DeletePrivateTokenCallback)(
+ TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cls,
+ const struct TALER_MERCHANT_DeletePrivateTokenResponse *result);
+
+
+/**
+ * Start DELETE /private/token operation.
+ *
+ * @param[in,out] handle operation to start
+ * @param cb function to call with the result
+ * @param cb_cls closure for @a cb
+ * @return status code, #TALER_EC_NONE on success
+ */
+enum TALER_ErrorCode
+TALER_MERCHANT_delete_private_token_start (
+ struct TALER_MERCHANT_DeletePrivateTokenHandle *handle,
+ TALER_MERCHANT_DeletePrivateTokenCallback cb,
+ TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls);
+
+
+/**
+ * Cancel DELETE /private/token operation.
+ * This function must not be called by clients after the
+ * callback has been invoked.
+ *
+ * @param[in] handle operation to cancel
+ */
+void
+TALER_MERCHANT_delete_private_token_cancel (
+ struct TALER_MERCHANT_DeletePrivateTokenHandle *handle);
+
+
+#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TOKEN_H */
diff --git a/src/include/taler/taler-merchant/delete-private-tokens-SERIAL.h b/src/include/taler/taler-merchant/delete-private-tokens-SERIAL.h
@@ -28,7 +28,7 @@
/**
* Handle for a DELETE /private/tokens/$SERIAL operation.
*/
-struct TALER_MERCHANT_DeletePrivateTokenHandle;
+struct TALER_MERCHANT_DeletePrivateTokensSerialHandle;
/**
@@ -38,19 +38,21 @@ struct TALER_MERCHANT_DeletePrivateTokenHandle;
* @param ctx curl context
* @param url merchant backend base URL
* @param instance_id identifier of the instance
+ * @param serial serial number of the token to delete
* @return handle to operation, NULL on error
*/
-struct TALER_MERCHANT_DeletePrivateTokenHandle *
-TALER_MERCHANT_delete_private_token_create (
+struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *
+TALER_MERCHANT_delete_private_tokens_serial_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
- const char *instance_id);
+ const char *instance_id,
+ uint64_t serial);
/**
* Response details for a DELETE /private/tokens/$SERIAL request.
*/
-struct TALER_MERCHANT_DeletePrivateTokenResponse
+struct TALER_MERCHANT_DeletePrivateTokensSerialResponse
{
/**
* HTTP response details.
@@ -59,13 +61,13 @@ struct TALER_MERCHANT_DeletePrivateTokenResponse
};
-#ifndef TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE
+#ifndef TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE
/**
* Type of the closure used by
- * the #TALER_MERCHANT_DeletePrivateTokenCallback.
+ * the #TALER_MERCHANT_DeletePrivateTokensSerialCallback.
*/
-#define TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE void
-#endif /* TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE */
+#define TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE void
+#endif /* TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE */
/**
* Type of the function that receives the result of a
@@ -75,9 +77,9 @@ struct TALER_MERCHANT_DeletePrivateTokenResponse
* @param result result returned by the HTTP server
*/
typedef void
-(*TALER_MERCHANT_DeletePrivateTokenCallback)(
- TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cls,
- const struct TALER_MERCHANT_DeletePrivateTokenResponse *result);
+(*TALER_MERCHANT_DeletePrivateTokensSerialCallback)(
+ TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE *cls,
+ const struct TALER_MERCHANT_DeletePrivateTokensSerialResponse *result);
/**
@@ -89,10 +91,10 @@ typedef void
* @return status code, #TALER_EC_NONE on success
*/
enum TALER_ErrorCode
-TALER_MERCHANT_delete_private_token_start (
- struct TALER_MERCHANT_DeletePrivateTokenHandle *handle,
- TALER_MERCHANT_DeletePrivateTokenCallback cb,
- TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls);
+TALER_MERCHANT_delete_private_tokens_serial_start (
+ struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *handle,
+ TALER_MERCHANT_DeletePrivateTokensSerialCallback cb,
+ TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE *cb_cls);
/**
@@ -103,8 +105,8 @@ TALER_MERCHANT_delete_private_token_start (
* @param[in] handle operation to cancel
*/
void
-TALER_MERCHANT_delete_private_token_cancel (
- struct TALER_MERCHANT_DeletePrivateTokenHandle *handle);
+TALER_MERCHANT_delete_private_tokens_serial_cancel (
+ struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *handle);
#endif /* _TALER_MERCHANT__DELETE_PRIVATE_TOKENS_SERIAL_H */
diff --git a/src/include/taler/taler_merchant_service.h b/src/include/taler/taler_merchant_service.h
@@ -44,6 +44,7 @@
#include <taler/taler-merchant/post-management-instances.h>
#include <taler/taler-merchant/post-management-instances-INSTANCE-auth.h>
#include <taler/taler-merchant/post-private-token.h>
+#include <taler/taler-merchant/delete-private-token.h>
#include <taler/taler-merchant/delete-private-tokens-SERIAL.h>
#include <taler/taler-merchant/get-private-orders.h>
#include <taler/taler-merchant/post-private-orders.h>
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
@@ -23,6 +23,7 @@ libtalermerchant_la_SOURCES = \
merchant_api_delete-private-otp-devices-DEVICE_ID.c \
merchant_api_delete-private-products-PRODUCT_ID.c \
merchant_api_delete-private-templates-TEMPLATE_ID.c \
+ merchant_api_delete-private-token.c \
merchant_api_delete-private-tokens-SERIAL.c \
merchant_api_delete-private-transfers-TID.c \
merchant_api_delete-private-units-UNIT.c \
diff --git a/src/lib/merchant_api_delete-private-token.c b/src/lib/merchant_api_delete-private-token.c
@@ -0,0 +1,198 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2025-2026 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License along with
+ TALER; see the file COPYING.LGPL. If not, see
+ <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file merchant_api_delete-private-token.c
+ * @brief Implementation of the DELETE /private/token request
+ * @author Christian Grothoff
+ */
+#include "taler/platform.h"
+#include <curl/curl.h>
+#include <jansson.h>
+#include <microhttpd.h> /* just for HTTP status codes */
+#include <gnunet/gnunet_util_lib.h>
+#include <gnunet/gnunet_curl_lib.h>
+#include <taler/taler-merchant/delete-private-token.h>
+#include "merchant_api_curl_defaults.h"
+#include <taler/taler_json_lib.h>
+
+
+/**
+ * Handle for a DELETE /private/token operation.
+ */
+struct TALER_MERCHANT_DeletePrivateTokenHandle
+{
+ /**
+ * Base URL of the merchant backend.
+ */
+ char *base_url;
+
+ /**
+ * The full URL for this request.
+ */
+ char *url;
+
+ /**
+ * Handle for the request.
+ */
+ struct GNUNET_CURL_Job *job;
+
+ /**
+ * Function to call with the result.
+ */
+ TALER_MERCHANT_DeletePrivateTokenCallback cb;
+
+ /**
+ * Closure for @a cb.
+ */
+ TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls;
+
+ /**
+ * Reference to the execution context.
+ */
+ struct GNUNET_CURL_Context *ctx;
+
+ /**
+ * Identifier of the instance whose token to delete.
+ */
+ char *instance_id;
+};
+
+
+/**
+ * Function called when we're done processing the
+ * HTTP DELETE /private/token request.
+ *
+ * @param cls the `struct TALER_MERCHANT_DeletePrivateTokenHandle`
+ * @param response_code HTTP response code, 0 on error
+ * @param response response body, NULL if not in JSON
+ */
+static void
+handle_delete_token_finished (void *cls,
+ long response_code,
+ const void *response)
+{
+ struct TALER_MERCHANT_DeletePrivateTokenHandle *dth = cls;
+ const json_t *json = response;
+ struct TALER_MERCHANT_DeletePrivateTokenResponse dtr = {
+ .hr.http_status = (unsigned int) response_code,
+ .hr.reply = json
+ };
+
+ dth->job = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Got DELETE /instances/$ID/private/token response with status code %u\n",
+ (unsigned int) response_code);
+ switch (response_code)
+ {
+ case MHD_HTTP_NO_CONTENT:
+ break;
+ case MHD_HTTP_UNAUTHORIZED:
+ dtr.hr.ec = TALER_JSON_get_error_code (json);
+ dtr.hr.hint = TALER_JSON_get_error_hint (json);
+ break;
+ case MHD_HTTP_NOT_FOUND:
+ dtr.hr.ec = TALER_JSON_get_error_code (json);
+ dtr.hr.hint = TALER_JSON_get_error_hint (json);
+ break;
+ default:
+ dtr.hr.ec = TALER_JSON_get_error_code (json);
+ dtr.hr.hint = TALER_JSON_get_error_hint (json);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unexpected response code %u/%d for DELETE /instances/$ID/private/token\n",
+ (unsigned int) response_code,
+ (int) dtr.hr.ec);
+ break;
+ }
+ dth->cb (dth->cb_cls,
+ &dtr);
+ TALER_MERCHANT_delete_private_token_cancel (dth);
+}
+
+
+struct TALER_MERCHANT_DeletePrivateTokenHandle *
+TALER_MERCHANT_delete_private_token_create (
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ const char *instance_id)
+{
+ struct TALER_MERCHANT_DeletePrivateTokenHandle *dth;
+
+ dth = GNUNET_new (struct TALER_MERCHANT_DeletePrivateTokenHandle);
+ dth->ctx = ctx;
+ dth->base_url = GNUNET_strdup (url);
+ dth->instance_id = GNUNET_strdup (instance_id);
+ return dth;
+}
+
+
+enum TALER_ErrorCode
+TALER_MERCHANT_delete_private_token_start (
+ struct TALER_MERCHANT_DeletePrivateTokenHandle *dth,
+ TALER_MERCHANT_DeletePrivateTokenCallback cb,
+ TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls)
+{
+ CURL *eh;
+
+ dth->cb = cb;
+ dth->cb_cls = cb_cls;
+ {
+ char *path;
+
+ GNUNET_asprintf (&path,
+ "instances/%s/private/token",
+ dth->instance_id);
+ dth->url = TALER_url_join (dth->base_url,
+ path,
+ NULL);
+ GNUNET_free (path);
+ }
+ if (NULL == dth->url)
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
+ eh = TALER_MERCHANT_curl_easy_get_ (dth->url);
+ if (NULL == eh)
+ return TALER_EC_GENERIC_CONFIGURATION_INVALID;
+ GNUNET_assert (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_CUSTOMREQUEST,
+ MHD_HTTP_METHOD_DELETE));
+ dth->job = GNUNET_CURL_job_add (dth->ctx,
+ eh,
+ &handle_delete_token_finished,
+ dth);
+ if (NULL == dth->job)
+ return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
+ return TALER_EC_NONE;
+}
+
+
+void
+TALER_MERCHANT_delete_private_token_cancel (
+ struct TALER_MERCHANT_DeletePrivateTokenHandle *dth)
+{
+ if (NULL != dth->job)
+ {
+ GNUNET_CURL_job_cancel (dth->job);
+ dth->job = NULL;
+ }
+ GNUNET_free (dth->url);
+ GNUNET_free (dth->instance_id);
+ GNUNET_free (dth->base_url);
+ GNUNET_free (dth);
+}
+
+
+/* end of merchant_api_delete-private-token.c */
diff --git a/src/lib/merchant_api_delete-private-tokens-SERIAL.c b/src/lib/merchant_api_delete-private-tokens-SERIAL.c
@@ -15,7 +15,7 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file merchant_api_delete-private-tokens-SERIAL-new.c
+ * @file merchant_api_delete-private-tokens-SERIAL.c
* @brief Implementation of the DELETE /private/tokens/$SERIAL request
* @author Christian Grothoff
*/
@@ -33,7 +33,7 @@
/**
* Handle for a DELETE /private/tokens/$SERIAL operation.
*/
-struct TALER_MERCHANT_DeletePrivateTokenHandle
+struct TALER_MERCHANT_DeletePrivateTokensSerialHandle
{
/**
* Base URL of the merchant backend.
@@ -53,12 +53,12 @@ struct TALER_MERCHANT_DeletePrivateTokenHandle
/**
* Function to call with the result.
*/
- TALER_MERCHANT_DeletePrivateTokenCallback cb;
+ TALER_MERCHANT_DeletePrivateTokensSerialCallback cb;
/**
* Closure for @a cb.
*/
- TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls;
+ TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE *cb_cls;
/**
* Reference to the execution context.
@@ -66,9 +66,14 @@ struct TALER_MERCHANT_DeletePrivateTokenHandle
struct GNUNET_CURL_Context *ctx;
/**
- * Identifier of the instance whose token to delete.
+ * Identifier of the instance.
*/
char *instance_id;
+
+ /**
+ * Serial number of the token to delete.
+ */
+ uint64_t serial;
};
@@ -76,123 +81,130 @@ struct TALER_MERCHANT_DeletePrivateTokenHandle
* Function called when we're done processing the
* HTTP DELETE /private/tokens/$SERIAL request.
*
- * @param cls the `struct TALER_MERCHANT_DeletePrivateTokenHandle`
+ * @param cls the `struct TALER_MERCHANT_DeletePrivateTokensSerialHandle`
* @param response_code HTTP response code, 0 on error
* @param response response body, NULL if not in JSON
*/
static void
-handle_delete_token_finished (void *cls,
- long response_code,
- const void *response)
+handle_delete_tokens_serial_finished (void *cls,
+ long response_code,
+ const void *response)
{
- struct TALER_MERCHANT_DeletePrivateTokenHandle *dth = cls;
+ struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *dtsh = cls;
const json_t *json = response;
- struct TALER_MERCHANT_DeletePrivateTokenResponse dtr = {
+ struct TALER_MERCHANT_DeletePrivateTokensSerialResponse dtsr = {
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- dth->job = NULL;
+ dtsh->job = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got DELETE /instances/$ID/private/token response with status code %u\n",
+ "Got DELETE /instances/$ID/private/tokens/$SERIAL response with status code %u\n",
(unsigned int) response_code);
switch (response_code)
{
case MHD_HTTP_NO_CONTENT:
break;
case MHD_HTTP_UNAUTHORIZED:
- dtr.hr.ec = TALER_JSON_get_error_code (json);
- dtr.hr.hint = TALER_JSON_get_error_hint (json);
+ dtsr.hr.ec = TALER_JSON_get_error_code (json);
+ dtsr.hr.hint = TALER_JSON_get_error_hint (json);
+ break;
+ case MHD_HTTP_FORBIDDEN:
+ dtsr.hr.ec = TALER_JSON_get_error_code (json);
+ dtsr.hr.hint = TALER_JSON_get_error_hint (json);
break;
case MHD_HTTP_NOT_FOUND:
- dtr.hr.ec = TALER_JSON_get_error_code (json);
- dtr.hr.hint = TALER_JSON_get_error_hint (json);
+ dtsr.hr.ec = TALER_JSON_get_error_code (json);
+ dtsr.hr.hint = TALER_JSON_get_error_hint (json);
break;
default:
- dtr.hr.ec = TALER_JSON_get_error_code (json);
- dtr.hr.hint = TALER_JSON_get_error_hint (json);
+ dtsr.hr.ec = TALER_JSON_get_error_code (json);
+ dtsr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u/%d for DELETE /instances/$ID/private/token\n",
+ "Unexpected response code %u/%d for DELETE /instances/$ID/private/tokens/$SERIAL\n",
(unsigned int) response_code,
- (int) dtr.hr.ec);
+ (int) dtsr.hr.ec);
break;
}
- dth->cb (dth->cb_cls,
- &dtr);
- TALER_MERCHANT_delete_private_token_cancel (dth);
+ dtsh->cb (dtsh->cb_cls,
+ &dtsr);
+ TALER_MERCHANT_delete_private_tokens_serial_cancel (dtsh);
}
-struct TALER_MERCHANT_DeletePrivateTokenHandle *
-TALER_MERCHANT_delete_private_token_create (
+struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *
+TALER_MERCHANT_delete_private_tokens_serial_create (
struct GNUNET_CURL_Context *ctx,
const char *url,
- const char *instance_id)
+ const char *instance_id,
+ uint64_t serial)
{
- struct TALER_MERCHANT_DeletePrivateTokenHandle *dth;
-
- dth = GNUNET_new (struct TALER_MERCHANT_DeletePrivateTokenHandle);
- dth->ctx = ctx;
- dth->base_url = GNUNET_strdup (url);
- dth->instance_id = GNUNET_strdup (instance_id);
- return dth;
+ struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *dtsh;
+
+ dtsh = GNUNET_new (struct TALER_MERCHANT_DeletePrivateTokensSerialHandle);
+ dtsh->ctx = ctx;
+ dtsh->base_url = GNUNET_strdup (url);
+ dtsh->instance_id = GNUNET_strdup (instance_id);
+ dtsh->serial = serial;
+ return dtsh;
}
enum TALER_ErrorCode
-TALER_MERCHANT_delete_private_token_start (
- struct TALER_MERCHANT_DeletePrivateTokenHandle *dth,
- TALER_MERCHANT_DeletePrivateTokenCallback cb,
- TALER_MERCHANT_DELETE_PRIVATE_TOKEN_RESULT_CLOSURE *cb_cls)
+TALER_MERCHANT_delete_private_tokens_serial_start (
+ struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *dtsh,
+ TALER_MERCHANT_DeletePrivateTokensSerialCallback cb,
+ TALER_MERCHANT_DELETE_PRIVATE_TOKENS_SERIAL_RESULT_CLOSURE *cb_cls)
{
CURL *eh;
- dth->cb = cb;
- dth->cb_cls = cb_cls;
+ dtsh->cb = cb;
+ dtsh->cb_cls = cb_cls;
{
char *path;
GNUNET_asprintf (&path,
- "instances/%s/private/token",
- dth->instance_id);
- dth->url = TALER_url_join (dth->base_url,
- path,
- NULL);
+ "instances/%s/private/tokens/%llu",
+ dtsh->instance_id,
+ (unsigned long long) dtsh->serial);
+ dtsh->url = TALER_url_join (dtsh->base_url,
+ path,
+ NULL);
GNUNET_free (path);
}
- if (NULL == dth->url)
+ if (NULL == dtsh->url)
return TALER_EC_GENERIC_CONFIGURATION_INVALID;
- eh = TALER_MERCHANT_curl_easy_get_ (dth->url);
+ eh = TALER_MERCHANT_curl_easy_get_ (dtsh->url);
if (NULL == eh)
return TALER_EC_GENERIC_CONFIGURATION_INVALID;
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_CUSTOMREQUEST,
MHD_HTTP_METHOD_DELETE));
- dth->job = GNUNET_CURL_job_add (dth->ctx,
- eh,
- &handle_delete_token_finished,
- dth);
- if (NULL == dth->job)
+ dtsh->job = GNUNET_CURL_job_add (dtsh->ctx,
+ eh,
+ &handle_delete_tokens_serial_finished,
+ dtsh);
+ if (NULL == dtsh->job)
return TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE;
return TALER_EC_NONE;
}
void
-TALER_MERCHANT_delete_private_token_cancel (
- struct TALER_MERCHANT_DeletePrivateTokenHandle *dth)
+TALER_MERCHANT_delete_private_tokens_serial_cancel (
+ struct TALER_MERCHANT_DeletePrivateTokensSerialHandle *dtsh)
{
- if (NULL != dth->job)
+ if (NULL != dtsh->job)
{
- GNUNET_CURL_job_cancel (dth->job);
- dth->job = NULL;
+ GNUNET_CURL_job_cancel (dtsh->job);
+ dtsh->job = NULL;
}
- GNUNET_free (dth->url);
- GNUNET_free (dth->instance_id);
- GNUNET_free (dth->base_url);
- GNUNET_free (dth);
+ GNUNET_free (dtsh->url);
+ GNUNET_free (dtsh->instance_id);
+ GNUNET_free (dtsh->base_url);
+ GNUNET_free (dtsh);
}
-/* end of merchant_api_delete-private-tokens-SERIAL-new.c */
+/* end of merchant_api_delete-private-tokens-SERIAL.c */
diff --git a/src/testing/testing_api_cmd_instance_token.c b/src/testing/testing_api_cmd_instance_token.c
@@ -257,7 +257,6 @@ set_token_instance_run (void *cls,
/**
* Run the "token /instances/$ID" CMD.
*
- *
* @param cls closure.
* @param cmd command being run now.
* @param is interpreter state.