Digital storefront · Core domain · EventStorming board
pricing
Owns what a shopper pays: list prices and sales per item, delivery charges, a tax table, and the binding price quote a checkout is built on.
- events published
- 5
- commands
- 12
- policies
- 20
- read models
- 4
- hot spots
- 3
The story in 5 key events
The pivotal events: the few that matter most, in the order they happen.
- Pivotal eventItem
Price Changed - Pivotal eventItem
Price Withdrawn - Pivotal eventDelivery
Charge Schedule Changed - Pivotal eventTax
Table Changed - Pivotal eventPrice
Quote Issued
Listens to (1): contexts whose events this one reacts to
Tells (2): contexts that react to its events
The board, row by row
12 rows, in the order the business story happens: the main path first, then how this context reacts to the others, then the clock. Rows are small stories; read each one left to right.
- Event
- Command
- Actor
- Aggregate
- Policy
- Read model
- External system
- Hot spot
- Opportunity
-
Price a new item
A merchandiser sets the first list price of a catalogue item. The item must already be known and not discontinued, and the amount must be in the one configured currency.
ActorMerchandiserRead modelKnown catalogue itemsCommandCreateItem POST /item-pricesPrice AggregateItemPrice EventItemPrice Changed Systemproduct-discovery PolicyShows the price on the product page and marks the item purchasableSystemshopping-cart PolicyKeeps the item's current price for its cart estimateSource: application/usecases/itemprice.go · domain/itemprice/itemprice.go
-
Change a list price
A merchandiser changes the standing price of an item. A price change is announced only if what shoppers see really moved, and a sale price must stay below the new list price.
ActorMerchandiserRead modelKnown catalogue itemsCommandSetList PUT /item-prices/{catalogItemId}/list-pricePrice AggregateItemPrice EventItemPrice Changed Systemproduct-discovery PolicyUpdates the price on the product pageSystemshopping-cart PolicyUpdates the item's current price for its cart estimateSource: application/usecases/itemprice.go · domain/itemprice/itemprice.go
-
Schedule a sale
A merchandiser plans a sale window with a price below the list price. Windows of one item never overlap. If the window is already open the new price is announced now, otherwise later.
ActorMerchandiserRead modelKnown catalogue itemsCommandScheduleSale POST /item-prices/{catalogItemId}/salesAggregateItemPrice EventItemPrice Changed Systemproduct-discovery PolicyUpdates the price on the product pageSystemshopping-cart PolicyUpdates the item's current price for its cart estimateSource: application/usecases/itemprice.go · domain/itemprice/itemprice.go
-
Cancel a sale
A merchandiser cancels a planned or running sale. Cancelling the running sale puts the price back to the list price and announces it; cancelling a future one announces nothing.
ActorMerchandiserCommandCancelSale POST /item-prices/{catalogItemId}/sales/{saleId}/cancellationsAggregateItemPrice EventItemPrice Changed Systemproduct-discovery PolicyPuts the list price back on the product pageSystemshopping-cart PolicyPuts the list price back in its cart estimateSource: application/usecases/itemprice.go · domain/itemprice/itemprice.go
-
Withdraw a price
A merchandiser takes an item's price off. A withdrawn price is final: it cannot be changed, scheduled or quoted again, and the item stops being purchasable.
ActorMerchandiserCommandWithdrawPrice POST /item-prices/{catalogItemId}/withdrawalsAggregateItemPrice EventItemPrice Withdrawn Systemproduct-discovery PolicyMarks the item as no longer purchasableSystemshopping-cart PolicyClears the item's price, so it is no longer purchasableSource: application/usecases/itemprice.go · domain/itemprice/itemprice.go
-
Publish delivery charges
A merchandiser publishes a new delivery charge schedule: one charge per delivery speed, with an optional free-delivery threshold. It replaces the current one and its version must be higher.
ActorMerchandiserCommandPublishCharge POST /delivery-charge-schedulesSchedule AggregateDeliveryCharge Schedule EventDeliveryCharge Schedule Changed Systemshopping-cart PolicyReplaces the delivery charges used in its cart estimateSource: application/usecases/publish.go · domain/schedule/schedule.go
-
Publish the tax table
A merchandiser publishes a new tax table: rates by destination postal-prefix band, never overlapping. It replaces the current table and its version must be higher.
ActorMerchandiserCommandPublishTax POST /tax-tablesTable AggregateTaxTable EventTaxTable Changed Systemshopping-cart PolicyReplaces the tax rates used in its cart estimate -
Quote a checkout
When a checkout opens, it asks for a binding quote for the frozen cart. The quote fixes goods, delivery, tax and total, is valid for 15 minutes and comes back in the same reply.
ActorCheckout, for a shopperRead modelItem pricesRead modelCurrent delivery chargesRead modelCurrent tax tableCommandIssuePrice POST /price-quotesQuote AggregatePriceQuote EventPriceQuote analytics stream onlyIssued Source: application/usecases/quote.go · domain/quote/quote.go
-
Keep the catalogue list
offer-availability announces every new catalogue item. Pricing keeps a copy of which items exist, so a price can be set without a live call.
Systemoffer-availability EventCatalogItem Created PolicyWhenever a catalogue item is created, record it as known and activeCommandConsumer.CatalogItem started by the policyCreated Read model · kept up to dateKnown catalogue itemsSource: application/usecases/consume.go · adapters/inbound/kafka/offer_availability.go
-
Withdraw the price of a discontinued item
When an item is discontinued, its price is withdrawn automatically, in the same step that records the discontinuation. An item that was never priced only updates the copy.
Systemoffer-availability EventCatalogItem Discontinued PolicyWhenever an item is discontinued, mark it so and withdraw its active priceCommandConsumer.CatalogItem started by the policyDiscontinued AggregateItemPrice EventItemPrice Withdrawn Read model · kept up to dateKnown catalogue itemsSystemproduct-discovery PolicyMarks the item as no longer purchasableSystemshopping-cart PolicyClears the item's price, so it is no longer purchasableSource: application/usecases/consume.go · adapters/inbound/kafka/offer_availability.go
-
Announce prices when a sale starts or ends
A sweep looks for sale windows that opened or closed since the price was last checked and announces the new price. Re-running the same boundary announces nothing.
TimePolicy sweepPolicyEvery sweep, an item whose sale started or ended announces its new priceCommandPublishBoundaries started by the clockAggregateItemPrice EventItemPrice Changed Systemproduct-discovery PolicyUpdates the price on the product pageSystemshopping-cart PolicyUpdates the item's current price for its cart estimateSource: application/usecases/consume.go · cmd/api/policies.go
-
Let old quotes expire
A sweep marks issued quotes as expired once their 15 minutes are over. Nothing is announced: a quote past its time already reads as expired.
TimePolicy sweepPolicyEvery sweep, any issued quote past its expiry time becomes expiredCommandExpireQuotes started by the clockAggregatePriceQuote
Hot spots and opportunities
Open questions and known gaps, each taken from a decision record or a document in the repository, never invented. Opportunities are improvements the documentation already names.
- Hot spotA price cannot be set before the item is known here. The request is refused and the merchandiser has to retry once the catalogue event arrives.
- Hot spotA withdrawn price is final and cannot be revived. How to sell the item again is documented as an open question.
- Hot spotA price can move between the cart's estimate and the checkout. Only the binding quote is final, and it lasts 15 minutes.
Source: docs/ddd/eventstorming.md
Opportunities
- OpportunityCoupons and promotions are a later phase; today a sale window is the only way to discount an item.
Source: docs/overview/introduction.md
- OpportunityThe tax table is synthetic. Real tax calculation is meant to come from a bought tax engine later.
Source: docs/overview/introduction.md
This board is a reconstruction from the code and documentation of pricing at origin/develop, not a workshop output. Roles are the ones the documentation names. How the boards were made.