This section documents the takeaway order endpoints of the MiseOS API.
Customers place orders against active takeaway offers. An order can contain multiple lines — one per dish. Portions are reserved immediately when an order is placed.
Management can mark orders as paid and view a daily sales summary. Customers can cancel their own orders within the 45-minute cancellation window.
Order lifecycle#
stateDiagram-v2
[*] --> RESERVED : order placed
RESERVED --> PAID : marked as paid by management
RESERVED --> CANCELLED : cancelled by customer (within 45 min) or management
PAID --> [*]
CANCELLED --> [*] : portions returned to offer
When an order is cancelled, all reserved portions are returned to the offer. Paid orders cannot be cancelled.
Takeaway Order Endpoints#
| Method | URL | Auth |
|---|---|---|
GET | /takeaway/orders | CUSTOMER, KITCHEN_STAFF |
GET | /takeaway/orders/{id} | CUSTOMER, KITCHEN_STAFF |
POST | /takeaway/orders | CUSTOMER |
PATCH | /takeaway/orders/{id}/pay | HEAD_CHEF, SOUS_CHEF |
PATCH | /takeaway/orders/{id}/cancel | CUSTOMER, HEAD_CHEF, SOUS_CHEF |
GET | /takeaway/orders/summary | HEAD_CHEF, SOUS_CHEF |
Role-based filtering (
GET /takeaway/orders)
- Customers only see their own orders
- Head chefs and sous chefs can filter by
customerIdto see any customer’s orders
TakeAwayOrder response object#
The take away order object contains the following fields:
{
"id": 1,
"totalOrderLines": 2,
"totalQuantity": 3,
"customer": {
"id": 5,
"firstName": "Hans",
"lastName": "Hansen"
},
"orderLines": [
{
"id": 1,
"offer": {
"id": 1,
"dishName": "Boller i karry",
"price": 65.00
},
"quantity": 2,
"lineTotal": 130.00
},
{
"id": 2,
"offer": {
"id": 3,
"dishName": "Surdejsbrød",
"price": 35.00
},
"quantity": 1,
"lineTotal": 35.00
}
],
"totalOrderPrice": 165.00,
"orderStatus": "RESERVED",
"orderedAt": "2026-04-09 13:05",
"createdAt": "2026-04-09"
}Status values: RESERVED | PAID | CANCELLED
TakeAwaySummary response object#
Returned by GET /takeaway/orders/summary.
{
"date": "2026-04-09",
"totalOfferedPortions": 55,
"totalSoldPortions": 32,
"totalRemainingPortions": 23,
"totalOrders": 18,
"summaryPerOffer": [
{
"offerId": 1,
"dish": {
"id": 3,
"nameDA": "Boller i karry"
},
"offeredPortions": 20,
"soldPortions": 14,
"remainingPortions": 6,
"revenue": 910.00
},
{
"offerId": 2,
"dish": {
"id": 7,
"nameDA": "Stegt flæsk"
},
"offeredPortions": 35,
"soldPortions": 18,
"remainingPortions": 17,
"revenue": 1170.00
}
]
}GET /takeaway/orders#
Returns orders with optional filters. Customers only see their own orders. Management can filter by customer.
Query parameters
| Parameter | Type | Description |
|---|---|---|
customerId | Long | Filter by customer — management only |
offerId | Long | Filter by offer |
date | LocalDate | Filter by order date (yyyy-MM-dd) |
status | String | Filter by status: RESERVED, PAID, CANCELLED |
Example Request#
curl -H "Authorization: Bearer <token>" \
"https://miseos.corral.dk/api/v1/takeaway/orders?date=2026-04-09&status=RESERVED"Response 200 — array of TakeAwayOrder objects.
GET /takeaway/orders/{id}#
Returns a single order by ID.
Customers can only view their own orders. Management can view any order.
Example Request#
curl -H "Authorization: Bearer <token>" \
https://miseos.corral.dk/api/v1/takeaway/orders/1Response 200 — TakeAwayOrder object.
Errors
| Status | Cause |
|---|---|
400 | Invalid ID |
403 | Attempting to view another customer’s order |
404 | Order not found |
POST /takeaway/orders#
Places a new order. An order can contain multiple lines — one per offer. Portions are reduced from the offer immediately.
Request body
{
"takeAwayOrderLines": [
{
"offerId": 1,
"quantity": 2
},
{
"offerId": 3,
"quantity": 1
}
]
}Example Request#
curl -X POST \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"takeAwayOrderLines": [
{ "offerId": 1, "quantity": 2 },
{ "offerId": 3, "quantity": 1 }
]
}' \
https://miseos.corral.dk/api/v1/takeaway/ordersResponse 201 — created TakeAwayOrder object with status RESERVED.
Errors
| Status | Cause |
|---|---|
400 | Empty order lines or invalid quantity |
404 | Offer not found |
409 | Offer is disabled or sold out |
409 | Not enough portions remaining |
PATCH /takeaway/orders/{id}/pay#
Marks an order as paid. Only head chefs and sous chefs can perform this action.
Cannot mark a cancelled order as paid.
Example Request#
curl -X PATCH \
-H "Authorization: Bearer <token>" \
https://miseos.corral.dk/api/v1/takeaway/orders/1/payResponse 200 — updated TakeAwayOrder object with status PAID.
Errors
| Status | Cause |
|---|---|
403 | Caller is not head chef or sous chef |
404 | Order not found |
409 | Order is already cancelled |
PATCH /takeaway/orders/{id}/cancel#
Cancels an order and returns portions to the offer.
- Customers can only cancel within 45 minutes of placing the order
- Head chefs and sous chefs can cancel any time before payment
- Paid orders cannot be cancelled
Example Request#
curl -X PATCH \
-H "Authorization: Bearer <token>" \
https://miseos.corral.dk/api/v1/takeaway/orders/1/cancelResponse 200 — updated TakeAwayOrder object with status CANCELLED.
Errors
| Status | Cause |
|---|---|
403 | Customer attempting to cancel another customer’s order |
403 | Cancellation window (45 min) has expired |
404 | Order not found |
409 | Order is already paid and cannot be cancelled |
GET /takeaway/orders/summary#
Returns a sales summary for a given date. Defaults to today if no date is provided.
Query parameters
| Parameter | Type | Description |
|---|---|---|
date | LocalDate | Summary date (yyyy-MM-dd) — defaults to today |
Example Request#
curl -H "Authorization: Bearer <token>" \
"https://miseos.corral.dk/api/v1/takeaway/orders/summary?date=2026-04-09"Response 200 — TakeAwaySummary object.