taler-docs

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

get-templates-TEMPLATE_ID.rst (5292B)


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