summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Blättler <blatc2@bfh.ch>2024-03-28 12:33:42 +0100
committerChristian Blättler <blatc2@bfh.ch>2024-03-28 12:33:46 +0100
commit55833ba07687599dd0da56f131b05c9f161a55c2 (patch)
treee84a5ab81432bb26485fc4bf3332364c2a792d85
parentfca2978e51c29b5e34ce5269c6fd3ea58ba30b8b (diff)
downloaddocs-55833ba07687599dd0da56f131b05c9f161a55c2.tar.gz
docs-55833ba07687599dd0da56f131b05c9f161a55c2.tar.bz2
docs-55833ba07687599dd0da56f131b05c9f161a55c2.zip
separate Order and ContractTerms interfaces
-rw-r--r--core/api-merchant.rst92
1 files changed, 82 insertions, 10 deletions
diff --git a/core/api-merchant.rst b/core/api-merchant.rst
index 152e5499..1dc128bf 100644
--- a/core/api-merchant.rst
+++ b/core/api-merchant.rst
@@ -2060,21 +2060,37 @@ Creating orders
.. ts:def:: Order
- type Order : MinimalOrderDetail | ContractTerms;
+ interface Order {
+ // Total price for the transaction.
+ // The exchange will subtract deposit fees from that amount
+ // before transferring it to the merchant.
+ amount: Amount;
- The following fields must be specified in the ``order`` field of the request. Other fields from
- `ContractTerms` are optional, and will override the defaults in the merchant configuration.
+ // Human-readable description of the whole purchase.
+ summary: string;
- .. ts:def:: MinimalOrderDetail
+ // Map from IETF BCP 47 language tags to localized summaries.
+ summary_i18n?: { [lang_tag: string]: string };
- interface MinimalOrderDetail {
- // Amount to be paid by the customer.
- amount: Amount;
+ // Unique, free-form identifier for the order.
+ // Must be unique within a merchant instance.
+ // For merchants that do not store proposals in their DB
+ // before the customer paid for them, the ``order_id`` can be used
+ // by the frontend to restore a proposal from the information
+ // encoded in it (such as a short product identifier and timestamp).
+ order_id?: string;
- // Short summary of the order.
- summary: string;
+ // List of contract choices that the customer can select from.
+ // @since protocol **vSUBSCRIBE**
+ choices?: ContractChoice[];
+
+ // URL where the same contract could be ordered again (if
+ // available). Returned also at the public order endpoint
+ // for people other than the actual buyer (hence public,
+ // in case order IDs are guessable).
+ public_reorder_url?: string;
- // See documentation of fulfillment_url in `ContractTerms`.
+ // See documentation of ``fulfillment_url`` field in ``ContractTerms``.
// Either fulfillment_url or fulfillment_message must be specified.
// When creating an order, the fulfillment URL can
// contain ``${ORDER_ID}`` which will be substituted with the
@@ -2084,6 +2100,62 @@ Creating orders
// See documentation of fulfillment_message in `ContractTerms`.
// Either fulfillment_url or fulfillment_message must be specified.
fulfillment_message?: string;
+
+ // Map from IETF BCP 47 language tags to localized fulfillment
+ // messages.
+ fulfillment_message_i18n?: { [lang_tag: string]: string };
+
+ // Maximum total deposit fee accepted by the merchant for this contract.
+ // Overrides defaults of the merchant instance.
+ max_fee?: Amount;
+
+ // List of products that are part of the purchase.
+ products?: Product[];
+
+ // Time when this contract was generated. If null, defaults to current
+ // time of merchant backend.
+ timestamp?: Timestamp;
+
+ // After this deadline has passed, no refunds will be accepted.
+ // Overrides deadline calculated from ``refund_delay`` in
+ // ``PostOrderRequest``.
+ refund_deadline?: Timestamp;
+
+ // After this deadline, the merchant won't accept payments for the contract.
+ // Overrides deadline calculated from default pay delay configured in
+ // merchant backend.
+ pay_deadline?: Timestamp;
+
+ // Transfer deadline for the exchange. Must be in the deposit permissions
+ // of coins used to pay for this order.
+ // Overrides deadline calculated from default wire transfer delay
+ // configured in merchant backend. Must be after refund deadline.
+ wire_transfer_deadline?: Timestamp;
+
+ // Base URL of the (public!) merchant backend API.
+ // Must be an absolute URL that ends with a slash.
+ // Defaults to the base URL this request was made to.
+ merchant_base_url?: string;
+
+ // Delivery location for (all!) products.
+ delivery_location?: Location;
+
+ // Time indicating when the order should be delivered.
+ // May be overwritten by individual products.
+ // Must be in the future.
+ delivery_date?: Timestamp;
+
+ // See documentation of ``auto_refund`` in ``ContractTerms``.
+ // Specifies for how long the wallet should try to get an
+ // automatic refund for the purchase.
+ auto_refund?: RelativeTime;
+
+ // Extra data that is only interpreted by the merchant frontend.
+ // Useful when the merchant needs to store extra information on a
+ // contract without storing it separately in their database.
+ // Must really be an Object (not a string, integer, float or array).
+ extra?: Object;
+
}
The following `MinimalInventoryProduct` can be provided if the parts of the