Package-level declarations

Types

Link copied to clipboard
@Summary(value = "Add an item to the basket")
data class AddBasketItem(val productId: String, val unitPrice: BigDecimal, val quantity: Int)

Adds quantity of productId at unitPrice to the basket, creating the basket on its first item. Adding a product already in the basket adds to its quantity, at the new price. The constraints are the command's shape: the gateway checks them before the basket decides, and answers a violation wow.command.invalid (400).

Link copied to clipboard
@Summary(value = "The basket was checked out")
data class BasketCheckedOut(val items: List<BasketItem>)

The basket was checked out: its items go to the ordering context as an order, whose number the ordering gives; it is empty again.

Link copied to clipboard
@Summary(value = "The basket was cleared")
data object BasketCleared
Link copied to clipboard
data class BasketItem(val productId: String, val unitPrice: BigDecimal, val quantity: Int)

A line of a basket: quantity units of productId at unitPrice each.

Link copied to clipboard
@Summary(value = "An item was added to the basket")
data class BasketItemAdded(val productId: String, val unitPrice: BigDecimal, val quantity: Int)

quantity of productId was added to the basket, at unitPrice.

Link copied to clipboard
@Summary(value = "An item's quantity changed")
data class BasketItemQuantityChanged(val productId: String, val quantity: Int)
Link copied to clipboard
@Summary(value = "An item was removed from the basket")
data class BasketItemRemoved(val productId: String)
Link copied to clipboard
@Summary(value = "Change an item's quantity")
data class ChangeBasketItemQuantity(val productId: String, val quantity: Int)

Changes the quantity of productId in the basket to quantity.

Link copied to clipboard
@Summary(value = "Check the basket out")
data object CheckoutBasket

Checks the basket out: its items become an order in the ordering context, and the basket is emptied. The ordering numbers the order (SO-261031-42): a checkout that waits for the order's commit in the ordering context (committed(eshop-ordering), a hop of the checkout's chain) is answered its number as that hop's aggregate id.

Link copied to clipboard
@Summary(value = "Clear the basket")
data object ClearBasket

Empties the basket.

Link copied to clipboard
@Summary(value = "Remove an item from the basket")
data class RemoveBasketItem(val productId: String)

Removes productId from the basket.