taler-docs

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

get-templates-TEMPLATE_ID.rst (5406B)


      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 
     57   .. ts:def:: InventoryPayload
     58 
     59     interface InventoryPayload {
     60       // Inventory products available for selection.
     61       // Since protocol **v25**.
     62       products: InventoryPayloadProduct[];
     63 
     64       // Categories referenced by the payload products.
     65       // Since protocol **v25**.
     66       categories: InventoryPayloadCategory[];
     67 
     68       // Custom units referenced by the payload products.
     69       // Since protocol **v25**.
     70       units: InventoryPayloadUnit[];
     71     }
     72 
     73   .. ts:def:: InventoryPayloadProduct
     74 
     75     interface InventoryPayloadProduct {
     76       // Product identifier.
     77       // Since protocol **v25**.
     78       product_id: Slug;
     79 
     80       // Human-readable product name.
     81       // Since protocol **v25**.
     82       product_name: string;
     83 
     84       // Human-readable product description.
     85       // Since protocol **v25**.
     86       description: string;
     87 
     88       // Localized product descriptions.
     89       // Since protocol **v25**.
     90       description_i18n?: { [lang_tag: string]: string };
     91 
     92       // Unit identifier for the product.
     93       // Since protocol **v25**.
     94       unit: Slug;
     95 
     96       // Price tiers for the product.
     97       // Since protocol **v25**.
     98       unit_prices: Amount[];
     99 
    100       // Whether fractional quantities are allowed for this unit.
    101       // Since protocol **v25**.
    102       unit_allow_fraction: boolean;
    103 
    104       // Maximum fractional precision (0-6) enforced for this unit.
    105       // Since protocol **v25**.
    106       unit_precision_level: Integer;
    107 
    108       // Remaining stock available for selection.
    109       // Since protocol **v25**.
    110       remaining_stock: DecimalQuantity;
    111 
    112       // Category identifiers associated with this product.
    113       // Since protocol **v25**.
    114       categories: Integer[];
    115 
    116       // Taxes applied to the product.
    117       // Since protocol **v25**.
    118       taxes?: Tax[];
    119 
    120       // Hash of the product image (if any).
    121       // Since protocol **v25**.
    122       image_hash?: string;
    123     }
    124 
    125   .. ts:def:: InventoryPayloadCategory
    126 
    127     interface InventoryPayloadCategory {
    128       // Category identifier.
    129       // Since protocol **v25**.
    130       category_id: Integer;
    131 
    132       // Human-readable category name.
    133       // Since protocol **v25**.
    134       category_name: string;
    135 
    136       // Localized category names.
    137       // Since protocol **v25**.
    138       category_name_i18n?: { [lang_tag: string]: string };
    139     }
    140 
    141   .. ts:def:: InventoryPayloadUnit
    142 
    143     interface InventoryPayloadUnit {
    144       // Unit identifier.
    145       // Since protocol **v25**.
    146       unit: Slug;
    147 
    148       // Human-readable long label.
    149       // Since protocol **v25**.
    150       unit_name_long: string;
    151 
    152       // Localized long labels.
    153       // Since protocol **v25**.
    154       unit_name_long_i18n?: { [lang_tag: string]: string };
    155 
    156       // Human-readable short label.
    157       // Since protocol **v25**.
    158       unit_name_short: string;
    159 
    160       // Localized short labels.
    161       // Since protocol **v25**.
    162       unit_name_short_i18n?: { [lang_tag: string]: string };
    163 
    164       // Whether fractional quantities are allowed for this unit.
    165       // Since protocol **v25**.
    166       unit_allow_fraction: boolean;
    167 
    168       // Maximum fractional precision (0-6) enforced for this unit.
    169       // Since protocol **v25**.
    170       unit_precision_level: Integer;
    171     }