---
url: /reference/PRICING_CASE_MATRIX.md
---
# Pricing Case Matrix

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

***

## Totals

|---|---|
|---|---:|
| Use cases | 6 |
| Per-case scenario rows | 23 |
| Per-case scenario rows proven | 23 |
| Cross-cutting invariants | 3 (3 proven) |
| Gaps | 0 |

***

## Price list

### PR1 — List the price list

| Case | Expected answer | Proving test |
|---|---|---|
| Before any price was set | Empty list | `test/e2e/price-list.e2e-spec.ts` › `answers an empty list before any price was set` |
| Paging and narrowing by variant | Keyset pages; one variant when asked | `test/e2e/price-list.e2e-spec.ts` › `pages the list by variant and narrows it to one variant` |
| One list per currency | The currency asked for is listed | `test/e2e/sales-regional-profile.e2e-spec.ts` › `keeps one price list per currency and lists the one asked for` |

### PR2 — Replace the price list

| Case | Expected answer | Proving test |
|---|---|---|
| Replace the whole list | Counts of what changed and the entry ids a sale refers to | `test/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 list | Refused, nothing written | `test/e2e/price-list.e2e-spec.ts` › `refuses a list that cannot be a price list and writes nothing` |
| Who may replace and who may read | Owner and manager replace; every selling role reads; nobody else does either | `test/e2e/price-list.e2e-spec.ts` › `lets the owner and a manager replace, every selling role read, and nobody else do either` |
| Audit | One record per replacement with the counts and one per refusal | `test/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 one | Old price kept as history | `database/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

| Case | Expected answer | Proving test |
|---|---|---|
| Active book in the currency | Priced at the entry | `test/e2e/price-resolution-books.e2e-spec.ts` › `prices at the entry while the book is active and in the currency of the organization` |
| Inactive book | Entries ignored; the sale is `422 sales.price_unresolvable` | `test/e2e/price-resolution-books.e2e-spec.ts` › `ignores the entries of an inactive book and refuses the sale as unpriced` |
| Open transaction during a replacement | Priced at the entry in effect when it began | `test/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

| Case | Expected answer | Proving test |
|---|---|---|
| Set, reprice and remove | Variants not named keep their price | `test/e2e/price-list-edit.e2e-spec.ts` › `sets, reprices and removes prices without touching the variants it does not name` |
| Scheduled price | The current price stays until the start | `test/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 delta | Refused, nothing written | `test/e2e/price-list-edit.e2e-spec.ts` › `refuses a body that cannot be a delta and writes nothing` |
| Start in the past, foreign variant | Same refusal | `test/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 edit | Owner and manager; counts and refusals audited | `test/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 currency | Other currencies untouched | `test/e2e/price-list-edit.e2e-spec.ts` › `keeps one list per currency` |

### PR5 — Price now and next of an item

| Case | Expected answer | Proving test |
|---|---|---|
| Live variants of an item | Current and next price; unpriced ones `null` | `test/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 permission | The same refusal | `test/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

| Case | Expected answer | Proving test |
|---|---|---|
| Versions newest first | Scheduled included, keyset paging | `test/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 variant | Per currency; foreign cursor refused; empty list | `test/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 read | Selling roles read, others refused | `test/e2e/price-list-reads.e2e-spec.ts` › `lets the selling roles read the history and refuses the others` |
| Who wrote a price | Shown only to members who manage prices | `test/e2e/price-list-reads.e2e-spec.ts` › `shows who changed a price only to members who manage prices` |

## Cross-cutting invariants

| Invariant | Expected answer | Proving test |
|---|---|---|
| Each organization has its own list | No cross-tenant read or write | `test/e2e/price-list.e2e-spec.ts` › `keeps each organization with its own list` |
| A variant not on the list | `422 sales.price_unresolvable`, nothing sold | `test/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 another | Two books of one variant | `database/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` |
