Skip to main content

Business Context

Built on develop, not deployed

Derived from model/model.yaml. The shopping-cart service is built on develop (IQVO/shopping-cart at 95bc5bc, checked 2026-10-27) and not deployed (no warehouse-infra entry). Every Err... name, REST route and CloudEvents type of this context named on this page exists in the service; where the built service differs from the model's design, the page says so (As built) or the context's Service and operations section lists it.

The problem in plain language​

Between "I want this" and "I pay for this" sits the cart. The research behind this design names cost as the top abandonment reason (see Benchmarks), and the second doubt a shopper carries is "when will it arrive, and what does that speed cost?". The cart has to hold the intent — sometimes for minutes, sometimes for weeks — without ever letting the visible total lie.

The cart owns the holding, in four pieces:

It ownsWhy here
The lines — one per item, quantities merged (CartLine)A cart is a shopper's statement, not a catalogue copy: the model keeps it minimal (catalogItemId, quantity), bounded at 100 lines, and checks purchasability against local views (ErrItemNotPurchasable).
The destination postal prefixThe prefix is the input both the delivery quote and the tax band key on; the full ship-to address is PII that lives only in the network's customer-ordering (conventions.no_auth, meta.hard_boundary).
The delivery quote and the selections — one group per shipment, each offer with its tier, window and expiry; the shopper picks one offer per groupThe quote is the set of offers delivery-promise returned; a quote holds no capacity. The selection must name an offer of the current quote (ErrStaleDeliverySelection), and any line or destination change clears both.
The labelled, non-binding estimateEffective prices plus selected tier charges plus tax band, recomputed from pricing's events. The binding total is the checkout session's PriceQuote — the cart's number is always labelled as an estimate (gap S2).

What this context never does: it does not own prices, tier charges or tax bands (pricing), it does not promise or hold capacity (the network's delivery-promise), it does not run the purchase saga (checkout), and it stores no PII — only a shopperId reference when the shopper is signed in.

Actors​

ActorWhat they do hereChannel
Shopper (via storefront-bff, the experience layer)Creates a cart, adds lines, sets quantities and the destination, quotes delivery, selects a tier per group, merges a guest cart into their signed-in cart; reads the cart with its readiness and estimateREST /carts writes and GET /carts/{cartId}, GET /carts?shopperId=&state=
checkoutReads the cart (with its CheckoutReadiness) when a session opens; its ErrCartNotCheckoutReady invariant enforces the same readiness on its sideREST GET /carts/{cartId}
checkout (again)Closes the cart when the purchase completesKafka retailnetwork.checkout.events, CheckoutCompleted
pricingKeeps the cart's views current: effective prices, tier charges, tax bands, withdrawalsKafka retailnetwork.pricing.events
offer-availability (network)Reports catalogue items created and discontinuedKafka retailnetwork.offer-availability.events
delivery-promise (network)Answers QuoteDeliveryOffers for the cart's lines and destination — the only synchronous call outREST POST /delivery-quotes
Analytics consumersFollow add-to-cart, quote, abandon and checkout funnelsKafka retailnetwork.shopping-cart.analytics

The shopper is a synthetic person reached through storefront-web and the BFF (the experience layer keeps cart and shopper ids in a cookie — state, not authentication); no shopper calls a cart route directly.

Decisions this context makes​

The model lists five business decisions (contexts[shopping-cart].business_decisions):

  1. One line per item; adding an item already in the cart merges quantities (ErrDuplicateLine is the invariant behind the merge).
  2. A quote holds no capacity: it is the set of offers delivery-promise returned; a selection must name an offer of the current quote (ErrStaleDeliverySelection).
  3. Any line or destination change clears the quote and the selections. A stale quote is never silently kept.
  4. The estimate is labelled non-binding; the binding total is the checkout session's PriceQuote (gap S2 on the Model Gap Register).
  5. Guest-first: shopperId is optional; sign-in is a synthetic shopper lookup by e-mail (D4), after which MergeInto unifies the guest cart with the shopper's open cart.

It also runs two policies: AbandonInactive (an OPEN cart with no change for 30 days is ABANDONED) and CloseOnCheckoutCompleted (on CheckoutCompleted the cart is CHECKED_OUT).

How it relates to real storefronts​

The benchmarks research describes how large online retailers treat the cart as conversion infrastructure: show the total cost — item prices, delivery, tax — as early as possible, keep the cart across sessions, and merge a guest cart on sign-in. This model copies the shape, not any internal service name:

  • Total cost up front is the rule the model states in its purpose: the estimate exists so the total is visible before checkout, and it is labelled because it is not the number the shopper is charged.
  • Quote per shipment group with a tier choice is where this design is specific to the network: the groups and offers come from delivery-promise's feasible paths, not from a flat shipping-fee table.
  • Guest-first with merge follows D4 (no authentication): the cart is the only place shopper state is held without an identity, and merging is an explicit command with its own invariant (ErrMergeTarget).

Deliberately out of scope​

Out of scopeWhere it belongs
Item prices, tier charges, tax bandspricing (the cart consumes their events; it never calls pricing)
Feasible delivery paths, offers, capacity, promisesdelivery-promise (network); the cart only quotes and holds the result
The binding PriceQuote and the purchase sagapricing (quote issuing), checkout (the saga)
The order record, ship-to address, shopper PIIcustomer-ordering (network); the storefront holds shopperId / shipToAddressId references only
Search, browse, the product page's purchasability verdictproduct-discovery (its Purchasable is a four-input verdict; see Ubiquitous Language)
Product descriptions, media, categoriesproduct-content
Authorization, capture, refundcustomer-payments
Authentication and identitydeferred (D4): the identity future context
Saved-for-later lists, sharing, promotions on the cartnot in the model; promotions are a later phase (D10)
Persisted carts beyond abandonmentthe model's size estimate says abandoned carts are purged

See the Bounded Context Canvas for every message and the Context Map for every relationship.