commit 20daac980667d5d1a2b39bb2eb03a69b6bc0123e
parent 326d62fb55a1020d122a24be6cb599a1ea7c8f3f
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 5 May 2016 08:57:03 +0200
fixing #4490
Diffstat:
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/api-merchant.rst b/api-merchant.rst
@@ -272,6 +272,8 @@ merchant's offer.
Send the deposit permission to the merchant. Note that the URL may differ between
merchants.
+ .. _deposit-permission:
+
:reqheader Content-Type: application/json
:<json base32 H_wire: the hashed :ref:`wire details <wireformats>` of this merchant. The wallet takes this value as-is from the contract
:<json base32 H_contract: the base32 encoding of the field `h_contract` of the contract `blob <contract-blob>`. The wallet can choose whether to take this value obtained from the field `h_contract`, or regenerating one starting from the values it gets within the contract
diff --git a/impl-merchant.rst b/impl-merchant.rst
@@ -66,7 +66,7 @@ The Merchant Backend HTTP API
The following API are made available by the merchant's `backend` to the merchant's `frontend`.
.. http:post:: /hash-contract
-
+
Ask the backend to compute the hash of the `contract` given in the POST's body (the full contract
should be the value of a JSON field named `contract`). This feature allows frontends to verify
that names of resources which are going to be sold are actually `in` the paid cotnract. Without
@@ -99,13 +99,29 @@ The following API are made available by the merchant's `backend` to the merchant
**Response**
:status 200 OK:
- The backend has successfully created the contract.
- :status 400 Bad Request:
- Request not understood. The JSON was invalid. Possibly due to some error in
- formatting the JSON by the `frontend`.
+ The backend has successfully created the contract. It responds with a `ContractBackendResponse`_ object. This request should virtually always be successful.
On success, the `frontend` should pass this response verbatim to the wallet.
+ **Details:**
+
+ .. _ContractBackendResponse:
+ .. code-block:: tsref
+
+ interface ContractBackendResponse {
+ // Contract with additional fields added by the backend.
+ contract : Object;
+
+ // Signature of the merchant over the contract.
+ // Purpose: TALER_SIGNATURE_MERCHANT_CONTRACT
+ merchant_sig: EddsaSignature;
+
+ // Hash of the contract, technically redundant, but allows
+ // the frontend to not have logic for canonicalizing the
+ // contract and doing the hasing itself.
+ H_contract: HashCode;
+
+ }
.. http:post:: /pay
@@ -114,9 +130,9 @@ The following API are made available by the merchant's `backend` to the merchant
**Request:**
The `frontend` passes the :ref:`deposit permission <deposit-permission>`
- received from the wallet, by adding the fields `max_fee`, `amount` (see
- :ref:`contract`) and optionally adding a field named `edate`, indicating a
- deadline by which he would expect to receive the bank transfer for this deal
+ received from the wallet, and optionally adding a field named `edate`,
+ indicating a deadline by which he would expect to receive the bank transfer
+ for this deal. Note that the `edate` must be after the `refund_deadline`.
**Response:**