taler-docs

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

get-templates-TEMPLATE_ID.rst (5171B)


      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 `WalletTemplateDetailsRequest`.
     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   :http:statuscode:`500 Internal Server Error`:
     17     The server experienced an internal failure.
     18     Returned with ``TALER_EC_GENERIC_DB_FETCH_FAILED``.
     19 
     20   **Details:**
     21 
     22   For ``inventory-cart`` templates the backend augments the returned
     23   ``template_contract`` with ``inventory_payload`` containing products,
     24   categories, and units. The payload is filtered by the template's
     25   ``selected_all``, ``selected_categories``, and ``selected_products`` settings.
     26 
     27   .. ts:def:: WalletTemplateDetailsRequest
     28 
     29     interface WalletTemplateDetailsRequest {
     30 
     31       // Hard-coded information about the contract terms
     32       // for this template.
     33       template_contract: TemplateContractDetails;
     34 
     35       // Key-value pairs matching a subset of the
     36       // fields from ``template_contract`` that are
     37       // user-editable defaults for this template.
     38       // Since protocol **v13**.
     39       editable_defaults?: Object;
     40 
     41       // Required currency for payments.  Useful if no
     42       // amount is specified in the ``template_contract``
     43       // but the user should be required to pay in a
     44       // particular currency anyway.  Merchant backends
     45       // may reject requests if the ``template_contract``
     46       // or ``editable_defaults`` do
     47       // specify an amount in a different currency.
     48       // This parameter is optional.
     49       // Since protocol **v13**.
     50       required_currency?: string;
     51     }
     52 
     53   .. ts:def:: InventoryPayload
     54 
     55     interface InventoryPayload {
     56       // Inventory products available for selection.
     57       // Since protocol **v25**.
     58       products: InventoryPayloadProduct[];
     59 
     60       // Categories referenced by the payload products.
     61       // Since protocol **v25**.
     62       categories: InventoryPayloadCategory[];
     63 
     64       // Custom units referenced by the payload products.
     65       // Since protocol **v25**.
     66       units: InventoryPayloadUnit[];
     67     }
     68 
     69   .. ts:def:: InventoryPayloadProduct
     70 
     71     interface InventoryPayloadProduct {
     72       // Product identifier.
     73       // Since protocol **v25**.
     74       product_id: string;
     75 
     76       // Human-readable product name.
     77       // Since protocol **v25**.
     78       product_name: string;
     79 
     80       // Human-readable product description.
     81       // Since protocol **v25**.
     82       description: string;
     83 
     84       // Localized product descriptions.
     85       // Since protocol **v25**.
     86       description_i18n?: { [lang_tag: string]: string };
     87 
     88       // Unit identifier for the product.
     89       // Since protocol **v25**.
     90       unit: string;
     91 
     92       // Price tiers for the product.
     93       // Since protocol **v25**.
     94       unit_prices: Amount[];
     95 
     96       // Whether fractional quantities are allowed for this unit.
     97       // Since protocol **v25**.
     98       unit_allow_fraction: boolean;
     99 
    100       // Maximum fractional precision (0-6) enforced for this unit.
    101       // Since protocol **v25**.
    102       unit_precision_level: Integer;
    103 
    104       // Remaining stock available for selection.
    105       // Since protocol **v25**.
    106       remaining_stock: DecimalQuantity;
    107 
    108       // Category identifiers associated with this product.
    109       // Since protocol **v25**.
    110       categories: Integer[];
    111 
    112       // Taxes applied to the product.
    113       // Since protocol **v25**.
    114       taxes?: Tax[];
    115 
    116       // Hash of the product image (if any).
    117       // Since protocol **v25**.
    118       image_hash?: string;
    119     }
    120 
    121   .. ts:def:: InventoryPayloadCategory
    122 
    123     interface InventoryPayloadCategory {
    124       // Category identifier.
    125       // Since protocol **v25**.
    126       category_id: Integer;
    127 
    128       // Human-readable category name.
    129       // Since protocol **v25**.
    130       category_name: string;
    131 
    132       // Localized category names.
    133       // Since protocol **v25**.
    134       category_name_i18n?: { [lang_tag: string]: string };
    135     }
    136 
    137   .. ts:def:: InventoryPayloadUnit
    138 
    139     interface InventoryPayloadUnit {
    140       // Unit identifier.
    141       // Since protocol **v25**.
    142       unit: string;
    143 
    144       // Human-readable long label.
    145       // Since protocol **v25**.
    146       unit_name_long: string;
    147 
    148       // Localized long labels.
    149       // Since protocol **v25**.
    150       unit_name_long_i18n?: { [lang_tag: string]: string };
    151 
    152       // Human-readable short label.
    153       // Since protocol **v25**.
    154       unit_name_short: string;
    155 
    156       // Localized short labels.
    157       // Since protocol **v25**.
    158       unit_name_short_i18n?: { [lang_tag: string]: string };
    159 
    160       // Whether fractional quantities are allowed for this unit.
    161       // Since protocol **v25**.
    162       unit_allow_fraction: boolean;
    163 
    164       // Maximum fractional precision (0-6) enforced for this unit.
    165       // Since protocol **v25**.
    166       unit_precision_level: Integer;
    167     }