Calculate
DevelopingPOST
/orders/calcConstant
Use the constants below according to the field names and rules for each request
Constant | Value |
---|---|
source |
ADMIN_APP ADMIN_WEB LANDING_APP LANDING_WEB GRUBTECH |
type |
TAKE_AWAY DINING DRIVE_THROUGH DELIVERY |
status |
WAITING PROCESS COMPLETED CANCELED DELIVERY |
Validation
Field | Type | Rule | Description |
---|---|---|---|
market_id |
string |
required |
Id from Market model |
branch_id |
string |
required |
Id from Branch model |
source |
string |
nullable |
From source constant above |
type |
string |
nullable |
From type constant above |
status |
string |
nullable |
From status constant above |
notes |
string |
nullable |
|
payment_method_key |
string |
nullable |
Key from PaymentMethod model |
discount_id |
string |
nullable |
Id from Discount model |
table_id |
integer |
nullable |
Id from Table model |
customer_id |
string |
nullable |
Id from Customer model |
cashier_id |
string |
nullable |
Id from Cashier model |
products |
array |
nullable |
|
products.*.product_id |
string |
required |
Id from Product model |
products.*.qty |
integer |
required min:0 |
|
products.*.modifiers |
array |
required |
|
products.*.modifiers.*.product_modifier_id |
integer |
required |
Id from ProductModifier model |
products.*.modifiers.*.weight |
numeric |
nullable min:0 |
Field payment_method_key
used to estimate prices based on payment method, some clients make additional prices for certain payment methods (only applies to one payment method)
Request
Body Params application/json
market_id
string
required
branch_id
string
required
source
string
optional
type
string
optional
status
string
optional
notes
string
optional
payment_method_key
string
optional
discount_id
string
optional
table_id
integer
optional
customer_id
string
optional
cashier_id
string
optional
products
array [object {3}]
optional
product_id
string
required
qty
integer
required
modifiers
array [object {2}]
required
Example
{
"market_id": "be7407f3-8d36-4a01-a20f-f306f044f496",
"branch_id": "de1a6526-34de-4d1f-87e3-831e1af19853",
"cashier_id": "0756d11b-4a6e-4739-adf7-899e58de0885",
"products": [
{
"product_id": "8447de4e-740e-4181-a377-6dfa3f4d3aa2",
"qty": 2,
"modifiers": [
{
"product_modifier_id": 5626
}
]
},
{
"product_id": "cfcdf305-4cfe-495c-9a33-c8dfc7a6b8c5",
"qty": 1,
"modifiers": [
{
"product_modifier_id": 5567,
"weight": 2
}
]
}
],
"customer_id": null,
"payment_method_key": null,
"type": "TAKE_AWAY",
"notes": null,
"table_id": null,
"source": "ADMIN_WEB",
"discount_id": null,
"status": "WAITING"
}
Request samples
Responses
OK(200)
HTTP Code: 200
Content Type : JSONapplication/json
Data Schema
meta
object
required
code
integer
required
status
string
required
message
string
required
data
object
required
id
string
required
market_id
string
required
branch_id
string
required
number
string
required
source
string
required
type
string
required
status
string
required
table_code
null
required
notes
null
required
customer_id
null
required
cashier_id
string
required
created_at
integer
required
updated_at
integer
required
deleted_at
null
required
is_product_changed
boolean
required
table_id
null
required
qr_img
string
required
market
object
required
customer
null
required
cashier
object
required
table
null
required
status_logs
array [object {4}]
required
transaction
object
required
products
array [object {21}]
required
return_products
array[string]
required
changed_products
array[string]
required
product_discount_fees
array[string]
required
product_tax_fees
array [object {14}]
required
Example
{
"meta": {
"code": 200,
"status": "success",
"message": "Calculate Success"
},
"data": {
"id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"number": "0001",
"source": "ADMIN_WEB",
"type": "TAKE_AWAY",
"status": "WAITING",
"table_code": null,
"notes": null,
"customer_id": null,
"cashier_id": "0756d11b-4a6e-4739-adf7-899e58de0885",
"created_at": 1698584746741,
"updated_at": 1698584746741,
"deleted_at": null,
"is_product_changed": false,
"table_id": null,
"qr_img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAIAAACx0UUtAAAABnRSTlMA/wD/AP83WBt9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFeElEQVR4nO3dy27kOBBFwfGg//+XPZtZacEGwYdO2RHbsiiVcUFUgmTq6/v7+x8I+/ftB4C/kFHqZJQ6GaVORqmTUepklDoZpU5GqZNR6mSUOhmlTkapk1HqZJQ6GaVORqmTUepklLo/Kxd/fX3teo6xx6Grx31XPp260ZSNQ2280bWnGt93inmUOhml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p2MUiej1N3rNf7w1uLQuZ7f4xtNDfVW+4xzn64wj1Ino9TJKHUySt2980xjb50cGj/GtRJq6jHOLVmd6xZvbx4/mYxSJ6PUySh1S+tMKz+Ezx2dWRnqYVxDTFUJ197AtKL5VOZR6mSUOhmlTkapu/d+pmvXjoe69kKmc20sxjea2vU3NfLKfVeYR6mTUepklDoZpe7g+5k2OvdS13MvkTpnY/+6a60o7M3jJ5NR6mSUOhmlbuc600dsEmsu/0xde66b38q1ekDwe8kodTJKnYxSd3BvXmSRZuMGs2uvL9rYbWHqDNaUazv3zKPUySh1MkqdjFJ3sGY659x+s3O7Dc8tw2ys88bXvvVOKfModTJKnYxSJ6PUfWTNNPZWy/OpkVeujbyGWA8I+J+MUiej1MkoddG+eRuda3KxsoK1sXv61FNd64C+kXmUOhmlTkapk1HqdtZMkV/cG3fubTzANHZux+C5rnrjoaYeY8w8Sp2MUiej1MkodUu9xuEC8yh1MkqdjFIno9TJKHUySp2MUiej1MkodTJKnYxSJ6PUySh1MkqdjFIno9TJKHUySp2MUvcfuPK4z9eT1lgAAAAASUVORK5CYII=",
"market": {
"id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"sector_id": 1,
"name_en": "First Restaurant",
"name_ar": "First Restaurant",
"description_en": "Ut maxime commodi natus id tenetur ullam. Repudiandae aut quia est perspiciatis facilis dolores repellendus ea eum. Iusto occaecati libero ea voluptas dolore qui qui maxime quod. Eum ut vel possimus sunt doloribus saepe repellendus et.",
"description_ar": "العظمى إستيلاء الأوروبية، حين عل. هو وبعد قتيل، العالمي ولم, يونيو مساعدة التاريخ، وصل تم. بـ سكان الجو اليابان تحت, يتم لأداء تكتيكاً قُدُماً ان. نفس موالية الجنوبي ما, أضف تم غضون أسابيع وقوعها،. وبدون ميناء الأمريكية فقد عل, قتيل، معارضة ضرب عن, دول وبعض لفرنسا تزامناً ثم. أي أدوات استبدال جعل. يكن لغات مشروط من.",
"logo_img": null,
"cover_img": null,
"email": "[email protected]",
"phone_prefix": "966",
"phone": "579112767",
"crn": null,
"tax_number": "12345611",
"created_by": null,
"email_verified_at": null,
"phone_verified_at": null,
"created_at": 1680271006362,
"updated_at": 1683019078189,
"deleted_at": null
},
"customer": null,
"cashier": {
"id": "0756d11b-4a6e-4739-adf7-899e58de0885",
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": null,
"permission_id": 2,
"user": {
"id": "f64b8da0-429b-4377-9a03-19724f43465b",
"userable_id": "0756d11b-4a6e-4739-adf7-899e58de0885",
"role": "SUBSCRIBER",
"name": "Subscriber 1",
"username": "subscriber1",
"email": "[email protected]",
"phone_prefix": "966",
"phone": null,
"lang": "en",
"fcm_token": null,
"is_active": true,
"email_verified_at": null,
"phone_verified_at": null,
"created_at": 1680271006727,
"updated_at": 1684892194280,
"deleted_at": null
}
},
"table": null,
"status_logs": [
{
"id": 144,
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"status": "WAITING",
"created_at": 1698584746828
}
],
"transaction": {
"id": 18000043778,
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"discount": 0,
"tax": 3.3,
"subtotal": 22,
"total": 25.3,
"cost": 9,
"profit": 2,
"created_at": 1698584746759,
"updated_at": 1698584746759,
"status": "UNPAID",
"discount_id": null,
"payment_fees": 0,
"related_discount": null,
"payments": [],
"return_payments": []
},
"products": [
{
"id": 9000044904,
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"product_category_id": 2,
"product_id": "8447de4e-740e-4181-a377-6dfa3f4d3aa2",
"qty": 2,
"price": 5.5,
"discount": 0,
"tax": 1.65,
"subtotal": 11,
"total": 12.65,
"cost": 4.5,
"profit": 1,
"is_done": false,
"created_at": 1698584746767,
"updated_at": 1698584746767,
"status": "RELATED",
"product": {
"id": "8447de4e-740e-4181-a377-6dfa3f4d3aa2",
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"product_category_id": 2,
"name_en": "Burger Deluxe",
"name_ar": "برجر ديلوكس",
"description_en": "Tempore recusandae vel atque voluptatibus ea et nihil. Veniam eveniet laudantium cupiditate ratione non. Asperiores rem maiores neque inventore possimus itaque eum rerum. Delectus accusantium sit facilis. Ea voluptatibus natus quas eius commodi enim enim.",
"description_ar": "Tempore recusandae vel atque voluptatibus ea et nihil. Veniam eveniet laudantium cupiditate ratione non. Asperiores rem maiores neque inventore possimus itaque eum rerum. Delectus accusantium sit facilis. Ea voluptatibus natus quas eius commodi enim enim.",
"preparation_time": 15,
"stock": 768,
"order": 2,
"images": [
"https://cdn-flavours.fra1.digitaloceanspaces.com/img/uploads/products/1680365973-0.jpg"
],
"is_active": true,
"created_at": 1680271006454,
"updated_at": 1684589809294,
"deleted_at": null,
"rating_amount": 0,
"rating_avg": "0.00",
"sold_amount": 64,
"sold_revenue": 64.5,
"qoyod_id": null
},
"modifiers": [
{
"id": 2755,
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"order_product_id": 9000044904,
"product_modifier_id": 5626,
"weight": null,
"price": 5.5,
"discount": 0,
"tax": 1.65,
"total": 6.33,
"cost": 4.5,
"profit": 1,
"modifier": {
"id": 5626,
"product_id": "8447de4e-740e-4181-a377-6dfa3f4d3aa2",
"name_en": "Small",
"name_ar": "صغير",
"type": "OPTION",
"calorie": 300,
"price": 5.5,
"tax": 0.83,
"total": 6.33,
"cost": 4.5,
"profit": 1,
"is_tax_included": false,
"deleted_at": null,
"barcode": null,
"barcode_img": null,
"weight_amount": null,
"weight_unit": null
}
}
],
"tax_fees": [
{
"id": 30324,
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"order_product_id": 9000044904,
"feeable_id": "cc49a82a-ea28-4541-b4e6-8131457607a1",
"feeable_type": "TAX",
"qty": 2,
"amount": 0.83,
"total": 1.65,
"created_at": 1698584746785,
"updated_at": 1698584746785,
"order_product_modifier_id": null
}
]
},
{
"id": 9000044905,
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"product_category_id": 3,
"product_id": "cfcdf305-4cfe-495c-9a33-c8dfc7a6b8c5",
"qty": 1,
"price": 11,
"discount": 0,
"tax": 1.65,
"subtotal": 11,
"total": 12.65,
"cost": 4.5,
"profit": 1,
"is_done": false,
"created_at": 1698584746767,
"updated_at": 1698584746767,
"status": "RELATED",
"product": {
"id": "cfcdf305-4cfe-495c-9a33-c8dfc7a6b8c5",
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"product_category_id": 3,
"name_en": "Twister Lunch Edited",
"name_ar": "Twister Lunch",
"description_en": "Tempore recusandae vel atque voluptatibus ea et nihil. Veniam eveniet laudantium cupiditate ratione non. Asperiores rem maiores neque inventore possimus itaque eum rerum. Delectus accusantium sit facilis. Ea voluptatibus natus quas eius commodi enim enim.",
"description_ar": "Tempore recusandae vel atque voluptatibus ea et nihil. Veniam eveniet laudantium cupiditate ratione non. Asperiores rem maiores neque inventore possimus itaque eum rerum. Delectus accusantium sit facilis. Ea voluptatibus natus quas eius commodi enim enim.",
"preparation_time": 20,
"stock": 819,
"order": 1,
"images": [
"https://cdn-flavours.fra1.digitaloceanspaces.com/img/uploads/products/1680366096-0.jpg"
],
"is_active": true,
"created_at": 1680271006458,
"updated_at": 1684246940577,
"deleted_at": null,
"rating_amount": 0,
"rating_avg": "0.00",
"sold_amount": 31,
"sold_revenue": 39.09,
"qoyod_id": null
},
"modifiers": [
{
"id": 2756,
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"order_product_id": 9000044905,
"product_modifier_id": 5567,
"weight": "2.00",
"price": 11,
"discount": 0,
"tax": 1.65,
"total": 12.65,
"cost": 4.5,
"profit": 1,
"modifier": {
"id": 5567,
"product_id": "cfcdf305-4cfe-495c-9a33-c8dfc7a6b8c5",
"name_en": "Small",
"name_ar": "Small",
"type": "OPTION",
"calorie": 300,
"price": 5.5,
"tax": 0.83,
"total": 6.33,
"cost": 4.5,
"profit": 1,
"is_tax_included": false,
"deleted_at": null,
"barcode": null,
"barcode_img": null,
"weight_amount": "1.00",
"weight_unit": "Kg"
}
}
],
"tax_fees": [
{
"id": 30325,
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"order_product_id": 9000044905,
"feeable_id": "cc49a82a-ea28-4541-b4e6-8131457607a1",
"feeable_type": "TAX",
"qty": 1,
"amount": 1.65,
"total": 1.65,
"created_at": 1698584746785,
"updated_at": 1698584746785,
"order_product_modifier_id": null
}
]
}
],
"return_products": [],
"changed_products": [],
"product_discount_fees": [],
"product_tax_fees": [
{
"id": 30324,
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"order_product_id": 9000044904,
"feeable_id": "cc49a82a-ea28-4541-b4e6-8131457607a1",
"feeable_type": "TAX",
"qty": 2,
"amount": 0.83,
"total": 1.65,
"created_at": 1698584746785,
"updated_at": 1698584746785,
"order_product_modifier_id": null,
"feeable": {
"id": "cc49a82a-ea28-4541-b4e6-8131457607a1",
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": null,
"name_en": "Tax",
"name_ar": "ضريبة",
"value": 15,
"value_type": "PERCENT",
"is_active": true,
"created_at": 2023,
"updated_at": 2023,
"deleted_at": null,
"is_calculate": true
}
},
{
"id": 30325,
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": "02510007-93b6-4121-93d7-c1bd79d00d0c",
"order_id": "4307cb35-c8c7-4b72-ad43-a294ddb8dfae",
"order_product_id": 9000044905,
"feeable_id": "cc49a82a-ea28-4541-b4e6-8131457607a1",
"feeable_type": "TAX",
"qty": 1,
"amount": 1.65,
"total": 1.65,
"created_at": 1698584746785,
"updated_at": 1698584746785,
"order_product_modifier_id": null,
"feeable": {
"id": "cc49a82a-ea28-4541-b4e6-8131457607a1",
"market_id": "5d4196d7-355a-48ef-9c50-add58cc440f1",
"branch_id": null,
"name_en": "Tax",
"name_ar": "ضريبة",
"value": 15,
"value_type": "PERCENT",
"is_active": true,
"created_at": 2023,
"updated_at": 2023,
"deleted_at": null,
"is_calculate": true
}
}
]
}
}
Last modified: 2 months ago