summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/taler-merchant-httpd_private-delete-instances-ID.c89
-rw-r--r--src/backend/taler-merchant-httpd_private-delete-instances-ID.h41
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c56
-rw-r--r--src/include/taler_merchant_service.h86
-rw-r--r--src/include/taler_merchantdb_plugin.h8
-rw-r--r--src/lib/Makefile.am7
-rw-r--r--src/lib/merchant_api_delete_instances_ID.c260
-rw-r--r--src/lib/merchant_api_get_config.c (renamed from src/lib/merchant_api_config_get.c)2
-rw-r--r--src/lib/merchant_api_get_instances.c (renamed from src/lib/merchant_api_instances_get.c)6
9 files changed, 533 insertions, 22 deletions
diff --git a/src/backend/taler-merchant-httpd_private-delete-instances-ID.c b/src/backend/taler-merchant-httpd_private-delete-instances-ID.c
new file mode 100644
index 00000000..2807318e
--- /dev/null
+++ b/src/backend/taler-merchant-httpd_private-delete-instances-ID.c
@@ -0,0 +1,89 @@
+/*
+ This file is part of TALER
+ (C) 2020 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file backend/taler-merchant-httpd_private-delete-instances-ID.c
+ * @brief implement DELETE /instances/$ID
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "taler-merchant-httpd_private-delete-instances-ID.h"
+#include <taler/taler_json_lib.h>
+
+
+/**
+ * Handle a DELETE "/instances/$ID" request.
+ *
+ * @param rh context of the handler
+ * @param connection the MHD connection to handle
+ * @param[in,out] hc context with further information about the request
+ * @return MHD result code
+ */
+MHD_RESULT
+TMH_private_delete_instances_ID (const struct TMH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ struct TMH_HandlerContext *hc)
+{
+ struct TMH_MerchantInstance *mi = hc->instance;
+ const char *purge;
+ enum GNUNET_DB_QueryStatus qs;
+
+ GNUNET_assert (NULL != mi);
+ purge = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "purge");
+ if ( (NULL != purge) &&
+ (0 == strcmp (purge,
+ "yes")) )
+ qs = TMH_db->purge_instance (TMH_db->cls,
+ mi->settings.id);
+ else
+ qs = TMH_db->delete_instance_private_key (TMH_db->cls,
+ mi->settings.id);
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_DELETE_INSTANCES_ID_DB_HARD_FAILURE,
+ "Transaction failed");
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_INTERNAL_INVARIANT_FAILURE,
+ "Serialization error for single SQL statement");
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_DELETE_INSTANCES_ID_NO_SUCH_INSTANCE,
+ ( (NULL != purge) &&
+ (0 == strcmp (purge,
+ "yes")) )
+ ? "Instance unknown"
+ : "Private key unknown");
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return TALER_MHD_reply_static (connection,
+ MHD_HTTP_NO_CONTENT,
+ NULL,
+ NULL,
+ 0);
+ }
+ GNUNET_assert (0);
+ return MHD_NO;
+}
+
+
+/* end of taler-merchant-httpd_private-delete-instances-ID.c */
diff --git a/src/backend/taler-merchant-httpd_private-delete-instances-ID.h b/src/backend/taler-merchant-httpd_private-delete-instances-ID.h
new file mode 100644
index 00000000..0b28dbbd
--- /dev/null
+++ b/src/backend/taler-merchant-httpd_private-delete-instances-ID.h
@@ -0,0 +1,41 @@
+/*
+ This file is part of TALER
+ (C) 2019, 2020 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file backend/taler-merchant-httpd_private-delete-instances-ID.h
+ * @brief implement DELETE /instances/$ID/
+ * @author Christian Grothoff
+ */
+#ifndef TALER_MERCHANT_HTTPD_PRIVATE_DELETE_INSTANCES_ID_H
+#define TALER_MERCHANT_HTTPD_PRIVATE_DELETE_INSTANCES_ID_H
+
+#include "taler-merchant-httpd.h"
+
+
+/**
+ * Handle a DELETE "/instances/$ID" request.
+ *
+ * @param rh context of the handler
+ * @param connection the MHD connection to handle
+ * @param[in,out] hc context with further information about the request
+ * @return MHD result code
+ */
+MHD_RESULT
+TMH_private_delete_instances_ID (const struct TMH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ struct TMH_HandlerContext *hc);
+
+/* end of taler-merchant-httpd_private-delete-instances-ID.h */
+#endif
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index ecc47975..6b86a1ec 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -41,7 +41,8 @@
* @param field name of the database field to fetch amount from
* @param amountp[out] pointer to amount to set
*/
-#define TALER_PQ_RESULT_SPEC_AMOUNT(field,amountp) TALER_PQ_result_spec_amount ( \
+#define TALER_PQ_RESULT_SPEC_AMOUNT(field,amountp) \
+ TALER_PQ_result_spec_amount ( \
field,pg->currency,amountp)
/**
@@ -51,8 +52,8 @@
* @param field name of the database field to fetch amount from
* @param amountp[out] pointer to amount to set
*/
-#define TALER_PQ_RESULT_SPEC_AMOUNT_NBO(field, \
- amountp) TALER_PQ_result_spec_amount_nbo ( \
+#define TALER_PQ_RESULT_SPEC_AMOUNT_NBO(field, amountp) \
+ TALER_PQ_result_spec_amount_nbo ( \
field,pg->currency,amountp)
@@ -63,7 +64,8 @@
* @param field name of the database field to fetch amount from
* @param amountp[out] pointer to amount to set
*/
-#define TALER_PQ_RESULT_SPEC_AMOUNT(field,amountp) TALER_PQ_result_spec_amount ( \
+#define TALER_PQ_RESULT_SPEC_AMOUNT(field,amountp) \
+ TALER_PQ_result_spec_amount ( \
field,pg->currency,amountp)
@@ -556,7 +558,8 @@ postgres_insert_instance (void *cls,
};
struct GNUNET_PQ_QueryParam params_priv[] = {
GNUNET_PQ_query_param_auto_from_type (merchant_priv),
- GNUNET_PQ_query_param_string (is->id)
+ GNUNET_PQ_query_param_string (is->id),
+ GNUNET_PQ_query_param_end
};
enum GNUNET_DB_QueryStatus qs;
@@ -610,14 +613,24 @@ postgres_insert_account (
* Delete private key of an instance from our database.
*
* @param cls closure
- * @param merchant_pub public key of the instance
+ * @param merchant_id identifier of the instance
* @return database result code
*/
static enum GNUNET_DB_QueryStatus
postgres_delete_instance_private_key (
void *cls,
- const struct TALER_MerchantPublicKeyP *merchant_pub)
+ const char *merchant_id)
{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (merchant_id),
+ GNUNET_PQ_query_param_end
+ };
+
+ check_connection (pg);
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "delete_key",
+ params);
}
@@ -626,13 +639,23 @@ postgres_delete_instance_private_key (
* Highly likely to cause undesired data loss. Use with caution.
*
* @param cls closure
- * @param merchant_pub public key of the instance
+ * @param merchant_id identifier of the instance
* @return database result code
*/
static enum GNUNET_DB_QueryStatus
postgres_purge_instance (void *cls,
- const struct TALER_MerchantPublicKeyP *merchant_pub)
+ const char *merchant_id)
{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (merchant_id),
+ GNUNET_PQ_query_param_end
+ };
+
+ check_connection (pg);
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "purge_instance",
+ params);
}
@@ -3585,6 +3608,19 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
" FROM merchant_instances"
" WHERE merchant_id=$1",
5),
+ /* for postgres_delete_instance_private_key() */
+ GNUNET_PQ_make_prepare ("delete_key",
+ "DELETE FROM merchant_keys"
+ " USING merchant_instances"
+ " WHERE merchant_keys.merchant_serial"
+ " = merchant_instances.merchant_serial"
+ " AND merchant_instances.merchant_id = $1",
+ 1),
+ /* for postgres_purge_instance() */
+ GNUNET_PQ_make_prepare ("purge_keys",
+ "DELETE FROM merchant_instances"
+ " WHERE merchant_instances.merchant_id = $1",
+ 1),
/* OLD API: */
#if 0
GNUNET_PQ_make_prepare ("insert_deposit",
@@ -4084,6 +4120,8 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
plugin->lookup_instances = &postgres_lookup_instances;
plugin->insert_instance = &postgres_insert_instance;
plugin->insert_account = &postgres_insert_account;
+ plugin->delete_instance_private_key = &postgres_delete_instance_private_key;
+ plugin->purge_instance = &postgres_purge_instance;
/* old API: */
plugin->store_deposit = &postgres_store_deposit;
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index 324ed40b..c33c719e 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -296,7 +296,7 @@ struct TALER_MERCHANT_InstancesGetHandle;
* @param iis array with instance information of length @a iis_length
*/
typedef void
-(*TALER_MERCHANT_InstancesCallback)(
+(*TALER_MERCHANT_InstancesGetCallback)(
void *cls,
const struct TALER_MERCHANT_HttpResponse *hr,
unsigned int iis_length,
@@ -318,7 +318,7 @@ typedef void
struct TALER_MERCHANT_InstancesGetHandle *
TALER_MERCHANT_instances_get (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- TALER_MERCHANT_InstancesCallback instances_cb,
+ TALER_MERCHANT_InstancesGetCallback instances_cb,
void *instances_cb_cls);
@@ -333,6 +333,88 @@ TALER_MERCHANT_instances_get_cancel (
struct TALER_MERCHANT_InstancesGetHandle *igh);
+/**
+ * Handle for a DELETE /instances operation.
+ */
+struct TALER_MERCHANT_InstancesDeleteHandle;
+
+
+/**
+ * Function called with the result of the DELETE /instances operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response data
+ */
+typedef void
+(*TALER_MERCHANT_InstancesDeleteCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr);
+
+
+/**
+ * Get the private key of an instance of a backend, thereby disabling the
+ * instance for future requests. Will preserve the other instance data
+ * (i.e. for taxation).
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param instance_id which instance should be deleted
+ * @param instances_cb function to call with the
+ * backend's return
+ * @param instances_cb_cls closure for @a config_cb
+ * @return the instances handle; NULL upon error
+ */
+struct TALER_MERCHANT_InstancesDeleteHandle *
+TALER_MERCHANT_instances_delete_instance (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *instance_id,
+ TALER_MERCHANT_InstancesDeleteCallback instances_cb,
+ void *instances_cb_cls);
+
+
+/**
+ * Purge all data associated with an instance. Use with
+ * extreme caution.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param instance_id which instance should be deleted
+ * @param instances_cb function to call with the
+ * backend's return
+ * @param instances_cb_cls closure for @a config_cb
+ * @return the instances handle; NULL upon error
+ */
+struct TALER_MERCHANT_InstancesDeleteHandle *
+TALER_MERCHANT_instances_purge_instance (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *instance_id,
+ TALER_MERCHANT_InstancesDeleteCallback instances_cb,
+ void *instances_cb_cls);
+
+
+/**
+ * Cancel /instances DELETE request. Must not be called by clients after
+ * the callback was invoked.
+ *
+ * @param idh request to cancel.
+ */
+void
+TALER_MERCHANT_instances_delete_cancel (
+ struct TALER_MERCHANT_InstancesDeleteHandle *idh);
+
+
+/**
+ * Cancel /instances DELETE request. Must not be called by clients after
+ * the callback was invoked.
+ *
+ * @param arg request to cancel.
+ */
+#define TALER_MERCHANT_instances_purge_cancel(arg) \
+ TALER_MERCHANT_instances_delete_cancel (arg)
+
+
/* ********************* /refund ************************** */
/**
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index 2bcf1987..c2357de9 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -388,13 +388,13 @@ struct TALER_MERCHANTDB_Plugin
* Delete private key of an instance from our database.
*
* @param cls closure
- * @param merchant_pub public key of the instance
+ * @param merchant_id identifier of the instance
* @return database result code
*/
enum GNUNET_DB_QueryStatus
(*delete_instance_private_key)(
void *cls,
- const struct TALER_MerchantPublicKeyP *merchant_pub);
+ const char *merchant_id);
/**
@@ -402,12 +402,12 @@ struct TALER_MERCHANTDB_Plugin
* Highly likely to cause undesired data loss. Use with caution.
*
* @param cls closure
- * @param merchant_pub public key of the instance
+ * @param merchant_id identifier of the instance
* @return database result code
*/
enum GNUNET_DB_QueryStatus
(*purge_instance)(void *cls,
- const struct TALER_MerchantPublicKeyP *merchant_pub);
+ const char *merchant_id);
/* ****************** OLD API ******************** */
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index ccaaaea6..c2d468e2 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -19,10 +19,11 @@ libtalermerchanttesting_la_LDFLAGS = \
-no-undefined
libtalermerchant_la_SOURCES = \
- merchant_api_check_payment.c \
merchant_api_common.c \
- merchant_api_config_get.c \
- merchant_api_instances_get.c \
+ merchant_api_delete_instances_ID.c \
+ merchant_api_get_config.c \
+ merchant_api_get_instances.c \
+ merchant_api_check_payment.c \
merchant_api_history.c \
merchant_api_proposal.c \
merchant_api_proposal_lookup.c \
diff --git a/src/lib/merchant_api_delete_instances_ID.c b/src/lib/merchant_api_delete_instances_ID.c
new file mode 100644
index 00000000..46405bb3
--- /dev/null
+++ b/src/lib/merchant_api_delete_instances_ID.c
@@ -0,0 +1,260 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2014-2018, 2020 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 lib/merchant_api_delete_instances_ID.c
+ * @brief Implementation of the GET /instances request of the merchant's HTTP API
+ * @author Christian Grothoff
+ */
+#include "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_merchant_service.h"
+#include <taler/taler_json_lib.h>
+#include <taler/taler_signatures.h>
+
+
+/**
+ * Handle for a DELETE /instances/$ID operation.
+ */
+struct TALER_MERCHANT_InstancesDeleteHandle
+{
+ /**
+ * The url for this request.
+ */
+ char *url;
+
+ /**
+ * Handle for the request.
+ */
+ struct GNUNET_CURL_Job *job;
+
+ /**
+ * Function to call with the result.
+ */
+ TALER_MERCHANT_InstancesDeleteCallback cb;
+
+ /**
+ * Closure for @a cb.
+ */
+ void *cb_cls;
+
+ /**
+ * Reference to the execution context.
+ */
+ struct GNUNET_CURL_Context *ctx;
+
+};
+
+
+/**
+ * Function called when we're done processing the
+ * HTTP DELETE /instances/$ID request.
+ *
+ * @param cls the `struct TALER_MERCHANT_InstancesDeleteHandle`
+ * @param response_code HTTP response code, 0 on error
+ * @param json response body, NULL if not in JSON
+ */
+static void
+handle_instances_delete_finished (void *cls,
+ long response_code,
+ const void *response)
+{
+ struct TALER_MERCHANT_InstancesDeleteHandle *idh = cls;
+ const json_t *json = response;
+ struct TALER_MERCHANT_HttpResponse hr = {
+ .http_status = (unsigned int) response_code,
+ .reply = json
+ };
+
+ idh->job = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Got /instances response with status code %u\n",
+ (unsigned int) response_code);
+ switch (response_code)
+ {
+ case MHD_HTTP_OK:
+ break;
+ case MHD_HTTP_NOT_FOUND:
+ hr.ec = TALER_JSON_get_error_code (json);
+ hr.hint = TALER_JSON_get_error_hint (json);
+ break;
+ default:
+ /* unexpected response code */
+ hr.ec = TALER_JSON_get_error_code (json);
+ hr.hint = TALER_JSON_get_error_hint (json);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unexpected response code %u/%d\n",
+ (unsigned int) response_code,
+ (int) hr.ec);
+ break;
+ }
+ idh->cb (idh->cb_cls,
+ &hr);
+ TALER_MERCHANT_instances_delete_cancel (idh);
+}
+
+
+/**
+ * Purge all data associated with an instance. Use with
+ * extreme caution.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param instance_id which instance should be deleted
+ * @param instances_cb function to call with the
+ * backend's return
+ * @param instances_cb_cls closure for @a config_cb
+ * @return the instances handle; NULL upon error
+ */
+static struct TALER_MERCHANT_InstancesDeleteHandle *
+instances_delete (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *instance_id,
+ bool purge,
+ TALER_MERCHANT_InstancesDeleteCallback instances_cb,
+ void *instances_cb_cls)
+{
+ struct TALER_MERCHANT_InstancesDeleteHandle *idh;
+ CURL *eh;
+
+ idh = GNUNET_new (struct TALER_MERCHANT_InstancesDeleteHandle);
+ idh->ctx = ctx;
+ idh->cb = instances_cb;
+ idh->cb_cls = instances_cb_cls;
+ {
+ char *path;
+
+ GNUNET_asprintf (&path,
+ "instances/%s",
+ instance_id);
+ if (purge)
+ idh->url = TALER_url_join (backend_url,
+ path,
+ "purge",
+ "true",
+ NULL);
+ else
+ idh->url = TALER_url_join (backend_url,
+ path,
+ NULL);
+ GNUNET_free (path);
+ }
+ if (NULL == idh->url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not construct request URL.\n");
+ GNUNET_free (idh);
+ return NULL;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Requesting URL '%s'\n",
+ idh->url);
+ eh = curl_easy_init ();
+ GNUNET_assert (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_URL,
+ idh->url));
+ GNUNET_assert (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_CUSTOMREQUEST,
+ MHD_HTTP_METHOD_DELETE));
+ idh->job = GNUNET_CURL_job_add (ctx,
+ eh,
+ GNUNET_YES,
+ &handle_instances_delete_finished,
+ idh);
+ return idh;
+}
+
+
+/**
+ * Purge all data associated with an instance. Use with
+ * extreme caution.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param instance_id which instance should be deleted
+ * @param instances_cb function to call with the
+ * backend's return
+ * @param instances_cb_cls closure for @a config_cb
+ * @return the instances handle; NULL upon error
+ */
+struct TALER_MERCHANT_InstancesDeleteHandle *
+TALER_MERCHANT_instances_delete_instance (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *instance_id,
+ TALER_MERCHANT_InstancesDeleteCallback instances_cb,
+ void *instances_cb_cls)
+{
+ return instances_delete (ctx,
+ backend_url,
+ instance_id,
+ false,
+ instances_cb,
+ instances_cb_cls);
+}
+
+
+/**
+ * Purge all data associated with an instance. Use with
+ * extreme caution.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param instance_id which instance should be deleted
+ * @param instances_cb function to call with the
+ * backend's return
+ * @param instances_cb_cls closure for @a config_cb
+ * @return the instances handle; NULL upon error
+ */
+struct TALER_MERCHANT_InstancesDeleteHandle *
+TALER_MERCHANT_instances_purge_instance (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *instance_id,
+ TALER_MERCHANT_InstancesDeleteCallback instances_cb,
+ void *instances_cb_cls)
+{
+ return instances_delete (ctx,
+ backend_url,
+ instance_id,
+ true,
+ instances_cb,
+ instances_cb_cls);
+}
+
+
+/**
+ * Cancel /instances DELETE request. Must not be called by clients after the
+ * callback was invoked.
+ *
+ * @param idh request to cancel.
+ */
+void
+TALER_MERCHANT_instances_delete_cancel (
+ struct TALER_MERCHANT_InstancesDeleteHandle *idh)
+{
+ if (NULL != idh->job)
+ GNUNET_CURL_job_cancel (idh->job);
+ GNUNET_free (idh->url);
+ GNUNET_free (idh);
+}
diff --git a/src/lib/merchant_api_config_get.c b/src/lib/merchant_api_get_config.c
index 2e3ac5d3..8a2d88b7 100644
--- a/src/lib/merchant_api_config_get.c
+++ b/src/lib/merchant_api_get_config.c
@@ -15,7 +15,7 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file lib/merchant_api_config_get.c
+ * @file lib/merchant_api_get_config.c
* @brief Implementation of the /config request of the merchant's HTTP API
* @author Christian Grothoff
*/
diff --git a/src/lib/merchant_api_instances_get.c b/src/lib/merchant_api_get_instances.c
index 437911df..830e9b5f 100644
--- a/src/lib/merchant_api_instances_get.c
+++ b/src/lib/merchant_api_get_instances.c
@@ -15,7 +15,7 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file lib/merchant_api_instances_get.c
+ * @file lib/merchant_api_get_instances.c
* @brief Implementation of the GET /instances request of the merchant's HTTP API
* @author Christian Grothoff
*/
@@ -48,7 +48,7 @@ struct TALER_MERCHANT_InstancesGetHandle
/**
* Function to call with the result.
*/
- TALER_MERCHANT_InstancesCallback cb;
+ TALER_MERCHANT_InstancesGetCallback cb;
/**
* Closure for @a cb.
@@ -238,7 +238,7 @@ handle_instances_finished (void *cls,
struct TALER_MERCHANT_InstancesGetHandle *
TALER_MERCHANT_instances_get (struct GNUNET_CURL_Context *ctx,
const char *backend_url,
- TALER_MERCHANT_InstancesCallback instances_cb,
+ TALER_MERCHANT_InstancesGetCallback instances_cb,
void *instances_cb_cls)
{
struct TALER_MERCHANT_InstancesGetHandle *igh;