summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-27 16:32:59 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-27 16:32:59 +0200
commit5da121e9b0ec83f20a1a404f7049f9ff19aca32b (patch)
treea5a0701476655faf4fbf48c960ded20ef50b0dcc /src/include
parente3d91bf74804871c5d7438a0b04265b69feba34a (diff)
downloadmerchant-5da121e9b0ec83f20a1a404f7049f9ff19aca32b.tar.gz
merchant-5da121e9b0ec83f20a1a404f7049f9ff19aca32b.tar.bz2
merchant-5da121e9b0ec83f20a1a404f7049f9ff19aca32b.zip
implement order claiming
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_merchant_service.h113
-rw-r--r--src/include/taler_merchant_testing_lib.h24
2 files changed, 68 insertions, 69 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index bc5eae14..a4312c09 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -1363,6 +1363,62 @@ TALER_MERCHANT_order_delete_cancel (
struct TALER_MERCHANT_OrderDeleteHandle *odh);
+/**
+ * Handle to a POST /orders/$ID/claim handle
+ */
+struct TALER_MERCHANT_OrderClaimHandle;
+
+
+/**
+ * Callback called to process a POST /orders/$ID/claim response.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ * @param contract_terms the details of the contract
+ * @param sig merchant's signature over @a contract_terms (already verified)
+ * @param h_contract_terms hash over @a contract_terms (computed
+ * client-side to verify @a sig)
+ */
+typedef void
+(*TALER_MERCHANT_OrderClaimCallback) (
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr,
+ const json_t *contract_terms,
+ const struct TALER_MerchantSignatureP *sig,
+ const struct GNUNET_HashCode *h_contract_terms);
+
+
+/**
+ * Calls the POST /orders/$ID/claim API at the backend. That is,
+ * retrieve the final contract terms including the client nonce.
+ * This is a PUBLIC API for wallets.
+ *
+ * @param ctx execution context
+ * @param backend_url base URL of the merchant backend
+ * @param order_id order id used to perform the lookup
+ * @param nonce nonce to use to claim the proposal
+ * @param cb callback which will work the response gotten from the backend
+ * @param cb_cls closure to pass to @a cb
+ * @return handle for this handle, NULL upon errors
+ */
+struct TALER_MERCHANT_OrderClaimHandle *
+TALER_MERCHANT_order_claim (struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *order_id,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *nonce,
+ TALER_MERCHANT_OrderClaimCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel a POST /order/$ID/claim request.
+ *
+ * @param och handle to the request to be canceled
+ */
+void
+TALER_MERCHANT_order_claim_cancel (struct TALER_MERCHANT_OrderClaimHandle *och);
+
+
/* ********************* OLD ************************** */
@@ -1520,63 +1576,6 @@ TALER_MERCHANT_refund_increase_cancel (
/* ********************* /proposal *********************** */
-/**
- * Handle to a GET /proposal operation
- */
-struct TALER_MERCHANT_ProposalLookupOperation;
-
-
-/**
- * Callback called to work a GET /proposal response.
- *
- * @param cls closure
- * @param hr HTTP response details
- * @param contract_terms the details of the contract
- * @param sig merchant's signature over @a contract_terms
- * @param contract_hash hash over @a contract_terms
- */
-typedef void
-(*TALER_MERCHANT_ProposalLookupOperationCallback) (
- void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const json_t *contract_terms,
- const struct TALER_MerchantSignatureP *sig,
- const struct GNUNET_HashCode *contract_hash);
-
-
-/**
- * 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_url base URL of the merchant backend
- * @param order_id order id used to perform the lookup
- * @param nonce nonce to use, only used when requesting the proposal the first time,
- * can be NULL to omit the nonce (after the first request)
- * @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_url,
- const char *order_id,
- const struct GNUNET_CRYPTO_EddsaPublicKey *nonce,
- 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_proposal_lookup_cancel (
- struct TALER_MERCHANT_ProposalLookupOperation *plo);
-
-
/* ********************* /pay *********************** */
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index 33d23e50..4e0b3fd6 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -425,27 +425,27 @@ TALER_TESTING_cmd_merchant_post_orders (const char *label,
const char *order);
-/* ******************** OLD ******************* */
-
-
/**
- * Make a "proposal lookup" command.
+ * Make a "claim order" command.
*
* @param label command label.
* @param merchant_url base URL of the merchant backend
* serving the proposal lookup request.
* @param http_status expected HTTP response code.
- * @param proposal_reference reference to a "proposal" CMD.
- * @param order_id order id to lookup, can be NULL.
- *
+ * @param order_reference reference to a POST order CMD, can be NULL if @a order_id given
+ * @param order_id order id to lookup, can be NULL (then we use @a order_reference)
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_merchant_post_orders_lookup (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- const char *proposal_reference,
- const char *order_id);
+TALER_TESTING_cmd_merchant_claim_order (const char *label,
+ const char *merchant_url,
+ unsigned int http_status,
+ const char *order_reference,
+ const char *order_id);
+
+
+/* ******************** OLD ******************* */
+
/**
* Make a "check payment" test command.