Skip to content

Sales Case Matrix ​

One row per behavioral case for the use cases of SALES_USE_CASES.md. Each case names the test that proves it as a spec file path, the separator "›" and the exact test title, like the other case matrices; npm run lint:case-matrix verifies every citation and every count on this page.


Totals ​

Use cases3
Per-case scenario rows40
Per-case scenario rows proven40
Cross-cutting invariants5 (5 proven)
Gaps0

Take an order ​

SL1 — Take an order ​

CaseExpected answerProving test
Happy path: a stocked item201 with the lean order, money as six-decimal stringstest/e2e/sales-take-order.e2e-spec.ts › sells a stocked item: 201 with the lean order, money as six decimals
Missing or non-UUID Idempotency-Key400, nothing soldtest/e2e/sales-take-order-refusals.e2e-spec.ts › answers 400 without an Idempotency-Key and with one that is not a UUID
Empty body, unknown field, or a price sent by the client400test/e2e/sales-take-order-refusals.e2e-spec.ts › answers 400 for an empty body, an unknown field and a price sent by the client
Quantity with more than six decimals422 sales.order_refused, nothing soldtest/e2e/sales-take-order-refusals.e2e-spec.ts › refuses a quantity with more than six decimals: 422, nothing sold
Quantity of zero422test/e2e/sales-take-order-refusals.e2e-spec.ts › refuses a quantity of zero: 422
Variant the outlet does not sell422 sales.lines_not_sellable without its snapshottest/e2e/sales-take-order-refusals.e2e-spec.ts › refuses a variant the outlet does not sell, without showing its snapshot
Variant of another organizationSame answer as an unknown varianttest/e2e/sales-take-order-refusals.e2e-spec.ts › refuses a variant of another organization the same way as an unknown one
The same variant twiceTwo linestest/e2e/sales-take-order-refusals.e2e-spec.ts › sells the same variant twice as two lines
Tax-inclusive default price book422, nothing soldtest/e2e/sales-take-order-refusals.e2e-spec.ts › refuses a tax-inclusive default price book: 422
Six-decimal money0.5 x 0.99 sells for 0.495000; the lines sum exactlytest/e2e/sales-take-order-supply.e2e-spec.ts › keeps six decimals: 0.5 x 0.99 sells for 0.495000 and the lines sum exactly
Any client price, price book entry or unknown field on a line or on the order400, nothing soldtest/e2e/sales-take-order-priced.e2e-spec.ts › rejects a client price, a price book entry and unknown fields with 400 and sells nothing
Options and a combo choicePriced on the server, frozen on the order and read back unchangedtest/e2e/sales-take-order-priced.e2e-spec.ts › prices options and a combo choice on the server and freezes them on the order
Combo sent without its required choice422 sales.order_refused when a default component hides the gap, 422 sales.lines_not_sellable otherwise; a choice that is not a component is 422 sales.price_unresolvable, a malformed id 400; nothing soldtest/e2e/unlock-sale-combo-choices.e2e-spec.ts › refuses a combo whose default component fills a required group when no choice is sent with 422 sales.order_refused and sells nothing
Options and combo choices echoed per lineThe sale, the read and the replay answer the same options and bundleChoices with names, quantities and amounts; a plain line answers empty liststest/e2e/unlock-sale-line-choices.e2e-spec.ts › returns the chosen options and combo choices per line in the sale, in the read and in the replay, and empty lists for a plain line
Happy hour ruleApplies inside its schedule and not outside ittest/e2e/sales-take-order-priced.e2e-spec.ts › applies a happy hour rule inside its schedule and not outside it
Unknown option, combo component, channel, menu or service mode422 sales.price_unresolvable, nothing soldtest/e2e/sales-take-order-priced.e2e-spec.ts › refuses unknown references with 422 sales.price_unresolvable and an unknown service mode with 400, and sells nothing
Service mode of the orderStored on the order, returned by the sale and the read, null when not sent; a replay with another service mode is 409 idempotency.key_reusedtest/e2e/sales-take-order-service-mode.e2e-spec.ts › stores the service mode on the order, returns it on the sale, the replay and the read, and refuses a replay that changes it
A variant, option or combo component blocked at the outlet409 sales.item_unavailable, nothing sold, sells again once the block endstest/e2e/unlock-sale-review.e2e-spec.ts › refuses a blocked variant with 409 sales.item_unavailable, sells nothing and sells again once the block ends
A replay that changes the menu, channel, service mode or overrides409 idempotency.key_reusedtest/e2e/unlock-sale-review.e2e-spec.ts › refuses a replay that changes the menu, the channel, the service mode or the overrides with 409 idempotency.key_reused
Exhausted blocking quota, warning quota and replay409 sales.capacity_exceeded without pool ids; a warning quota sells with warnings; the replay answers the originaltest/e2e/sales-take-order-priced.e2e-spec.ts › blocks an exhausted quota with 409, warns on a warning quota and replays the original
Quota overrideNeeds a valid approval per pool; a body without the approval id is 400test/e2e/sales-take-order-priced.e2e-spec.ts › lets a holder of the override permission sell past a block with an approval id and refuses a bad body
AuditOne sales.order.taken record, none for the replaytest/e2e/sales-take-order.e2e-spec.ts › records one audit event for the order taken and none for its replay
Currency of the outlet and business date of its siteEach outlet sells at the price list of its own currency and dates the order by its own time zonetest/e2e/sales-regional-profile.e2e-spec.ts › sells the same variant at the price list of the currency of each outlet and dates each order by its own time zone
Currency without a price list422 sales.price_unresolvable, nothing soldtest/e2e/sales-regional-profile.e2e-spec.ts › refuses the sale as unpriced in a currency that has no price list and refuses an unknown currency
Currency mismatch between order and outletThe database refuses with 23514 and the constraint sales_order_currency_mismatchdatabase/tests/contracts/sales-regional-profile-contracts.ts › the outlet currency refusal carries the constraint sales_order_currency_mismatch so the application can tell it from any other refusal
Currency mismatch to the client409 sales.currency_mismatchsrc/modules/sales/presentation/failures/to-public-sales-failure.spec.ts › answers a currency mismatch as a conflict with its own code

SL3 — Replay, stock and permission of an order ​

CaseExpected answerProving test
Same key and request200, replayed: true, one ordertest/e2e/sales-take-order.e2e-spec.ts › replays the same key and request: 200, replayed true, one order
Same key after the item was delistedReplays; a new key is refusedtest/e2e/sales-take-order.e2e-spec.ts › replays the same key after the item was delisted: 200, replayed true, a new key is refused
Same key, another request409 idempotency.key_reusedtest/e2e/sales-take-order.e2e-spec.ts › refuses the same key with another request: 409 idempotency.key_reused
Stock deducted once, also on replayOne deductiontest/e2e/sales-take-order-supply.e2e-spec.ts › deducts the stock of a stocked item once, also when the sale is replayed
Not enough stock409 sales.insufficient_stock, nothing sold, no inventory id in the answertest/e2e/sales-take-order-supply.e2e-spec.ts › refuses a sale without enough stock: 409, nothing sold, no inventory id in the answer
Two concurrent sales of the last unitExactly one passestest/e2e/sales-take-order-supply.e2e-spec.ts › lets only one of two concurrent sales of the last unit through
Replay after a repriceAnswers the original order and pricedatabase/tests/contracts/sales-take-order-priced-contracts.ts › a replay after a reprice returns the original order with its original price and sells nothing again
Two sessions selling the last unit of quota and of stockOne sale wins; a refused sale leaves no quota draw behinddatabase/tests/contracts/sales-take-order-last-unit-race-contracts.ts › two sessions selling the last stock unit with plenty of quota: one sale wins, the other is refused for stock (23514) and its quota draw rolls back with it
Member without the permission403 sales.action_forbiddentest/e2e/sales-take-order-refusals.e2e-spec.ts › refuses a member without the permission: 403

Read an order ​

SL2 — Read an order ​

CaseExpected answerProving test
Happy path200, no replayed, never cachedtest/e2e/sales-order-detail.e2e-spec.ts › reads the order as it was sold: 200, no replayed flag, never cached
Unknown order or order of another organization404 sales.order_not_foundtest/e2e/sales-order-detail.e2e-spec.ts › answers 404 for an order that does not exist and for one of another organization
Member without sales.orders.read403 sales.action_forbiddentest/e2e/sales-order-detail.e2e-spec.ts › refuses a member without sales.orders.read at the outlet: 403
Order id not a UUID400test/e2e/sales-order-detail.e2e-spec.ts › answers 400 when the order id is not a UUID
Member who may take but not readReplays the original order after a repricetest/e2e/sales-take-order-replay.e2e-spec.ts › answers the original order to a member who may take but not read, after a reprice

Cross-cutting invariants ​

InvariantExpected answerProving test
An outlet outside the scope, an unknown one and one of another organizationThe same 403test/e2e/sales-take-order-refusals.e2e-spec.ts › answers the same 403 for an outlet outside the scope, an unknown one and one of another organization
One organization never sells into the outlet of anotherRefusedtest/e2e/sales-take-order-refusals.e2e-spec.ts › never lets one organization sell into the outlet of another
A member who may read but not take, and a seller of another outletRefusedtest/e2e/sales-take-order-replay.e2e-spec.ts › refuses a member who may read but not take, and a seller of another outlet
With a zero cutoff the business date is the local date of the siteNot the server datedatabase/tests/contracts/sales-business-day-contracts.ts › with the default cutoff of zero the business date is the local date of the site, not the date of the server
A 23:59 cutoff puts a sale of today in the previous business dayThe order number carries that datedatabase/tests/contracts/sales-business-day-contracts.ts › a cutoff of 23:59 makes a sale of today belong to the previous business day and the order number carries that date

Application Foundation in progress. Tracked in issue #13.