summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2017-02-03 15:40:40 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2017-02-03 15:42:30 +0100
commit7097ceba4dda13da235919f1c2eb1633038d3c2c (patch)
tree57c317cd52bb96fb60bdc9e4bb39239660955059
parent6d979591c14e0e2296d7fe9a41277f0a0d9bc234 (diff)
downloadmerchant-7097ceba4dda13da235919f1c2eb1633038d3c2c.tar.gz
merchant-7097ceba4dda13da235919f1c2eb1633038d3c2c.tar.bz2
merchant-7097ceba4dda13da235919f1c2eb1633038d3c2c.zip
Removing obsolete /map requests and renaming
contract->proposal/order, within lib.
-rw-r--r--src/include/taler_merchant_service.h144
-rw-r--r--src/lib/Makefile.am3
-rw-r--r--src/lib/merchant_api_map.c230
-rw-r--r--src/lib/merchant_api_proposal.c228
4 files changed, 246 insertions, 359 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index 0ed6856e..8c0d8dff 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -30,66 +30,18 @@
/* ********************* /map/{in,out} *********************** */
-struct TALER_MERCHANT_MapOutOperation;
+/* ********************* /proposal *********************** */
-typedef void
-(*TALER_MERCHANT_MapOperationCallback) (void *cls,
- unsigned int http_status,
- const json_t *body);
/**
- * Issue a /map/out request to the backend.
- *
- * @param ctx execution context
- * @param backend_uri base URL of the merchant backend
- * @param h_contract hashcode of `contract`
- * @param map_in_cb callback which will work the response gotten from the backend
- * @param map_in_cb_cls closure to pass to @a history_cb
- * @return handle for this operation, NULL upon errors
+ * Handle to a PUT /proposal operation
*/
-struct TALER_MERCHANT_MapOperation *
-TALER_MERCHANT_map_out (struct GNUNET_CURL_Context *ctx,
- const char *backend_uri,
- const struct GNUNET_HashCode *h_contract,
- TALER_MERCHANT_MapOperationCallback map_cb,
- void *map_cb_cls);
+struct TALER_MERCHANT_ProposalOperation;
/**
- * Issue a /map/in request to the backend.
- *
- * @param ctx execution context
- * @param backend_uri base URL of the merchant backend
- * @param contract contract to store
- * @param h_contract hashcode of `contract`
- * @param map_in_cb callback which will work the response gotten from the backend
- * @param map_in_cb_cls closure to pass to @a history_cb
- * @return handle for this operation, NULL upon errors
+ * Handle to a GET /proposal operation
*/
-struct TALER_MERCHANT_MapOperation *
-TALER_MERCHANT_map_in (struct GNUNET_CURL_Context *ctx,
- const char *backend_uri,
- const json_t *contract,
- const struct GNUNET_HashCode *h_contract,
- TALER_MERCHANT_MapOperationCallback map_cb,
- void *map_cb_cls);
-
-/**
- * Cancel a /map/in request.
- *
- * @param mio handle to the request to be canceled
- */
-void
-TALER_MERCHANT_map_cancel (struct TALER_MERCHANT_MapOperation *mo);
-
-
-/* ********************* /contract *********************** */
-
-
-/**
- * @brief Handle to a /contract operation at a merchant's backend.
- */
-struct TALER_MERCHANT_ContractOperation;
-
+struct TALER_MERCHANT_ProposalLookupOperation;
/**
* Callbacks of this type are used to serve the result of submitting a
@@ -99,48 +51,90 @@ struct TALER_MERCHANT_ContractOperation;
* @param http_status HTTP response code, 200 indicates success;
* 0 if the backend's reply is bogus (fails to follow the protocol)
* @param ec taler-specific error code
- * @param obj the full received JSON reply, or
- * error details if the request failed
- * @param contract completed contract, NULL on error
+ * @param obj raw JSON reply, or error details if the request failed
+ * @param proposal_data completed contract, NULL on error
* @param sig merchant's signature over the contract, NULL on error
- * @param h_contract hash of the contract, NULL on error
+ * @param h_proposal_data proposal data's hashcode, NULL on error
*/
typedef void
-(*TALER_MERCHANT_ContractCallback) (void *cls,
+(*TALER_MERCHANT_ProposalCallback) (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
const json_t *obj,
- const json_t *contract,
+ const json_t *proposal_data,
const struct TALER_MerchantSignatureP *sig,
- const struct GNUNET_HashCode *h_contract);
+ const struct GNUNET_HashCode *h_proposal_data);
/**
- * Request backend to sign a contract (and add fields like wire transfer
- * details).
+ * Callback called to work a GET /proposal response.
+ *
+ * @param cls closure
+ * @param http_status HTTP status code of the request
+ * @param body JSON containing the response's payload.
+ * In case of errors, it contains the appropriate error encoding.
+ */
+typedef void
+(*TALER_MERCHANT_ProposalLookupOperationCallback) (void *cls,
+ unsigned int http_status,
+ const json_t *body);
+
+/**
+ * PUT an order to the backend and receives the related proposal.
*
* @param ctx execution context
- * @param backend_uri base URI of the backend
- * @param contract prototype of the contract
- * @param contract_cb the callback to call when a reply for this request is available
- * @param contract_cb_cls closure for @a contract_cb
+ * @param backend_uri URI of the backend
+ * @param order basic information about this purchase, to be extended by the
+ * backend
+ * @param proposal_cb the callback to call when a reply for this request is available
+ * @param proposal_cb_cls closure for @a proposal_cb
* @return a handle for this request
*/
-struct TALER_MERCHANT_ContractOperation *
-TALER_MERCHANT_contract_sign (struct GNUNET_CURL_Context *ctx,
- const char *backend_uri,
- const json_t *contract,
- TALER_MERCHANT_ContractCallback contract_cb,
- void *contract_cb_cls);
+struct TALER_MERCHANT_ProposalOperation *
+TALER_MERCHANT_order_put (struct GNUNET_CURL_Context *ctx,
+ const char *backend_uri,
+ const json_t *order,
+ TALER_MERCHANT_ProposalCallback proposal_cb,
+ void *proposal_cb_cls);
+
+
+/**
+ * Cancel a PUT /proposal request. This function cannot be used
+ * on a request handle if a response is already served for it.
+ *
+ * @param po the proposal operation request handle
+ */
+void
+TALER_MERCHANT_proposal_cancel (struct TALER_MERCHANT_ProposalOperation *po);
/**
- * Cancel a /contract request.
+ * Calls the GET /proposal API at the backend. That is,
+ * retrieve a proposal data by providing its transaction id.
*
- * @param co the contract operation handle
+ * @param ctx execution context
+ * @param backend_uri base URL of the merchant backend
+ * @param transaction_id transaction id used to perform the lookup
+ * @param plo_cb callback which will work the response gotten from the backend
+ * @param plo_cb_cls closure to pass to @a history_cb
+ * @return handle for this operation, NULL upon errors
+ */
+struct TALER_MERCHANT_ProposalLookupOperation *
+TALER_MERCHANT_proposal_lookup (struct GNUNET_CURL_Context *ctx,
+ const char *backend_uri,
+ const char *transaction_id,
+ TALER_MERCHANT_ProposalLookupOperationCallback plo_cb,
+ void *plo_cb_cls);
+
+
+/**
+ * Cancel a GET /proposal request.
+ *
+ * @param plo handle to the request to be canceled
*/
void
-TALER_MERCHANT_contract_sign_cancel (struct TALER_MERCHANT_ContractOperation *co);
+TALER_MERCHANT_proposal_lookup_cancel (struct TALER_MERCHANT_ProposalLookupOperation *plo);
+
/* ********************* /pay *********************** */
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 34388bc9..1e4a7cb3 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -18,8 +18,7 @@ libtalermerchant_la_SOURCES = \
merchant_api_pay.c \
merchant_api_track_transaction.c \
merchant_api_track_transfer.c \
- merchant_api_history.c \
- merchant_api_map.c
+ merchant_api_history.c
libtalermerchant_la_LIBADD = \
-ltalerexchange \
diff --git a/src/lib/merchant_api_map.c b/src/lib/merchant_api_map.c
deleted file mode 100644
index d1aaf5a1..00000000
--- a/src/lib/merchant_api_map.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- This file is part of TALER
- Copyright (C) 2014, 2015, 2016 GNUnet e.V. and INRIA
-
- 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_map.c
- * @brief Implementation of the /map/{in,out} request of the merchant's HTTP API
- * @author Marcello Stanisci
- */
-#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>
-
-
-/**
- * This structure acts like a "handle" for both /map/in and
- * /map/out operations, as they only differ about the 'json_enc'
- * field (which is just left NULL when not needed).
- */
-struct TALER_MERCHANT_MapOperation
-{
- /**
- * Full URI, includes "/map/in".
- */
- char *url;
-
- /**
- * Request's body. Left NULL in case of /map/out.
- */
- char *json_enc;
-
- /**
- * Handle for the request.
- */
- struct GNUNET_CURL_Job *job;
-
- /**
- * Function to call with the result.
- */
- TALER_MERCHANT_MapOperationCallback cb;
-
- /**
- * Closure for @a cb.
- */
- void *cb_cls;
-
- /**
- * Reference to the execution context.
- */
- struct GNUNET_CURL_Context *ctx;
-
-};
-
-
-/**
- * Cancel a /map/{in,out} request.
- *
- * @param mio handle to the request to be canceled
- */
-void
-TALER_MERCHANT_map_cancel (struct TALER_MERCHANT_MapOperation *mo)
-{
- if (NULL != mo->job)
- {
- GNUNET_CURL_job_cancel (mo->job);
- mo->job = NULL;
- }
- GNUNET_free (mo->url);
- GNUNET_free_non_null (mo->json_enc);
- GNUNET_free (mo);
-}
-
-
-/**
- * Function called when we're done processing the HTTP /map/{in,out} request.
- *
- * @param cls the `struct TALER_MERCHANT_MapInOperation`
- * @param response_code HTTP response code, 0 on error
- * @param json response body, should be NULL
- */
-static void
-handle_map_finished (void *cls,
- long response_code,
- const json_t *json)
-{
- struct TALER_MERCHANT_MapOperation *mo = cls;
-
- /**
- * As no data is supposed to be extracted from this
- * call, we just invoke the provided callback from here.
- */
- mo->cb (mo->cb_cls,
- response_code,
- json);
-}
-
-/**
- * Issue a /map/out request to the backend.
- *
- * @param ctx execution context
- * @param backend_uri base URL of the merchant backend
- * @param h_contract hashcode of `contract`
- * @param map_in_cb callback which will work the response gotten from the backend
- * @param map_in_cb_cls closure to pass to @a history_cb
- * @return handle for this operation, NULL upon errors
- */
-struct TALER_MERCHANT_MapOperation *
-TALER_MERCHANT_map_out (struct GNUNET_CURL_Context *ctx,
- const char *backend_uri,
- const struct GNUNET_HashCode *h_contract,
- TALER_MERCHANT_MapOperationCallback map_cb,
- void *map_cb_cls)
-{
- struct TALER_MERCHANT_MapOperation *mo;
- CURL *eh;
- char *hash_enc;
-
- mo = GNUNET_new (struct TALER_MERCHANT_MapOperation);
- mo->ctx = ctx;
- mo->cb = map_cb;
- mo->cb_cls = map_cb_cls;
-
- hash_enc = GNUNET_STRINGS_data_to_string_alloc (h_contract,
- sizeof (struct GNUNET_HashCode));
- GNUNET_asprintf (&mo->url,
- "%s/map/out?h_contract=%s",
- backend_uri,
- hash_enc);
- eh = curl_easy_init ();
- if (CURLE_OK != curl_easy_setopt (eh,
- CURLOPT_URL,
- mo->url))
- {
- GNUNET_break (0);
- return NULL;
- }
-
- if (NULL == (mo->job = GNUNET_CURL_job_add (ctx,
- eh,
- GNUNET_YES,
- &handle_map_finished,
- mo)))
- {
- GNUNET_break (0);
- return NULL;
- }
- return mo;
-}
-
-/**
- * Issue a /map/in request to the backend.
- *
- * @param ctx execution context
- * @param backend_uri base URL of the merchant backend
- * @param contract contract to store
- * @param h_contract hashcode of `contract`
- * @param map_in_cb callback which will work the response gotten from the backend
- * @param map_in_cb_cls closure to pass to @a history_cb
- * @return handle for this operation, NULL upon errors
- */
-struct TALER_MERCHANT_MapOperation *
-TALER_MERCHANT_map_in (struct GNUNET_CURL_Context *ctx,
- const char *backend_uri,
- const json_t *contract,
- const struct GNUNET_HashCode *h_contract,
- TALER_MERCHANT_MapOperationCallback map_cb,
- void *map_cb_cls)
-{
- struct TALER_MERCHANT_MapOperation *mo;
- CURL *eh;
- json_t *req;
-
- mo = GNUNET_new (struct TALER_MERCHANT_MapOperation);
- mo->ctx = ctx;
- mo->cb = map_cb;
- mo->cb_cls = map_cb_cls;
-
- GNUNET_asprintf (&mo->url,
- "%s%s",
- backend_uri,
- "/map/in");
-
- // build final json
- req = json_pack ("{s:o, s:o}",
- "contract", contract,
- "h_contract", GNUNET_JSON_from_data_auto (h_contract));
-
- GNUNET_assert (NULL !=
- (mo->json_enc = json_dumps (req, JSON_COMPACT))
- );
-
- json_decref (req);
- eh = curl_easy_init ();
-
- GNUNET_assert (CURLE_OK ==
- curl_easy_setopt (eh,
- CURLOPT_URL,
- mo->url));
- GNUNET_assert (CURLE_OK ==
- curl_easy_setopt (eh,
- CURLOPT_POSTFIELDS,
- mo->json_enc));
- GNUNET_assert (CURLE_OK ==
- curl_easy_setopt (eh,
- CURLOPT_POSTFIELDSIZE,
- strlen (mo->json_enc)));
- mo->job = GNUNET_CURL_job_add (ctx,
- eh,
- GNUNET_YES,
- &handle_map_finished,
- mo);
- return mo;
-}
diff --git a/src/lib/merchant_api_proposal.c b/src/lib/merchant_api_proposal.c
index f1858906..bdcdbd4d 100644
--- a/src/lib/merchant_api_proposal.c
+++ b/src/lib/merchant_api_proposal.c
@@ -34,7 +34,7 @@
/**
* @brief A Contract Operation Handle
*/
-struct TALER_MERCHANT_ContractOperation
+struct TALER_MERCHANT_ProposalOperation
{
/**
@@ -55,7 +55,7 @@ struct TALER_MERCHANT_ContractOperation
/**
* Function to call with the result.
*/
- TALER_MERCHANT_ContractCallback cb;
+ TALER_MERCHANT_ProposalCallback cb;
/**
* Closure for @a cb.
@@ -68,31 +68,63 @@ struct TALER_MERCHANT_ContractOperation
struct GNUNET_CURL_Context *ctx;
};
+/**
+ * Structure representing a GET /proposal operation.
+ */
+struct TALER_MERCHANT_ProposalLookupOperation
+{
+ /**
+ * Full URI, includes "/proposal".
+ */
+ char *url;
+
+ /**
+ * Handle for the request.
+ */
+ struct GNUNET_CURL_Job *job;
+
+ /**
+ * Function to call with the result.
+ */
+ TALER_MERCHANT_ProposalLookupOperationCallback 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 /contract request.
+ * HTTP PUT /proposal request.
*
- * @param cls the `struct TALER_MERCHANT_Pay`
+ * @param cls the `struct TALER_MERCHANT_ProposalOperation`
* @param response_code HTTP response code, 0 on error
* @param json response body, NULL if not in JSON
*/
static void
-handle_contract_finished (void *cls,
+handle_proposal_finished (void *cls,
long response_code,
const json_t *json)
{
- struct TALER_MERCHANT_ContractOperation *co = cls;
- json_t *contract;
+ struct TALER_MERCHANT_ProposalOperation *po = cls;
+ json_t *proposal_data;
const struct TALER_MerchantSignatureP *sigp;
- const struct GNUNET_HashCode *h_contractp;
+ const struct GNUNET_HashCode *h_proposal_datap;
struct TALER_MerchantSignatureP sig;
- struct GNUNET_HashCode h_contract;
+ struct GNUNET_HashCode h_proposal_data;
- co->job = NULL;
- contract = NULL;
+ po->job = NULL;
+ proposal_data = NULL;
sigp = NULL;
- h_contractp = NULL;
+ h_proposal_datap = NULL;
switch (response_code)
{
case 0:
@@ -100,9 +132,9 @@ handle_contract_finished (void *cls,
case MHD_HTTP_OK:
{
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("contract", &contract),
+ GNUNET_JSON_spec_json ("proposal_data", &proposal_data),
GNUNET_JSON_spec_fixed_auto ("merchant_sig", &sig),
- GNUNET_JSON_spec_fixed_auto ("H_contract", &h_contract),
+ GNUNET_JSON_spec_fixed_auto ("h_proposal_data", &h_proposal_data),
GNUNET_JSON_spec_end()
};
@@ -115,7 +147,7 @@ handle_contract_finished (void *cls,
response_code = 0;
break;
}
- h_contractp = &h_contract;
+ h_proposal_datap = &h_proposal_data;
sigp = &sig;
}
break;
@@ -146,95 +178,187 @@ handle_contract_finished (void *cls,
GNUNET_break (0);
response_code = 0;
}
- co->cb (co->cb_cls,
+ po->cb (po->cb_cls,
response_code,
TALER_JSON_get_error_code (json),
json,
- contract,
+ proposal_data,
sigp,
- h_contractp);
- if (NULL != contract)
- json_decref (contract);
+ h_proposal_datap);
+ if (NULL != proposal_data)
+ json_decref (proposal_data);
}
/**
- * PUT an order to the backend and receives the related
- * proposal.
+ * PUT an order to the backend and receives the related proposal.
*
* @param ctx execution context
* @param backend_uri URI of the backend
- * @param contract prototype of the contract
- * @param contract_cb the callback to call when a reply for this request is available
- * @param contract_cb_cls closure for @a contract_cb
+ * @param order basic information about this purchase, to be extended by the
+ * backend
+ * @param proposal_cb the callback to call when a reply for this request is
+ * available
+ * @param proposal_cb_cls closure for @a proposal_cb
* @return a handle for this request
*/
-struct TALER_MERCHANT_ContractOperation *
-TALER_MERCHANT_put_order (struct GNUNET_CURL_Context *ctx,
+struct TALER_MERCHANT_ProposalOperation *
+TALER_MERCHANT_order_put (struct GNUNET_CURL_Context *ctx,
const char *backend_uri,
const json_t *order,
TALER_MERCHANT_ProposalCallback proposal_cb,
void *proposal_cb_cls)
{
- struct TALER_MERCHANT_ContractOperation *co;
+ struct TALER_MERCHANT_ProposalOperation *po;
json_t *req;
CURL *eh;
- co = GNUNET_new (struct TALER_MERCHANT_ContractOperation);
- co->ctx = ctx;
- co->cb = contract_cb;
- co->cb_cls = contract_cb_cls;
- GNUNET_asprintf (&co->url,
+ po = GNUNET_new (struct TALER_MERCHANT_ProposalOperation);
+ po->ctx = ctx;
+ po->cb = proposal_cb;
+ po->cb_cls = proposal_cb_cls;
+ GNUNET_asprintf (&po->url,
"%s%s",
backend_uri,
- "/contract");
+ "/proposal");
req = json_pack ("{s:O}",
- "contract", (json_t *) contract);
+ "order", (json_t *) order);
eh = curl_easy_init ();
- GNUNET_assert (NULL != (co->json_enc =
+ GNUNET_assert (NULL != (po->json_enc =
json_dumps (req,
JSON_COMPACT)));
json_decref (req);
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_URL,
- co->url));
+ po->url));
+ /* FIXME: as for the specs, POST becomes PUT */
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_POSTFIELDS,
- co->json_enc));
+ po->json_enc));
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_POSTFIELDSIZE,
- strlen (co->json_enc)));
- co->job = GNUNET_CURL_job_add (ctx,
+ strlen (po->json_enc)));
+ po->job = GNUNET_CURL_job_add (ctx,
eh,
GNUNET_YES,
- &handle_contract_finished,
- co);
- return co;
+ &handle_proposal_finished,
+ po);
+ return po;
+}
+
+/**
+ * Function called when we're done processing the GET /proposal request.
+ *
+ * @param cls the `struct TALER_MERCHANT_ProposalLookupOperation`
+ * @param response_code HTTP response code, 0 on error
+ * @param json response body, should be NULL
+ */
+static void
+handle_proposal_lookup_finished (void *cls,
+ long response_code,
+ const json_t *json)
+{
+ struct TALER_MERCHANT_ProposalLookupOperation *plo = cls;
+
+ /**
+ * As no data is supposed to be extracted from this
+ * call, we just invoke the provided callback.
+ */
+ plo->cb (plo->cb_cls,
+ response_code,
+ json);
}
+/**
+ * Calls the GET /proposal API at the backend. That is,
+ * retrieve a proposal data by providing its transaction id.
+ *
+ * @param ctx execution context
+ * @param backend_uri base URL of the merchant backend
+ * @param transaction_id transaction id used to perform the lookup
+ * @param plo_cb callback which will work the response gotten from the backend
+ * @param plo_cb_cls closure to pass to @a history_cb
+ * @return handle for this operation, NULL upon errors
+ */
+struct TALER_MERCHANT_ProposalLookupOperation *
+TALER_MERCHANT_proposal_lookup (struct GNUNET_CURL_Context *ctx,
+ const char *backend_uri,
+ const char *transaction_id,
+ TALER_MERCHANT_ProposalLookupOperationCallback plo_cb,
+ void *plo_cb_cls)
+{
+ struct TALER_MERCHANT_ProposalLookupOperation *plo;
+ CURL *eh;
+
+ plo = GNUNET_new (struct TALER_MERCHANT_ProposalLookupOperation);
+ plo->ctx = ctx;
+ plo->cb = plo_cb;
+ plo->cb_cls = plo_cb_cls;
+
+ GNUNET_asprintf (&plo->url,
+ "%s/proposal?transaction_id=%s",
+ backend_uri,
+ transaction_id);
+ eh = curl_easy_init ();
+ if (CURLE_OK != curl_easy_setopt (eh,
+ CURLOPT_URL,
+ plo->url))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+
+ if (NULL == (plo->job = GNUNET_CURL_job_add (ctx,
+ eh,
+ GNUNET_YES,
+ &handle_proposal_lookup_finished,
+ plo)))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ return plo;
+
+}
/**
- * Cancel a /contract request. This function cannot be used
+ * Cancel a PUT /proposal request. This function cannot be used
* on a request handle if a response is already served for it.
*
- * @param co the contract operation request handle
+ * @param po the proposal operation request handle
*/
void
-TALER_MERCHANT_contract_sign_cancel (struct TALER_MERCHANT_ContractOperation *co)
+TALER_MERCHANT_proposal_cancel (struct TALER_MERCHANT_ProposalOperation *po)
{
- if (NULL != co->job)
+ if (NULL != po->job)
{
- GNUNET_CURL_job_cancel (co->job);
- co->job = NULL;
+ GNUNET_CURL_job_cancel (po->job);
+ po->job = NULL;
}
- GNUNET_free (co->url);
- GNUNET_free (co->json_enc);
- GNUNET_free (co);
+ GNUNET_free (po->url);
+ GNUNET_free (po->json_enc);
+ GNUNET_free (po);
}
+/**
+ * Cancel a GET /proposal request.
+ *
+ * @param plo handle to the request to be canceled
+ */
+void
+TALER_MERCHANT_proposal_lookup_cancel (struct TALER_MERCHANT_ProposalLookupOperation *plo)
+{
+ if (NULL != plo->job)
+ {
+ GNUNET_CURL_job_cancel (plo->job);
+ plo->job = NULL;
+ }
+ GNUNET_free (plo->url);
+ GNUNET_free (plo);
+}
/* end of merchant_api_contract.c */