Create Order Constraints
This guide outlines all the constraints and validations that T-Gate checks before accepting an order. Understanding these constraints is crucial for partners to ensure seamless order processing and integration with T-Gate.
Introduction
In T-Gate, an order is the main goal of partner integration. It acts as the connection between all components of the platform, linking brands, branches, menus, sections, and items. Successfully creating an order signifies that all these elements are working together cohesively.
Order Constraints
Before an order can be created, it must meet specific criteria that ensure all aspects of the T-Gate platform are in sync. Below are the validations and constraints applied:
Order Validations
Model | Expected State |
---|---|
Brand | Must exist within your integration scopes |
Branch | - Must exist within your integration scopes - Must be working (within working hours, is_force_closed: false) - Must not be force closed under the chosen brand (force_closed_in_brands does not include brand_id) |
Menu | - Must exist within your integration scopes - Must be globally active (is_active: true) - Must be active under the chosen branch (inactive_in_branches does not include branch_id) |
Section | - Must be active (within working hours, is_force_closed: false) - Must be active under the chosen branch (force_closed_in_branches does not include branch_id) |
Item | - Must be active (is_active: true) - Must be active under the chosen branch (inactive_in_branches does not include branch_id) |
General Order Constraints
- Brand, Branch, Menu: Must exist within your integration scopes.
- app_order_uuid: Should be unique per order, representing the order ID in your application.
- Full Address, Lat, Lng: Required in case of delivery.
- Service Type: Must be specified from the list of services the brand_branch provides and must be active.
- Total Price: Must match the price calculated from the Calculate Order Total Price API.
- Items: Order should specify at least one item (product).
- Customer Phone Number: Required, though no validations are made on the value sent.
Items Object Format
{
"items": [
{
"quantity": 3, // Must be specified; set to 1 for modifier_group
"item_id": 192,
"notes": "Optional String, extra notes for each item",
"children": [ // JSON Array of sub-items; each with quantity, item_id, notes, and children
{
"quantity": 1,
"item_id": 326,
"notes": "",
"children": [] // JSON Array of sub-items; each with quantity, item_id, notes, and children
}
]
}
]
}
Item Object Validations
- Modifier Group Quantity: Should be always set to 1.
- Total Modifiers Quantity: Total quantities of all modifiers under a modifier_group parent should be within the
modifier_group.min
andmodifier_group.max
limits. - Modifier Quantity: Quantity of a single modifier under its modifier_group parent should not exceed the
modifier_group.max_number_of_same_item
. - Top Level Items: Must be products; cannot start with a modifier_group or modifier.
When Order Fails
Various issues can cause an order creation to fail, impacting the customer experience. Understanding these failures and implementing solutions can help mitigate issues:
- Concurrent Updates: Changes to the order or related data during processing.
- Failing Webhooks: Missed notifications or updates due to webhook delivery issues.
- Force Closure: Attempting to create an order during a force closure period.
- Incorrect Price Calculation: Mismatch between actual and calculated prices.
Updated 7 months ago