taler-docs

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

get-templates-TEMPLATE_ID.rst (7229B)


      1 .. http:get:: [/instances/$INSTANCE]/templates/$TEMPLATE_ID
      2 
      3   This is used to obtain information about a specific template by wallets
      4   before they ask the user to fill in details.
      5   This endpoint is available since protocol **v11**.
      6 
      7   **Response:**
      8 
      9   :http:statuscode:`200 OK`:
     10     The backend has successfully returned the detailed information about a specific template.
     11     Returns a `WalletTemplateDetailsResponse`.
     12   :http:statuscode:`401 Unauthorized`:
     13     The request is unauthorized.
     14   :http:statuscode:`404 Not found`:
     15     The instance or template(ID) is unknown to the backend.
     16     Returned with ``TALER_EC_MERCHANT_GENERIC_TEMPLATE_UNKNOWN``.
     17   :http:statuscode:`500 Internal Server Error`:
     18     The server experienced an internal failure.
     19     Returned with ``TALER_EC_GENERIC_DB_FETCH_FAILED`` or
     20     ``TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE``.
     21 
     22   **Details:**
     23 
     24   For ``inventory-cart`` templates the backend augments the returned
     25   ``template_contract`` with ``inventory_payload`` containing products,
     26   categories, and units. The payload is filtered by the template's
     27   ``selected_all``, ``selected_categories``, and ``selected_products`` settings.
     28 
     29   .. ts:def:: WalletTemplateDetailsResponse
     30 
     31     interface WalletTemplateDetailsResponse {
     32 
     33       // Hard-coded information about the contract terms
     34       // for this template.
     35       template_contract: TemplateContractDetails;
     36 
     37       // Key-value pairs matching a subset of the
     38       // fields from ``template_contract`` that are
     39       // user-editable defaults for this template.
     40       // Since protocol **v13**.
     41       editable_defaults?: Object;
     42 
     43       // Required currency for payments.  Useful if no
     44       // amount is specified in the ``template_contract``
     45       // but the user should be required to pay in a
     46       // particular currency anyway.  Merchant backends
     47       // may reject requests if the ``template_contract``
     48       // or ``editable_defaults`` do
     49       // specify an amount in a different currency.
     50       // This parameter is optional; since protocol **v34** it is
     51       // returned whenever the ``template_contract`` specifies a
     52       // ``currency``.
     53       // Since protocol **v13**.
     54       required_currency?: string;
     55 
     56       // Information about the merchant instance that will create
     57       // the order.  The final contract terms remain authoritative,
     58       // as the instance configuration may change between this
     59       // request and order creation.
     60       // Since protocol **v41**.
     61       merchant: Merchant;
     62 
     63       // Public key currently used by the merchant instance.
     64       // The final contract terms remain authoritative, as the key
     65       // may change between this request and order creation.
     66       // Since protocol **v41**.
     67       merchant_pub: EddsaPublicKey;
     68 
     69       // Trusted exchanges that are currently known to be compatible
     70       // with at least one active payment target of the merchant instance.
     71       // This list is advisory and may be empty or incomplete when an
     72       // exchange's keys cannot be obtained in time.  The backend may
     73       // omit this field entirely when it does not perform exchange
     74       // discovery, for example to avoid its latency or resource cost.
     75       // Since protocol **v41**.
     76       exchange_candidates?: TemplateExchangeCandidate[];
     77     }
     78 
     79   .. ts:def:: TemplateExchangeCandidate
     80 
     81     // An exchange that may be usable for an order instantiated from
     82     // this template.  Whether it is present in the final contract also
     83     // depends on the selected amount and payment target, legal limits,
     84     // KYC state, and the configuration at order creation time.
     85     interface TemplateExchangeCandidate {
     86 
     87       // Base URL of the exchange REST API.
     88       base_url: WebURL;
     89 
     90       // Currency for which the merchant trusts this exchange.
     91       currency: string;
     92 
     93       // Offline master public key of the exchange.
     94       master_pub: EddsaPublicKey;
     95 
     96       // Active merchant wire methods that the exchange is currently
     97       // known to support for this instance.
     98       wire_methods: string[];
     99     }
    100 
    101   .. ts:def:: InventoryPayload
    102 
    103     interface InventoryPayload {
    104       // Inventory products available for selection.
    105       // Since protocol **v25**.
    106       products: InventoryPayloadProduct[];
    107 
    108       // Categories referenced by the payload products.
    109       // Since protocol **v25**.
    110       categories: InventoryPayloadCategory[];
    111 
    112       // Custom units referenced by the payload products.
    113       // Since protocol **v25**.
    114       units: InventoryPayloadUnit[];
    115     }
    116 
    117   .. ts:def:: InventoryPayloadProduct
    118 
    119     interface InventoryPayloadProduct {
    120       // Product identifier.
    121       // Since protocol **v25**.
    122       product_id: Slug;
    123 
    124       // Human-readable product name.
    125       // Since protocol **v25**.
    126       product_name: string;
    127 
    128       // Human-readable product description.
    129       // Since protocol **v25**.
    130       description: string;
    131 
    132       // Localized product descriptions.
    133       // Since protocol **v25**.
    134       description_i18n?: { [lang_tag: string]: string };
    135 
    136       // Unit identifier for the product.
    137       // Since protocol **v25**.
    138       unit: Slug;
    139 
    140       // Price tiers for the product.
    141       // Since protocol **v25**.
    142       unit_prices: Amount[];
    143 
    144       // Whether fractional quantities are allowed for this unit.
    145       // Since protocol **v25**.
    146       unit_allow_fraction: boolean;
    147 
    148       // Maximum fractional precision (0-6) enforced for this unit.
    149       // Since protocol **v25**.
    150       unit_precision_level: Integer;
    151 
    152       // Remaining stock available for selection.
    153       // Since protocol **v25**.
    154       remaining_stock: DecimalQuantity;
    155 
    156       // Category identifiers associated with this product.
    157       // Since protocol **v25**.
    158       categories: Integer[];
    159 
    160       // Taxes applied to the product.
    161       // Since protocol **v25**.
    162       taxes?: Tax[];
    163 
    164       // Hash of the product image (if any).
    165       // Since protocol **v25**.
    166       image_hash?: string;
    167     }
    168 
    169   .. ts:def:: InventoryPayloadCategory
    170 
    171     interface InventoryPayloadCategory {
    172       // Category identifier.
    173       // Since protocol **v25**.
    174       category_id: Integer;
    175 
    176       // Human-readable category name.
    177       // Since protocol **v25**.
    178       category_name: string;
    179 
    180       // Localized category names.
    181       // Since protocol **v25**.
    182       category_name_i18n?: { [lang_tag: string]: string };
    183     }
    184 
    185   .. ts:def:: InventoryPayloadUnit
    186 
    187     interface InventoryPayloadUnit {
    188       // Unit identifier.
    189       // Since protocol **v25**.
    190       unit: Slug;
    191 
    192       // Human-readable long label.
    193       // Since protocol **v25**.
    194       unit_name_long: string;
    195 
    196       // Localized long labels.
    197       // Since protocol **v25**.
    198       unit_name_long_i18n?: { [lang_tag: string]: string };
    199 
    200       // Human-readable short label.
    201       // Since protocol **v25**.
    202       unit_name_short: string;
    203 
    204       // Localized short labels.
    205       // Since protocol **v25**.
    206       unit_name_short_i18n?: { [lang_tag: string]: string };
    207 
    208       // Whether fractional quantities are allowed for this unit.
    209       // Since protocol **v25**.
    210       unit_allow_fraction: boolean;
    211 
    212       // Maximum fractional precision (0-6) enforced for this unit.
    213       // Since protocol **v25**.
    214       unit_precision_level: Integer;
    215     }