From 692c8f194e37d04a4a957229ffe7259eb11b3771 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 20 Jul 2020 17:11:14 +0530 Subject: fix broken indentation --- core/api-merchant.rst | 384 +++++++++++++++++++++++++------------------------- 1 file changed, 192 insertions(+), 192 deletions(-) (limited to 'core/api-merchant.rst') diff --git a/core/api-merchant.rst b/core/api-merchant.rst index a136eea3..fadfb3d5 100644 --- a/core/api-merchant.rst +++ b/core/api-merchant.rst @@ -2257,225 +2257,225 @@ The Contract Terms The contract terms must have the following structure: - .. ts:def:: ContractTerms - - interface ContractTerms { - // Human-readable description of the whole purchase - summary: string; - - // Map from IETF BCP 47 language tags to localized summaries - summary_i18n?: { [lang_tag: string]: string }; - - // Unique, free-form identifier for the proposal. - // 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; - - // Total price for the transaction. - // The exchange will subtract deposit fees from that amount - // before transferring it to the merchant. - amount: Amount; - - // The URL for this purchase. Every time is is visited, the merchant - // will send back to the customer the same proposal. Clearly, this URL - // can be bookmarked and shared by users. - fulfillment_url: string; - - // Maximum total deposit fee accepted by the merchant for this contract - max_fee: Amount; - - // Maximum wire fee accepted by the merchant (customer share to be - // divided by the 'wire_fee_amortization' factor, and further reduced - // if deposit fees are below 'max_fee'). Default if missing is zero. - max_wire_fee: Amount; - - // Over how many customer transactions does the merchant expect to - // amortize wire fees on average? If the exchange's wire fee is - // above 'max_wire_fee', the difference is divided by this number - // to compute the expected customer's contribution to the wire fee. - // The customer's contribution may further be reduced by the difference - // between the 'max_fee' and the sum of the actual deposit fees. - // Optional, default value if missing is 1. 0 and negative values are - // invalid and also interpreted as 1. - wire_fee_amortization: number; - - // List of products that are part of the purchase (see `Product`). - products: Product[]; - - // Time when this contract was generated - timestamp: Timestamp; - - // After this deadline has passed, no refunds will be accepted. - refund_deadline: Timestamp; - - // After this deadline, the merchant won't accept payments for the contact - pay_deadline: Timestamp; - - // Transfer deadline for the exchange. Must be in the - // deposit permissions of coins used to pay for this order. - wire_transfer_deadline: Timestamp; - - // Merchant's public key used to sign this proposal; this information - // is typically added by the backend Note that this can be an ephemeral key. - merchant_pub: EddsaPublicKey; - - // Base URL of the (public!) merchant backend API. - // Must be an absolute URL that ends with a slash. - merchant_base_url: string; - - // More info about the merchant, see below - merchant: Merchant; - - // The hash of the merchant instance's wire details. - h_wire: HashCode; - - // Wire transfer method identifier for the wire method associated with h_wire. - // The wallet may only select exchanges via a matching auditor if the - // exchange also supports this wire method. - // The wire transfer fees must be added based on this wire transfer method. - wire_method: string; - - // Any exchanges audited by these auditors are accepted by the merchant. - auditors: Auditor[]; - - // Exchanges that the merchant accepts even if it does not accept any auditors that audit them. - exchanges: Exchange[]; +.. ts:def:: ContractTerms + + interface ContractTerms { + // Human-readable description of the whole purchase + summary: string; + + // Map from IETF BCP 47 language tags to localized summaries + summary_i18n?: { [lang_tag: string]: string }; + + // Unique, free-form identifier for the proposal. + // 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; + + // Total price for the transaction. + // The exchange will subtract deposit fees from that amount + // before transferring it to the merchant. + amount: Amount; + + // The URL for this purchase. Every time is is visited, the merchant + // will send back to the customer the same proposal. Clearly, this URL + // can be bookmarked and shared by users. + fulfillment_url: string; + + // Maximum total deposit fee accepted by the merchant for this contract + max_fee: Amount; + + // Maximum wire fee accepted by the merchant (customer share to be + // divided by the 'wire_fee_amortization' factor, and further reduced + // if deposit fees are below 'max_fee'). Default if missing is zero. + max_wire_fee: Amount; + + // Over how many customer transactions does the merchant expect to + // amortize wire fees on average? If the exchange's wire fee is + // above 'max_wire_fee', the difference is divided by this number + // to compute the expected customer's contribution to the wire fee. + // The customer's contribution may further be reduced by the difference + // between the 'max_fee' and the sum of the actual deposit fees. + // Optional, default value if missing is 1. 0 and negative values are + // invalid and also interpreted as 1. + wire_fee_amortization: number; + + // List of products that are part of the purchase (see `Product`). + products: Product[]; + + // Time when this contract was generated + timestamp: Timestamp; + + // After this deadline has passed, no refunds will be accepted. + refund_deadline: Timestamp; + + // After this deadline, the merchant won't accept payments for the contact + pay_deadline: Timestamp; + + // Transfer deadline for the exchange. Must be in the + // deposit permissions of coins used to pay for this order. + wire_transfer_deadline: Timestamp; + + // Merchant's public key used to sign this proposal; this information + // is typically added by the backend Note that this can be an ephemeral key. + merchant_pub: EddsaPublicKey; + + // Base URL of the (public!) merchant backend API. + // Must be an absolute URL that ends with a slash. + merchant_base_url: string; + + // More info about the merchant, see below + merchant: Merchant; + + // The hash of the merchant instance's wire details. + h_wire: HashCode; + + // Wire transfer method identifier for the wire method associated with h_wire. + // The wallet may only select exchanges via a matching auditor if the + // exchange also supports this wire method. + // The wire transfer fees must be added based on this wire transfer method. + wire_method: string; + + // Any exchanges audited by these auditors are accepted by the merchant. + auditors: Auditor[]; + + // Exchanges that the merchant accepts even if it does not accept any auditors that audit them. + exchanges: Exchange[]; + + // Map from labels to locations + locations: { [label: string]: [location: Location], ... }; + + // Nonce generated by the wallet and echoed by the merchant + // in this field when the proposal is generated. + nonce: string; + + // Specifies for how long the wallet should try to get an + // automatic refund for the purchase. If this field is + // present, the wallet should wait for a few seconds after + // the purchase and then automatically attempt to obtain + // a refund. The wallet should probe until "delay" + // after the payment was successful (i.e. via long polling + // or via explicit requests with exponential back-off). + // + // In particular, if the wallet is offline + // at that time, it MUST repeat the request until it gets + // one response from the merchant after the delay has expired. + // If the refund is granted, the wallet MUST automatically + // recover the payment. This is used in case a merchant + // knows that it might be unable to satisfy the contract and + // desires for the wallet to attempt to get the refund without any + // customer interaction. Note that it is NOT an error if the + // merchant does not grant a refund. + 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. + extra?: any; + } - // Map from labels to locations - locations: { [label: string]: [location: Location], ... }; +The wallet must select a exchange that either the merchant accepts directly by +listing it in the exchanges array, or for which the merchant accepts an auditor +that audits that exchange by listing it in the auditors array. - // Nonce generated by the wallet and echoed by the merchant - // in this field when the proposal is generated. - nonce: string; +The `Product` object describes the product being purchased from the merchant. It has the following structure: - // Specifies for how long the wallet should try to get an - // automatic refund for the purchase. If this field is - // present, the wallet should wait for a few seconds after - // the purchase and then automatically attempt to obtain - // a refund. The wallet should probe until "delay" - // after the payment was successful (i.e. via long polling - // or via explicit requests with exponential back-off). - // - // In particular, if the wallet is offline - // at that time, it MUST repeat the request until it gets - // one response from the merchant after the delay has expired. - // If the refund is granted, the wallet MUST automatically - // recover the payment. This is used in case a merchant - // knows that it might be unable to satisfy the contract and - // desires for the wallet to attempt to get the refund without any - // customer interaction. Note that it is NOT an error if the - // merchant does not grant a refund. - auto_refund?: RelativeTime; +.. ts:def:: Product - // 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. - extra?: any; - } + interface Product { + // merchant-internal identifier for the product. + product_id?: string; - The wallet must select a exchange that either the merchant accepts directly by - listing it in the exchanges array, or for which the merchant accepts an auditor - that audits that exchange by listing it in the auditors array. + // Human-readable product description. + description: string; - The `Product` object describes the product being purchased from the merchant. It has the following structure: + // Map from IETF BCP 47 language tags to localized descriptions + description_i18n?: { [lang_tag: string]: string }; - .. ts:def:: Product + // The number of units of the product to deliver to the customer. + quantity?: Integer; - interface Product { - // merchant-internal identifier for the product. - product_id?: string; + // The unit in which the product is measured (liters, kilograms, packages, etc.) + unit?: string; - // Human-readable product description. - description: string; + // The price of the product; this is the total price for ``quantity`` times ``unit`` of this product. + price?: Amount; - // Map from IETF BCP 47 language tags to localized descriptions - description_i18n?: { [lang_tag: string]: string }; + // An optional base64-encoded product image + image?: ImageDataUrl; - // The number of units of the product to deliver to the customer. - quantity?: Integer; + // a list of taxes paid by the merchant for this product. Can be empty. + taxes?: Tax[]; - // The unit in which the product is measured (liters, kilograms, packages, etc.) - unit?: string; + // time indicating when this product should be delivered + delivery_date?: Timestamp; - // The price of the product; this is the total price for ``quantity`` times ``unit`` of this product. - price?: Amount; - - // An optional base64-encoded product image - image?: ImageDataUrl; - - // a list of taxes paid by the merchant for this product. Can be empty. - taxes?: Tax[]; - - // time indicating when this product should be delivered - delivery_date?: Timestamp; + // where to deliver this product. This may be an URL for online delivery + // (i.e. 'http://example.com/download' or 'mailto:customer@example.com'), + // or a location label defined inside the proposition's 'locations'. + // The presence of a colon (':') indicates the use of an URL. + delivery_location?: string; + } - // where to deliver this product. This may be an URL for online delivery - // (i.e. 'http://example.com/download' or 'mailto:customer@example.com'), - // or a location label defined inside the proposition's 'locations'. - // The presence of a colon (':') indicates the use of an URL. - delivery_location?: string; - } +.. ts:def:: Tax - .. ts:def:: Tax + interface Tax { + // the name of the tax + name: string; - interface Tax { - // the name of the tax - name: string; - - // amount paid in tax - tax: Amount; - } + // amount paid in tax + tax: Amount; + } - .. ts:def:: Merchant +.. ts:def:: Merchant - interface Merchant { - // label for a location with the business address of the merchant - address: string; + interface Merchant { + // label for a location with the business address of the merchant + address: string; - // the merchant's legal name of business - name: string; + // the merchant's legal name of business + name: string; - // label for a location that denotes the jurisdiction for disputes. - // Some of the typical fields for a location (such as a street address) may be absent. - jurisdiction: string; - } + // label for a location that denotes the jurisdiction for disputes. + // Some of the typical fields for a location (such as a street address) may be absent. + jurisdiction: string; + } - .. ts:def:: Location +.. ts:def:: Location - interface Location { - country?: string; - city?: string; - state?: string; - region?: string; - province?: string; - zip_code?: string; - street?: string; - street_number?: string; - } + interface Location { + country?: string; + city?: string; + state?: string; + region?: string; + province?: string; + zip_code?: string; + street?: string; + street_number?: string; + } - .. ts:def:: Auditor +.. ts:def:: Auditor - interface Auditor { - // official name - name: string; + interface Auditor { + // official name + name: string; - // Auditor's public key - auditor_pub: EddsaPublicKey; + // Auditor's public key + auditor_pub: EddsaPublicKey; - // Base URL of the auditor - url: string; - } + // Base URL of the auditor + url: string; + } - .. ts:def:: Exchange +.. ts:def:: Exchange - interface Exchange { - // the exchange's base URL - url: string; + interface Exchange { + // the exchange's base URL + url: string; - // master public key of the exchange - master_pub: EddsaPublicKey; - } + // master public key of the exchange + master_pub: EddsaPublicKey; + } -- cgit v1.2.3