Orders Model

Action

Method

Resource

Description

Get all

GET

/orders

Get all orders.

Get

GET

/orders/:order_id

Get order with id order_id.

Create

POST

/orders

Create an order.

Update

PUT

/orders/:order_id

Update order with order_id.

Delete

DELETE

/orders/:order_id

Delete order with order_id.

The order model is composed of the following attributes:

Attribute

Type

Required

Description

Whereable

paymethod_id

integer

no, required to create

The order's paymethod. (Paymethod ID).

Yes

business_id

integer

no, required to create

The order's business. (Business ID).

Yes

customer_id

integer

no

The order's customer. (Customer ID).

Yes

delivery_type

integer

no, required to create

The order's delivery type.
1 for delivery.
2 for pickup.

Yes

delivery_datetime

date

no, required to create

The order's delivery date time.

No

status

integer

only to update

The order's status.

Yes

comment

string

no

The order's comment.

Yes

driver_id

integer

only to update

The order's driver. (User ID)

Yes

driver_tip

float

no

The order's driver tip.

Yes

pay_data

string

no

The order's pay data.

No

delivery_zone_id

integer

no

The order's delivery zone. (Delivery Zone ID).

Yes

offer_id

integer

no

The order's offer. (Offer ID).

Yes

location

json

no, required to create

The user's location.

No

cash

string

no

User cash amount payment, should be higher than order total and whithout decimals

products

json

no, required to create

The order's products. must be send in the specific structure as shown in Special Data type

No

customer

json

no

The order's customer if guest. must be send in the specific structure as shown in Special Data type

No

app_id

string

no

It 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:

Status

Value

Description

Pending

0

This status is set by default when an order is created.

Completed

1

This status is used to show that the order has been completed.

Rejected

2

This status is used to show that the order has been canceled.

Driver in business

3

This status is used to show that the driver arrived to the business and is waiting for the order to be ready.

Preparation Completed

4

This status is used to show that the order is ready for pickup.

Rejected by business

5

This status is used to show that the order has been Rejected by business.

Canceled by Driver

6

This status is used to show that the order has been Canceled by driver. (Only orders type delivery)

Accepted by business

7

This status is used to show that the order has been accepted by business.

Accepted by driver

8

This status is used to show that the order has been accepted by driver. (Only orders type delivery)

Pick up completed by driver

9

This 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 driver

10

This status is placed when the order could not be picked up on the business for some reason. (Only orders type delivery)

Delivery completed by driver

11

This 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 driver

12

This status is placed when the order could not be delivered to the customer for any reason. (Only orders type delivery)

Preorder

'13'

This 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 ready

'14'

This 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 customer

'15'

This status is used to show that the order has been picked up from the business by driver. (Only orders type pick up)

canceled by customer

'16'

This status is placed when the order was canceled by customer for some reason.

Not picked by customer

'17'

This 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 business

'18'

This 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 customer

'19'

This 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 business

'20'

This 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 business

'21'

This status is placed when the customer is in business to pick up the order.

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 name

Type value

Decription

1

Delivery

This value is used when the order is a delivery type.

2

Pick Up

This value is used when the order is a pick up type.

3

Eat In

This value is used when the order is a Eat in type.

4

Curbside

This value is used when the order is a Curbside type.

5

Driver thru

This 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.