UNPKG

@windingtree/wt-write-api

Version:

API to write data to the Winding Tree platform

191 lines 8.08 kB
{ "type": "array", "description": "Array of RatePlans", "items": { "description": "Rate plan for specified room types. All prices are meant for a single room for a single night for a single person.\nWe recommend using [wt-pricing-algorithms](https://github.com/windingtree/wt-pricing-algorithms) library for this.\n\nAlgorithm to calculate price\n- choose the currency you want to compute the price in\n- pick the right ratePlan(s) based on the chosen currency, availableForTravel field and provided booking dates\n- check restrictions and drop rate plans that the booking doesn't meet\n- for every rate plan as rp_i\n - for every person as p_j\n apply the best of any fitting price modifiers (pro-consumer strategy, this will change)\n multiply the computed rate by length of stay\n - store the final price for rp_i\n- compare all final prices and pick the one based on the chosen resolution strategy\n", "type": "object", "required": [ "id", "name", "price", "roomTypeIds" ], "properties": { "id": { "description": "ID of the rate plan", "title": "ID", "type": "string", "maxLength": 100 }, "name": { "description": "Name of the rate plan to show to users", "title": "Entity name", "type": "string", "maxLength": 150 }, "description": { "description": "Rate plan description in plain text", "title": "Markdown description", "type": "string", "maxLength": 3000 }, "currency": { "description": "Currency in which are all the prices of this rate plan. If not set, the hotel currency setting will be used.", "title": "Currency code", "type": "string", "minLength": 3, "maxLength": 3, "format": "currency-code" }, "price": { "type": "number", "format": "float", "description": "Base price for given room type for one night and one person.", "minimum": -3.402823669209385e+38, "maximum": 3.402823669209385e+38 }, "roomTypeIds": { "type": "array", "description": "List of all room types that this rate plan applies to", "minItems": 1, "maxItems": 30, "uniqueItems": true, "items": { "description": "RoomType id", "title": "ID", "type": "string", "maxLength": 100 } }, "updatedAt": { "type": "string", "format": "date-time", "description": "Date-time when the data was last changed. Used by consumers to handle incremental updates and caching." }, "availableForReservation": { "type": "object", "description": "A time period during which this rate plan can be used to compute prices for a booking, i. e. a hotel can have different rate plans that are used for reservations for the same date that are placed in different months. If this restriction is not set, the rate plan can be used for booking with no time restriction.", "required": [ "from", "to" ], "properties": { "from": { "type": "string", "format": "date" }, "to": { "type": "string", "format": "date" } } }, "availableForTravel": { "type": "object", "description": "A time period of stay during which this rate plan should be used to compute prices, i. e. prices in this rate plan are applicable in August. If this restriction is not set, the rate plan can be used for booking for any time.", "required": [ "from", "to" ], "properties": { "from": { "type": "string", "format": "date" }, "to": { "type": "string", "format": "date" } } }, "modifiers": { "type": "array", "description": "List of price modifiers, i. e. discounts based on length of stay. For now, the list is very limited.", "items": { "type": "object", "description": "A set of conditions that can affect the resulting price. If the conditions are met, the modifier is applied to all travellers:\n\nIf a single person is travelling, she will pay 100 EUR. If two people are coming, they will also pay 100 EUR (two times half the price). If three people are coming, they will pay each 50% of base price or 150 EUR in total.\n\n```\n {\n \"price\": 100,\n \"modifiers\": [\n {\n \"adjustment\": -50,\n \"unit\": \"percentage\",\n \"conditions\": {\n \"minOccupants\": 2\n }\n }\n ]\n}\n```\n", "required": [ "adjustment", "unit", "conditions" ], "properties": { "adjustment": { "description": "How much will the resulting price be adjusted?", "type": "number", "format": "float", "minimum": -3.402823669209385e+38, "maximum": 3.402823669209385e+38 }, "unit": { "description": "In what unit is the adjustment?", "type": "string", "enum": [ "percentage", "absolute" ] }, "conditions": { "type": "object", "properties": { "from": { "description": "First day the modifier is applied to (including)", "type": "string", "format": "date" }, "to": { "description": "Last day the modifier is applied to (including)", "type": "string", "format": "date" }, "minLengthOfStay": { "description": "Minimal length of stay the modifer is applicable to. If there are multiple modifiers with lengthOfStay condition matching the minimal length of stay, the price for the longest length of stay is used.", "type": "integer" }, "maxAge": { "description": "The modifier is applicable to occupants of this age or younger at the time of arrival to the stay. If multiple modifiers are specified with different maxAge, the modifier with the lowest fitting limit is applied.", "type": "integer" }, "minOccupants": { "description": "The modifier is applicable if there are at least this number of persons staying in a room. If multiple modifiers are specified with different minOccupants, the modifier with the highest fitting limit is applied.", "type": "integer" } } } } } }, "restrictions": { "type": "object", "description": "Restrictions for this rate plan. If a booking fits all restrictions, this rate plan can be used. If no restrictions are set, rate plan can be applied at any valid time.", "properties": { "bookingCutOff": { "description": "How many days in advance booking starts / ends. If not specified there is no restriction.", "type": "object", "properties": { "min": { "type": "integer" }, "max": { "type": "integer" } } }, "lengthOfStay": { "description": "How long does the stay have to be to apply this rate plan. If not specified, there is no restriction.", "type": "object", "properties": { "min": { "type": "integer", "default": 1 }, "max": { "type": "integer" } } } } } } } }