The order controller needs to take coffee orders from multiple delivery apps and send those orders to the coffee robot. Note that all of these APIs need to know the menu.
Preferably, an API will be written as the controller that will have simple REST for:
- Getting an Order
- Getting steps to make the order
- Finalizing the order
Simple code example:
coffeeBot.receiveOrder()
coffeeBot.startOrder()
coffeeBot.finishOrder()
Additionally, the receiveOrder
method should include options for multiple delivery services
const receiveOrder = (order) => {
if order.source = `uber` {
return { order: uberOrderObj }
}
if order.source = `doorDash` {
return { order: ddOrderObj }
}
return order
}
For each API, you will need an access key and/or a JWT.
Note that all GET requests for Orders need to happen only after order has been accepted
Uber API - GET Developers
https://api.uber.com/v2/eats/order/{order_id}
Response needed
{
"cart": {
"items": [
{
"id",
"instance_id",
"title",
"external_data",
"special_instructions",
"quantity"
},
"taxInfo": {
"labels": [
"TEMP",
"CAT_COFFEE"
]
},
{
"selected_modifier_groups": [
"id",
"title",
"external_data",
"selected_items"
]
}
]
}
}
Door Dash API