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.

GitHub ↗ · Documentation ↗ · Architecture check · Briefings

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.

  1. Pivotal eventItemPriceChanged
  2. Pivotal eventItemPriceWithdrawn
  3. Pivotal eventDeliveryChargeScheduleChanged
  4. Pivotal eventTaxTableChanged
  5. Pivotal eventPriceQuoteIssued

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
  1. 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.

    ActorMerchandiser
    Read modelKnown catalogue items
    CommandCreateItemPricePOST /item-prices
    AggregateItemPrice
    EventItemPriceChanged
    Systemproduct-discovery
    PolicyShows the price on the product page and marks the item purchasable
    Systemshopping-cart
    PolicyKeeps the item's current price for its cart estimate

    Source: application/usecases/itemprice.go · domain/itemprice/itemprice.go

  2. 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.

    ActorMerchandiser
    Read modelKnown catalogue items
    CommandSetListPricePUT /item-prices/{catalogItemId}/list-price
    AggregateItemPrice
    EventItemPriceChanged
    Systemproduct-discovery
    PolicyUpdates the price on the product page
    Systemshopping-cart
    PolicyUpdates the item's current price for its cart estimate

    Source: application/usecases/itemprice.go · domain/itemprice/itemprice.go

  3. 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.

    ActorMerchandiser
    Read modelKnown catalogue items
    CommandScheduleSalePOST /item-prices/{catalogItemId}/sales
    AggregateItemPrice
    EventItemPriceChanged
    Systemproduct-discovery
    PolicyUpdates the price on the product page
    Systemshopping-cart
    PolicyUpdates the item's current price for its cart estimate

    Source: application/usecases/itemprice.go · domain/itemprice/itemprice.go

  4. 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.

    ActorMerchandiser
    CommandCancelSalePOST /item-prices/{catalogItemId}/sales/{saleId}/cancellations
    AggregateItemPrice
    EventItemPriceChanged
    Systemproduct-discovery
    PolicyPuts the list price back on the product page
    Systemshopping-cart
    PolicyPuts the list price back in its cart estimate

    Source: application/usecases/itemprice.go · domain/itemprice/itemprice.go

  5. 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.

    ActorMerchandiser
    CommandWithdrawPricePOST /item-prices/{catalogItemId}/withdrawals
    AggregateItemPrice
    EventItemPriceWithdrawn
    Systemproduct-discovery
    PolicyMarks the item as no longer purchasable
    Systemshopping-cart
    PolicyClears the item's price, so it is no longer purchasable

    Source: application/usecases/itemprice.go · domain/itemprice/itemprice.go

  6. 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.

    ActorMerchandiser
    CommandPublishChargeSchedulePOST /delivery-charge-schedules
    AggregateDeliveryChargeSchedule
    EventDeliveryChargeScheduleChanged
    Systemshopping-cart
    PolicyReplaces the delivery charges used in its cart estimate

    Source: application/usecases/publish.go · domain/schedule/schedule.go

  7. 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.

    ActorMerchandiser
    CommandPublishTaxTablePOST /tax-tables
    AggregateTaxTable
    EventTaxTableChanged
    Systemshopping-cart
    PolicyReplaces the tax rates used in its cart estimate

    Source: application/usecases/publish.go · domain/tax/tax.go

  8. 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 shopper
    Read modelItem prices
    Read modelCurrent delivery charges
    Read modelCurrent tax table
    CommandIssuePriceQuotePOST /price-quotes
    AggregatePriceQuote
    EventPriceQuoteIssuedanalytics stream only

    Source: application/usecases/quote.go · domain/quote/quote.go

  9. 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
    EventCatalogItemCreated
    PolicyWhenever a catalogue item is created, record it as known and active
    CommandConsumer.CatalogItemCreatedstarted by the policy
    Read model · kept up to dateKnown catalogue items

    Source: application/usecases/consume.go · adapters/inbound/kafka/offer_availability.go

  10. 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
    EventCatalogItemDiscontinued
    PolicyWhenever an item is discontinued, mark it so and withdraw its active price
    CommandConsumer.CatalogItemDiscontinuedstarted by the policy
    AggregateItemPrice
    EventItemPriceWithdrawn
    Read model · kept up to dateKnown catalogue items
    Systemproduct-discovery
    PolicyMarks the item as no longer purchasable
    Systemshopping-cart
    PolicyClears the item's price, so it is no longer purchasable

    Source: application/usecases/consume.go · adapters/inbound/kafka/offer_availability.go

  11. 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 sweep
    PolicyEvery sweep, an item whose sale started or ended announces its new price
    CommandPublishBoundariesstarted by the clock
    AggregateItemPrice
    EventItemPriceChanged
    Systemproduct-discovery
    PolicyUpdates the price on the product page
    Systemshopping-cart
    PolicyUpdates the item's current price for its cart estimate

    Source: application/usecases/consume.go · cmd/api/policies.go

  12. 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 sweep
    PolicyEvery sweep, any issued quote past its expiry time becomes expired
    CommandExpireQuotesstarted by the clock
    AggregatePriceQuote

    Source: application/usecases/quote.go · cmd/api/policies.go

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.

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.