Orders
Type | Base Path | Trigger Name |
---|---|---|
REST resource | ~{realm}/orders/ | orders |
This resource holds orders or bookings.
Endpoints
Name | Method | Relative Path | Payload | Response | Description |
---|---|---|---|---|---|
addOrder | POST | ~{realm}/orders/ | Order | Stored_Order | Adds a new order to the list. |
listOrders | GET | ~{realm}/orders/ | N/A | Stored_Order[] | Retrieves a list of orders. |
getOrder | GET | ~{realm}/orders/{id} | N/A | Stored_Order | Retrieves a order. |
putOrder | PUT | ~{realm}/orders/{id} | Order | Stored_Order | Replaces a order. |
updateOrder | PATCH | ~{realm}/orders/{id} | Partial_Order | Stored_Order | Updates specified order fields. |
removeOrder | DELETE | ~{realm}/orders/{id} | N/A | N/A | Deletes a order. |
Permissions
Permission | Description |
---|---|
edit-orders | Client is allowed to add new orders and to modify or delete existing orders. |
show-orders | Client is allowed to query the order list and to fetch individual orders. |
Entities
Interface Order
namespace Order {
type State = 'requested' | 'booked' | 'active' | 'shipped' | 'fulfilled' | 'cancelled';
type Type = 'take-out';
}
interface Order {
'owner?: number;
'location': number;
'state': Order.State;
'name': string;
'type'?: Order.Type;
'description'?: string;
'resources'?: number[];
'users'?: number[];
'customers'?: number[];
'start-date'?: DateTime;
'schedules'?: string[];
'end-date'?: DateTime;
'items'?: Item[];
'auth-code'?: string;
'payments'?: Payment[];
'client-reference'?: string;
'order-reference'?: string;
'id'?: number;
'created'?: DateTime;
'updated'?: DateTime;
'deleted'?: DateTime;
'updated-by'?: number;
'updated-from'?: number;
'tags'?: string[];
'labels'?: number[];
}
Property | Data Type | Description |
---|---|---|
owner | Int64 | ID of User this order belongs to. |
location | Int64 | ID of Location this order belongs to. |
state | Order.State | The order's state. (fulfilled and cancelled are each final states.) |
name | String | The name of the order. |
type | Order.Type | Order type. take-out for take-out orders and null otherwise. |
description | String? | An optional description. |
resources | Int64[]? | A list of Resource IDs that are reserved by this order (bookable objects). |
users | Int64[]? | A list of User IDs that are reserved by this order (bookable personell). |
customers | Int64[]? | A list of Customer IDs that are associated with this order. |
start-date | DateTime? | A starting date when this order becomes active. |
schedules | CronExpr[]? | A schedule that specifies at what time this order is active (applicable only between start-date and end-date ). |
end-date | DateTime? | An ending date when this order becomes inactive. |
items | Item[]? | A list of items that is ordered (bookable products). This list is required for take-out orders. |
auth-code | String? | An optional authorization code that must be provided by the customer before a take-out order can be delivered. |
payments | Payment[]? | If the order has been pre-paid, the Payment (s) should be specified here. |
client-reference | String | A unique identifier specifying what client device was used to place the order. |
order-reference | String | A unique order identifier. This value must be unique across all orders in the table and is required for take-out orders. |
id | Int64? | The resource ID of this entity. |
created | DateTime? | Date and time when this entity was first created. |
updated | DateTime? | Date and time when this entity was last modified. |
deleted | DateTime? | Date and time when this entity was deleted. |
updated-by | Int64? | ID of User who last modified this entity. |
updated-from | Int64? | ID of Till (trusted device) which last modified this entity. |
labels | Int64[]? | A list of Label IDs associated with this entity. |
If an order is pre-paid, the payments
list should specify the Payment
(s) and amounts
that have been collected. Unlike payments in the journal, the amounts are always positive in orders, and
gratuities negative.
For integrators, the order-reference
property should reference the order in the external system, perhaps with a prefix
or postfix to ensure the reference is unique across all integrations. To reduce the risk of conflicts, an order
reference must be at least 24 character long.
Otherwise, the suggested format for the order-reference
property is a 13-digit timestamp (milliseconds since epoch)
followed by a dash and an UUID (like 1575043847811-31c36e7f-f861-43bb-a198-ae9c13074447
).
Remember that orders with duplicate order-reference
values will be rejected. Ensure your order references are unlikely
to conflict with other integrators' orders, and use them to detect if an order has already been submitted in case of
network problems.
The client-reference
is optional, but can be used to identify the customer device from where the order was placed.
This may use the same pattern as order-reference
, or use a unique hardware ID instead of the UUID (just make sure the
client-reference
is generated only once and stays the same between requests).