post-templates-TEMPLATE_ID.rst (2812B)
1 .. http:post:: [/instances/$INSTANCE]/templates/$TEMPLATE_ID 2 3 This using template can be modified by everyone and will be used to create order. 4 5 6 **Request:** 7 8 The request must be a `UsingTemplateDetailsRequest` and we accept JSON application and URL encoded. 9 10 **Response:** 11 12 :http:statuscode:`400 Bad Request`: 13 The request body is malformed. 14 :http:statuscode:`404 Not found`: 15 The template or instance is unknown. 16 :http:statuscode:`500 Internal Server Error`: 17 The server experienced an internal failure. 18 Returned with ``TALER_EC_GENERIC_DB_STORE_FAILED``. 19 20 The response is exactly the same type of response as when 21 creating an order using :ref:`POST /private/orders <post-order>`. 22 23 **Details:** 24 25 .. ts:def:: UsingTemplateDetailsRequest 26 27 type UsingTemplateDetailsRequest = (UsingTemplateFixedOrderRequest | UsingTemplateInventoryCartRequest | UsingTemplatePaivanaRequest) & UsingTemplateCommonRequest; 28 29 .. ts:def:: UsingTemplateCommonRequest 30 31 interface UsingTemplateCommonRequest { 32 33 // Type of the template being instantiated. 34 // Possible values include "fixed-order", 35 // "inventory-cart" and "paivana". 36 // Since protocol **v25**. 37 // Defaults to "fixed-order" while supporting previous 38 // protocol versions. 39 template_type: string; 40 41 // Summary to use in the contract. Only if 42 // not already specified by the template. 43 summary?: string; 44 45 // The amount to be paid, including tip. 46 amount?: Amount; 47 48 // Optional tip amount. Must match the currency of ``amount`` or the 49 // fixed template currency. 50 // Since protocol **v25**. 51 tip?: Amount; 52 53 } 54 55 .. ts:def:: UsingTemplateFixedOrderRequest 56 57 interface UsingTemplateFixedOrderRequest { 58 template_type: "fixed-order"; 59 60 } 61 62 .. ts:def:: UsingTemplateInventoryCartRequest 63 64 interface UsingTemplateInventoryCartRequest { 65 template_type: "inventory-cart"; 66 67 // Inventory-cart: selected products and quantities. 68 // Since protocol **v25**. 69 inventory_selection?: InventorySelectionEntry[]; 70 } 71 72 .. ts:def:: InventorySelectionEntry 73 74 interface InventorySelectionEntry { 75 // Inventory product to add. 76 product_id: string; 77 78 // Quantity in "<integer>[.<fraction>]" form using the product unit rules. 79 quantity: DecimalQuantity; 80 } 81 82 .. ts:def:: UsingTemplatePaivanaRequest 83 84 interface UsingTemplatePaivanaRequest { 85 template_type: "paivana"; 86 87 // URL of the Paivana-protected website to be 88 // accessed. Will become the fulfillment URL in 89 // the contract. 90 website: string; 91 92 // Client Paivana ID to grant access to. 93 // This becomes the "session_id" for session-based 94 // access control. 95 paivana_id: string; 96 97 }