Orders Model

ActionMethodResourceDescription
Get allGET/ordersGet all orders.
GetGET/orders/:order_idGet order with id order_id.
CreatePOST/ordersCreate an order.
UpdatePUT/orders/:order_idUpdate order with order_id.
DeleteDELETE/orders/:order_idDelete order with order_id.

The order model is composed of the following attributes:

AttributeTypeRequiredDescriptionWhereable
paymethod_idintegerno, required to createThe order's paymethod. (Paymethod ID).Yes
business_idintegerno, required to createThe order's business. (Business ID).Yes
customer_idintegernoThe order's customer. (Customer ID).Yes
delivery_typeintegerno, required to createThe order's delivery type.
1 for delivery.
2 for pickup.
Yes
delivery_datetimedateno, required to createThe order's delivery date time.No
statusintegeronly to updateThe order's status.Yes
commentstringnoThe order's comment.Yes
driver_idintegeronly to updateThe order's driver. (User ID)Yes
driver_tipfloatnoThe order's driver tip.Yes
pay_datastringnoThe order's pay data.No
delivery_zone_idintegernoThe order's delivery zone. (Delivery Zone ID).Yes
offer_idintegernoThe order's offer. (Offer ID).Yes
locationjsonno, required to createThe user's location.No
cashstringnoUser cash amount payment, should be higher than order total and whithout decimals
productsjsonno, required to createThe order's products. must be send in the specific structure as shown in Special Data typeNo
customerjsonnoThe order's customer if guest. must be send in the specific structure as shown in Special Data typeNo
app_idstringnoIt is a header parameter sent as "X-APP-X" to know from what medium the order was created for example, web, ios app, android app, etc.yes

📘

Restriction for orders.

  • An order can be made by any type of user.
  • An order can be modified by user level 0 or 2 (Type: Administrator or business owner).
  • Users level 0 (Type: administrator) can obtain all orders from all business of the project using mode:dashboard.
  • Users level 2 (Type: business owner) can obtain all orders related to his business using mode:dashboard.
  • Users level 3 (Type: customer) only can obtain orders made for this user.

Note: mode:dashboard only can be used by user level 0 or 2, any user without mode:dashboard only get their own orders.

Orders statuses

Below mentioned are the values of the order_status parameters of the respective Order Status:

StatusValueDescription
Pending0This status is set by default when an order is created.
Completed1This status is used to show that the order has been completed.
Rejected2This status is used to show that the order has been canceled.
Driver in business3This status is used to show that the driver arrived to the business and is waiting for the order to be ready.
Preparation Completed4This status is used to show that the order is ready for pickup.
Rejected by business5This status is used to show that the order has been Rejected by business.
Canceled by Driver6This status is used to show that the order has been Canceled by driver. (Only orders type delivery)
Accepted by business7This status is used to show that the order has been accepted by business.
Accepted by driver8This status is used to show that the order has been accepted by driver. (Only orders type delivery)
Pick up completed by driver9This status is used to show that the order has been picked up from the business by driver. (Only orders type delivery)
Pick up Failed by driver10This status is placed when the order could not be picked up on the business for some reason. (Only orders type delivery)
Delivery completed by driver11This status is placed when the order has been delivered to the customer by the driver, final state of success in delivery type.
Delivery Failed by driver12This status is placed when the order could not be delivered to the customer for any reason. (Only orders type delivery)
Preorder13This status is placed when the order is preorder base on create time, delivery time and business preorder time. (can not be set manually)
order not ready14This status is placed when the order is not ready and the driver is in business. (Only orders type delivery and is a kind of pause)
Pickup completed by customer15This status is used to show that the order has been picked up from the business by driver. (Only orders type pick up)
canceled by customer16This status is placed when the order was canceled by customer for some reason.
Not picked by customer17This status is placed when the order could not be picked up by customer on the business for some reason. (Only orders type pickup)
Driver almost arrived to business18This status is placed when the driver is near to business with delivery type. can be update automatically with settings (distance and enable)
Driver almost arrived to customer19This status is placed when the driver is near to customer with delivery type. can be update automatically with settings (distance and enable)
customer almost arrived to business20This status is placed when the customer is near to business with pickup type. can be update automatically with settings (distance and enable)
customer arrived to business21This status is placed when the customer is in business to pick up the order.
looking for driver22This status can be set manually to identify that the orders logistic is in process.
driver on way23When the driver leaves the business status ( 3 or 9 ) and if the settings (order_update_location_business and order_update_location_business_distance) are enabled the order status will autmatically change to status '23' driver on way
Driver waiting for order24This status is used to show that the driver is in the business waiting for the order. (Only orders type delivery)
Accepted by driver company25This status is used to show that the order has been accepted by driver company. (Only orders type delivery)

Delivery types

The param delivery_type shows if the order is for pick up or for delivery, and the two possible values are listed bellow:

Type nameType valueDecription
1DeliveryThis value is used when the order is a delivery type.
2Pick UpThis value is used when the order is a pick up type.
3Eat InThis value is used when the order is a Eat in type.
4CurbsideThis value is used when the order is a Curbside type.
5Driver thruThis value is used when the order is a Driver thru type.

Order ingredients (No ingredients)

Ordering API Team found that listing all the ingredients of a product in an order was cumbersome, so the team found a simple solution that eases the way it looks in an order ticket by forwarding the request to remove ingredients by naming them "No Ingredients". To explain yourself better we have the following example:

Imagine that there is a customer who wants a hamburger, he does not want onions and he does not want ketchup, so the API Should return all the other ingredient that customer wants and in a front end will be like this:

  • Meat
  • Tomato
  • Lettuce
  • Mayonnaise
  • Pickles
  • Cheese
  • Mustard
  • Bacon

This way you can see how "Overcharge" it would be to read an order when there are several products. so it was decided to do the following Instead of what was previously seen:

  • No onion
  • No Ketchup

This simplifies how orders are viewed at the time of preparation.