Skip to main content

Takeaway Orders

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
#

MethodURLAuth
GET/takeaway/ordersCUSTOMER, KITCHEN_STAFF
GET/takeaway/orders/{id}CUSTOMER, KITCHEN_STAFF
POST/takeaway/ordersCUSTOMER
PATCH/takeaway/orders/{id}/payHEAD_CHEF, SOUS_CHEF
PATCH/takeaway/orders/{id}/cancelCUSTOMER, HEAD_CHEF, SOUS_CHEF
GET/takeaway/orders/summaryHEAD_CHEF, SOUS_CHEF

Role-based filtering (GET /takeaway/orders)

  • Customers only see their own orders
  • Head chefs and sous chefs can filter by customerId to 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

ParameterTypeDescription
customerIdLongFilter by customer — management only
offerIdLongFilter by offer
dateLocalDateFilter by order date (yyyy-MM-dd)
statusStringFilter 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/1

Response 200TakeAwayOrder object.

Errors

StatusCause
400Invalid ID
403Attempting to view another customer’s order
404Order 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/orders

Response 201 — created TakeAwayOrder object with status RESERVED.

Errors

StatusCause
400Empty order lines or invalid quantity
404Offer not found
409Offer is disabled or sold out
409Not 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/pay

Response 200 — updated TakeAwayOrder object with status PAID.

Errors

StatusCause
403Caller is not head chef or sous chef
404Order not found
409Order 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/cancel

Response 200 — updated TakeAwayOrder object with status CANCELLED.

Errors

StatusCause
403Customer attempting to cancel another customer’s order
403Cancellation window (45 min) has expired
404Order not found
409Order 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

ParameterTypeDescription
dateLocalDateSummary 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 200TakeAwaySummary object.