taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

commit 7b70553c25d6e0d23bdb6a666dc81e20e0b293d2
parent 1b1ff77b7179430ee488d8eab8d4fb95cade49cd
Author: Christian Blättler <blatc2@bfh.ch>
Date:   Tue, 11 Jun 2024 22:27:03 +0200

clean up create order api

Diffstat:
Mcore/api-merchant.rst | 41++++++++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/core/api-merchant.rst b/core/api-merchant.rst @@ -2398,18 +2398,39 @@ Creating orders .. ts:def:: Order - interface Order { - // If this field is omitted, version 0 is assumed. - // Version 1 supports the ``choices`` array, see + type Order = (OrderV1 | OrderV0) & OrderCommon; + + .. ts:def:: OrderV1 + + interface OrderV1 { + // Version 1 order support discounts and subscriptions. // https://docs.taler.net/design-documents/046-mumimo-contracts.html // @since protocol **vSUBSCRIBE** - version?: 0 | 1; + version: 1; + + // List of contract choices that the customer can select from. + // @since protocol **vSUBSCRIBE** + choices?: OrderChoice[]; + } + + .. ts:def:: OrderV0 + + interface OrderV0 { + // Optional, defaults to 0 if not set. + version?: 0; - // Only available in v0 orders. // Total price for the transaction. The exchange will subtract deposit // fees from that amount before transferring it to the merchant. amount: Amount; + // Maximum total deposit fee accepted by the merchant for this contract. + // Overrides defaults of the merchant instance. + max_fee?: Amount; + } + + .. ts:def:: OrderCommon + + interface OrderCommon { // Human-readable description of the whole purchase. summary: string; @@ -2424,10 +2445,6 @@ Creating orders // encoded in it (such as a short product identifier and timestamp). order_id?: string; - // List of contract choices that the customer can select from. - // @since protocol **vSUBSCRIBE** - choices?: OrderChoice[]; - // 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, @@ -2449,11 +2466,6 @@ Creating orders // messages. fulfillment_message_i18n?: { [lang_tag: string]: string }; - // Only available in v0 orders. - // 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[]; @@ -2500,7 +2512,6 @@ Creating orders // contract without storing it separately in their database. // Must really be an Object (not a string, integer, float or array). extra?: Object; - }