Package-level declarations

Types

Link copied to clipboard
@Summary(value = "Await the stock validation")
data object AwaitStockValidation

Moves a submitted order on to the stock validation; the order-process saga sends it.

Link copied to clipboard
@Summary(value = "Cancel the order")
data class CancelOrder(val reason: String)

Cancels an order that is not paid yet, for reason. The order-process saga sends it when the inventory cannot reserve a product, the payment context when its gateway declines the order's payment, and the order schedules it for itself when it is not paid within the payment grace period.

Link copied to clipboard
@Summary(value = "Confirm a product's stock")
data class ConfirmOrderStock(val productId: String)

Confirms that the inventory reserved the order's units of productId. The stock-confirmation saga sends it for each reservation it reads from the inventory's stock stream; once every product is confirmed, the order awaits its payment.

Link copied to clipboard
@Summary(value = "The order awaits its stock validation")
data object OrderAwaitingValidation
Link copied to clipboard
@Summary(value = "The order was cancelled")
data class OrderCancelled(val reason: String)
Link copied to clipboard
data class OrderItem(val productId: String, val unitPrice: BigDecimal, val quantity: Int)

A line of an order: quantity units of productId at unitPrice each.

Link copied to clipboard
@Summary(value = "The order was paid")
data class OrderPaid(val paymentId: String, val amount: BigDecimal)
Link copied to clipboard
@Summary(value = "The order was shipped")
data object OrderShipped
Link copied to clipboard

The life of an order, after the classic eShop's: submitted, awaiting the stock validation, its stock confirmed (it then awaits its payment), paid and shipped; or cancelled before it is paid.

Link copied to clipboard
@Summary(value = "The inventory reserved every product of the order; it awaits its payment")
data object OrderStockConfirmed
Link copied to clipboard
@Summary(value = "The inventory reserved one of the order's products")
data class OrderStockItemConfirmed(val productId: String)
Link copied to clipboard
@Summary(value = "An order was submitted")
data class OrderSubmitted(val items: List<OrderItem>)
Link copied to clipboard
@Summary(value = "Pay the order")
data class PayOrder(val paymentId: String, val amount: BigDecimal)

Pays amount of the order with the payment paymentId. The payment context sends it once its gateway approves the order's payment; a client may send it too.

Link copied to clipboard
@Summary(value = "Ship the order")
data object ShipOrder

Ships a paid order.

Link copied to clipboard
@Summary(value = "Submit an order")
data class SubmitOrder(val items: List<OrderItem>)

Submits an order of items. The basket context sends it when its buyer checks out, with the order's id fixed by the basket. The order belongs to the buyer: a saga's command carries the scope of the basket it is derived from, whose owner is its buyer, and the order takes its owner from the command that creates it. An order has items, each valid (OrderItem's constraints): the gateway checks that before the order decides.