Order API

The gRPC service behind /api/orders/*. It owns the order lifecycle from creation to delivery.

Methods

Method Purpose
CreateOrder Validate and store a new order; publishes order.created
GetOrder Fetch an order by ID
UpdateOrderStatus Move an order to paid, shipped or delivered; publishes the matching event
CancelOrder Cancel an order that has not shipped
ListUserOrders A user's order history

Collaborators

  • Order DB: every order and each status change is written here first.
  • User API: called during CreateOrder to confirm that the ordering user exists.
  • Notifier: called directly for messages that must go out at once, such as a payment failure. Routine milestone messages go through events instead.
  • Event bus: publishes order.created, order.paid, order.shipped and order.delivered, and consumes user.deleted to anonymize that user's orders.

Status model

created → paid → shipped → delivered
   └──────→ cancelled (only before shipped)

Deployment

Go, 3 replicas on the services node in prod.

Edit ./docs/containers/order_api.md to change this text.