Skip to content

Pricing Case Matrix ​

One row per behavioral case for the use cases of PRICING_USE_CASES.md, cited the same way as the other case matrices and verified by npm run lint:case-matrix.


Totals ​

------
Use cases6
Per-case scenario rows23
Per-case scenario rows proven23
Cross-cutting invariants3 (3 proven)
Gaps0

Price list ​

PR1 — List the price list ​

CaseExpected answerProving test
Before any price was setEmpty listtest/e2e/price-list.e2e-spec.ts › answers an empty list before any price was set
Paging and narrowing by variantKeyset pages; one variant when askedtest/e2e/price-list.e2e-spec.ts › pages the list by variant and narrows it to one variant
One list per currencyThe currency asked for is listedtest/e2e/sales-regional-profile.e2e-spec.ts › keeps one price list per currency and lists the one asked for

PR2 — Replace the price list ​

CaseExpected answerProving test
Replace the whole listCounts of what changed and the entry ids a sale refers totest/e2e/price-list.e2e-spec.ts › replaces the whole list, reports what changed and lists the entry ids a sale refers to
A list that cannot be a price listRefused, nothing writtentest/e2e/price-list.e2e-spec.ts › refuses a list that cannot be a price list and writes nothing
Who may replace and who may readOwner and manager replace; every selling role reads; nobody else does eithertest/e2e/price-list.e2e-spec.ts › lets the owner and a manager replace, every selling role read, and nobody else do either
AuditOne record per replacement with the counts and one per refusaltest/e2e/price-list.e2e-spec.ts › records one audit record per replacement with the counts and one per refusal
An unchanged amount keeps its entry id, a repriced one gets a new oneOld price kept as historydatabase/tests/contracts/pricing-price-list-contracts.ts › an unchanged amount keeps its entry id and a repriced amount gets a new one

PR3 — Price a sale ​

CaseExpected answerProving test
Active book in the currencyPriced at the entrytest/e2e/price-resolution-books.e2e-spec.ts › prices at the entry while the book is active and in the currency of the organization
Inactive bookEntries ignored; the sale is 422 sales.price_unresolvabletest/e2e/price-resolution-books.e2e-spec.ts › ignores the entries of an inactive book and refuses the sale as unpriced
Open transaction during a replacementPriced at the entry in effect when it begantest/e2e/price-resolution-race.e2e-spec.ts › keeps pricing the open transaction at the entry in effect when it began

PR4 — Edit prices as a delta ​

CaseExpected answerProving test
Set, reprice and removeVariants not named keep their pricetest/e2e/price-list-edit.e2e-spec.ts › sets, reprices and removes prices without touching the variants it does not name
Scheduled priceThe current price stays until the starttest/e2e/price-list-edit.e2e-spec.ts › schedules a price that starts later and keeps the current one until then
A body that cannot be a deltaRefused, nothing writtentest/e2e/price-list-edit.e2e-spec.ts › refuses a body that cannot be a delta and writes nothing
Start in the past, foreign variantSame refusaltest/e2e/price-list-edit.e2e-spec.ts › refuses a start in the past and a variant that is not of the organization with the same answer
Who may editOwner and manager; counts and refusals auditedtest/e2e/price-list-edit.e2e-spec.ts › lets the owner and a manager edit and nobody else, auditing the counts and each refusal
One list per currencyOther currencies untouchedtest/e2e/price-list-edit.e2e-spec.ts › keeps one list per currency

PR5 — Price now and next of an item ​

CaseExpected answerProving test
Live variants of an itemCurrent and next price; unpriced ones nulltest/e2e/price-list-reads.e2e-spec.ts › answers the current and next price of every live variant of an item and leaves the unpriced ones null
Unknown item, foreign item, no permissionThe same refusaltest/e2e/price-list-reads.e2e-spec.ts › answers an unknown item, an item of another organization and a role without the permission with the same refusal

PR6 — History of a variant ​

CaseExpected answerProving test
Versions newest firstScheduled included, keyset pagingtest/e2e/price-list-reads.e2e-spec.ts › lists every version of a variant newest first, scheduled ones included, and pages with a keyset
Currency, cursor, foreign variantPer currency; foreign cursor refused; empty listtest/e2e/price-list-reads.e2e-spec.ts › keeps each currency, refuses a cursor of another listing and shows nothing for a variant that is not the organization
Who may readSelling roles read, others refusedtest/e2e/price-list-reads.e2e-spec.ts › lets the selling roles read the history and refuses the others
Who wrote a priceShown only to members who manage pricestest/e2e/price-list-reads.e2e-spec.ts › shows who changed a price only to members who manage prices

Cross-cutting invariants ​

InvariantExpected answerProving test
Each organization has its own listNo cross-tenant read or writetest/e2e/price-list.e2e-spec.ts › keeps each organization with its own list
A variant not on the list422 sales.price_unresolvable, nothing soldtest/e2e/price-resolution-race.e2e-spec.ts › refuses a variant that is not on the price list with 422 sales.price_unresolvable
The list of one currency never touches anotherTwo books of one variantdatabase/tests/contracts/sales-regional-profile-contracts.ts › the list in the organization currency and the list in another currency are two books of one variant that never touch each other

Application Foundation in progress. Tracked in issue #13.