This is the build plan for this decision record, bite by bite, as it was grilled and built. It’s copied from our repository unedited, apart from customer, partner and bank names, which read [redacted]. It was written for the people and agents building the product, so expect internal shorthand, and the mistakes are left in.
ADR-841 — Implementation Plan
Findings for the ADR
- F1 — bite 1 is on
maintoday; bite 2 waits for the cards series. The price shape, the lookup, the scripting argument and the dispatcher’s bag live in Pricing, Scripting and Accounts as they stand. The posting commands that carry the bag (ADR-836, ADR-839, ADR-840), the credit card’s purchase workflow (ADR-838) and the domestic country facet (ADR-836 F7) are not; bite 2 starts after those land. Bite 3 after bite 1. - F2 — the ADR named settings commands that do not exist. Pricing’s commands are
AddPriceTypeCommand,EditPriceTypeCommand,ChangePriceCommand,RemovePriceCommand(and their list queries); the plan extends those and## Contractsis corrected in the same fold. - F3 — the price list page is a set of bespoke forms (
features/settings/forms/add-price-form.tsx,edit-price-form.tsx,add-price-type-form.tsx,edit-price-type-form.tsx), not an entity-types page; the matrix is a new component beside them, reached from the same page. - F4 — Cards derives
cross-borderandcurrency-conversion; Accounts never knows the domestic country. The bag is built in Cards where the card, the facet and the line are, and Accounts passes it through. Shape only. - F5 — the credit card’s ATM fee is ADR-838’s cash-advance fee. The template gives
card-cash-advance-feea{ cross-border: yes }row beside its flat fallback and leaves the credit card’s workflow alone but for the markup row;card-atm-feeis the deposit types’ row. - F6 — the dispatcher binds no price provider on
main(ADR-839 F5 adds it), no command carries a bag, andWorkflowDispatchContextis ADR-836’s live file, so every dispatcher and interpreter edit is bite 2’s; bite 1 proves the lookup, the quote, the scripting arity and the settings refusals, and lands with bite 3 as a batch of its own. - F7 — pre-existing defects filed, not fixed here:
PriceAdjustment.Appliesignores its start date (an override applies retroactively) andOverridePriceCommandValidatorcompares the value date to the wall clock;RegulatoryLimitAdvisoryValidatorprices with an empty context. F-1796 (P1) is fixed in bite 1, the seam this ADR rides; F-1797 and F-1798 stay filed. - F8 —
ListPrices’ row id{list}_{type}_{date}collides across series; it gains the selectors (sorted by key) and the band (invariant, normalised decimals).PackageModel’s vocabulary class isPriceTypeVocabularyEntry;ListPricesis an inline endpoint, not a query type. - F9 —
IPriceProviderhas eleven test doubles the footprint does not list; they are in bite 1’s files so/ltm-partitionsees them. - F10 —
ExternalIntegrationsValidatorchecks$references against a fixed list per source (Check("cardPurchase", …)on ADR-836’s branch); the eight card keys are added to the card sources there, so a template using$channelloads.
Files touched
Bite 1 — the attribute-banded price
src/LedgerTM.Contracts/Pricing/PriceLists/PriceContext.cs— new;PriceContext,PriceQuotewithFeeForsrc/LedgerTM.Contracts/Pricing/PriceLists/IPriceProvider.cs— the context overloads,QuoteandTryQuotesrc/LedgerTM.Contracts/Pricing/PriceLists/IPriceTypeCatalog.cs—PriceTypeInfo.Selectorssrc/LedgerTM.Pricing/PriceLists/Domain/Price.cs—Selectors,FromAmount,ToAmount,Minimum,Maximum,Retired,Matches,Specificitysrc/LedgerTM.Pricing/PriceLists/Domain/PriceSelector.cs— new;PriceSelector(Key, AllowedValues)src/LedgerTM.Pricing/PriceLists/Domain/PriceList.cs—Quote(type, valueDate, context): match, specificity, latest date, retired series;ChangePrice/RemovePricekeyed by seriessrc/LedgerTM.Pricing/PriceLists/Domain/PriceTypeEntry.cs,PriceSettings.cs—Selectors;PriceSettings.ChangePrice/RemovePrice/EditPriceTypecarry the undeclared-key, undeclared-value, malformed, band, floor, fallback (whole-list), tie and in-use refusals as domain errors so the importer meets themsrc/LedgerTM.Pricing/PriceLists/Application/Settings/Prices/ChangePrice.cs,RemovePrice.cs,ListPrices.cs— selectors, band, floor, cap and retire on the commands;NewPrice >= 0; the read’s rows and series-aware ids (F8)src/LedgerTM.Pricing/PriceLists/Application/Settings/PriceTypes/AddPriceType.cs,EditPriceType.cs,ListPriceTypes.cs—Selectorswith values;PRICE_KIND_IN_USEsrc/LedgerTM.Pricing/PriceLists/Application/Factories/PriceListPriceProvider.cs,IPriceListPriceProvider.cs,PriceListPriceProviderFactory.cs,PriceTypeCatalog.cs,PriceTypeReferenceSource.cs— the context through to the list; the minor unit resolved once in the factory throughICurrencyDisplayResolver; the catalog’s selectorssrc/LedgerTM.Pricing/PricingPlans/Domain/PriceAdjustment.cs,PricingPlan.cs—EffectiveDateon the adjustment from its event;Applieschecks it (F-1796); the zero-row rulesrc/LedgerTM.Pricing/PricingPlans/Application/Commands/OverridePrice.cs—PRICE_OVERRIDE_ON_WAIVED; aRatetype’s value capped at 1src/LedgerTM.Pricing/PricingPlans/Application/Factories/PriceProvider.cs— the context overloads; adjustments after the row, never on zerosrc/LedgerTM.Scripting/Binding/Binder.cs,BoundNode.cs,Compilation/Compiler.cs,Evaluation/ExpressionPriceProvider.cs,ExpressionEvaluator.cs—price(type, valueDate, amount)andfee(type, valueDate, amount)over two decimal functionssrc/LedgerTM.Accounts/Domain/Valuation/AccountValuation.cs,src/LedgerTM.Accounts/Application/Operations/AccountGuardContextBuilder.cs— the price adapter supplies both functions (empty attributes in the day walk);AccountValuationPriceLookupTestsis the guardsrc/LedgerTM.Seeding.Provisioning/PackageModel.cs,PackageImporter.cs,PackageExporter.cs—PriceEntry.Selectors,FromAmount,ToAmount,Minimum,Maximum,Retired;PriceTypeVocabularyEntry.Selectors; the importer goes throughPriceSettings.ChangePriceand runs the whole-list check once per list; round-trip- the
IPriceProviderdoubles (F9):LedgerTM.Testing.Infrastructure/**/AccountServiceStubs.cs,LedgerTM.Tests.Unit/Accounts/Valuation/AccountValuationPriceLookupTests.cs,InstalmentSolverPerformanceTests.cs,LedgerTM.Tests.Unit/Accounts/RegulatoryLimitAdvisorySkipTests.cs,LedgerTM.Tests.Unit/Accounts/Configuration/RegulatoryLimitAdvisoryValidatorTests.cs,LedgerTM.Tests.Unit/Accounts/Operations/NoticeEarlyWithdrawalTests.cs,ZaRetailPayoutMigrationTests.cs,InheritedInputRailPinTests.cs,LedgerTM.Tests.Unit/Payments/Settlement/RailFeeResolutionTests.cs,LedgerTM.Tests.Component/Seeding/RegulatoryLimitSeedAdvisoryTests.cs,InstalmentPreviewTests.cs src/ui-apps/shared/src/generated/api-types.ts— regeneratedLedgerTM.Tests.Component/Pricing/CreatePricingPlanTests.cs,GetPricingPlanForAccountTests.cs— their overrides sit on a list with no rows and meetPRICE_OVERRIDE_ON_WAIVED; they price the list firstsrc/LedgerTM.Scripting/Evaluation/ScriptRuntime.cs,LedgerTM.Scripting.Tests.Unit/ExpressionPriceProviderTests.cs,CompilerTests.cs,LedgerTM.Tests.Architecture/Pricing/DatedLookupDefaultTests.cs— the third argument and the second functionLedgerTM.Tests.Unit/Pricing/AttributeBandedPriceTests.cs— new;LedgerTM.Tests.Component/Pricing/PriceSelectorSettingsTests.cs— new
Bite 2 — the card attributes and the card fees
src/LedgerTM.Contracts/Accounts/ProcessExternalSourceCommands.cs—PricingAttributesonProcessCardPurchaseCommandandProcessCardFeeCommandsrc/LedgerTM.Accounts/Application/Workflows/WorkflowInterpreter.cs,src/LedgerTM.Accounts/Application/Commands/ProcessExternalSourcePaymentHandlers.cs—WorkflowDispatchContext.PricingAttributes; the dispatcher binds the bag; the eight$parameters bound to “” where absent; thepricing.properties on every legsrc/LedgerTM.Accounts/Application/Settings/ExternalIntegrationsValidator.cs— the eight card keys on the card sources’ supplied lists (F10);src/LedgerTM.Accounts/Application/Settings/AccountTypesSettingsValidator.cs—ACCOUNT_TYPE_INPUT_SHADOWS_PRICING_ATTRIBUTE(a refusal)src/LedgerTM.Cards/Domain/CardTypesSettings.cs,Application/Settings/AmendCardTypes.cs—CardType.Schemesrc/LedgerTM.Cards/Application/Pricing/CardPricingAttributes.cs— new; builds the eight-key bag from a card, its type, the facet and a linesrc/LedgerTM.Cards/Application/DayEnd/CardClearingCommands.cs(ADR-836’s post step),Application/Commands/ChargeCardFee.cs(ADR-839) — fill the bagsrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/PriceSettings.yaml—card-currency-conversion-fee,card-atm-fee(new types with selectors, values and fallbacks);card-replacement-fee,card-cash-advance-feegain selectors and rows beside their flat fallbackssrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/AccountTypesSettings.yaml—CardCurrencyConversionFeeChargedon every type carryingcardPurchasewith its row after the purchase leg (on the credit card, before the payment allocation, Dr Fees / Dr Outstanding,costOfCreditCategory: Fee);CardAtmFeeChargedand the ATM row on the deposit typessrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/CardTypesSettings.yaml—scheme: visaon every row (ADR-838’screditrow included)src/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/PostingSettings.yaml— the two fee types’ GL legs (fee income), the tax treatment ofCashAdvanceFeeChargedsrc/ui-apps/bank/src/features/entity-types/card-types.tsx—SchemeLedgerTM.Tests.Component/Cards/CardsComponentFixture.cs—schemeon its types,RetailPriceListIdholding the retail rows and assigned to its accounts, its own call-deposit type carrying the conversion and ATM fee rows too, the credit card and current account helpers ADR-838’s and ADR-837’s tests assume (UseCreditCardsAsync,OpenRevolvingAccountAsync,IssueCreditCardAsync,ZarCurrentAccount)LedgerTM.Tests.Unit/Seeding/CardFeeTemplateTests.cs(ADR-839) — everycardPurchasetype carries the conversion-fee row after its purchase legLedgerTM.Tests.Component/Cards/CardFeePricingTests.cs— new
Bite 3 — the matrix, the probe, the guide
src/LedgerTM.Pricing/PriceLists/Application/Queries/GetPriceMatrix.cs— new;GetPriceMatrixQuery,PriceMatrixViewsrc/ui-apps/bank/src/features/settings/components/price-matrix.tsx— new;forms/add-price-form.tsx,edit-price-form.tsx— selector pickers over the declared values, the band, the floor and cap, retire;add-price-type-form.tsx,edit-price-type-form.tsx— selector keys and values;features/accounts/shared/dialogs/override-price-dialog.tsx— shows the kind, a rate entered as a rate;hooks/price-types.ts;lib/api.tssrc/ui-apps/bank/ui-review/adr-uat/flows/adr-841-server-probe.ts— newdocs/guide/price-matrix.md— new;price-types.md— selectors and their values;docs/guide/features/cards.md— the card feesdocs/standards/README.md— the ISO 4217 row gains the selector noteLedgerTM.Tests.Component/Pricing/PriceMatrixViewTests.cs— new
Prior art
Nothing changed since the grill. The settings commands are the existing ones (F2); the
CardPricingAttributes builder is a Cards-internal helper, not a contract.
Interfaces
// src/LedgerTM.Contracts/Pricing/PriceLists/PriceContext.cs — new (D3)
public sealed record PriceContext(IReadOnlyDictionary<string, string> Attributes, decimal? Amount)
{
public static readonly PriceContext Empty = new(new Dictionary<string, string>(), null);
}
public sealed record PriceQuote(decimal Value, PriceKind Kind, decimal? Minimum, decimal? Maximum, CurrencyId Currency, int MinorUnit) // the chosen row after the plan's adjustments to Value; MinorUnit from the tenant's currency setting, 2 where unset
{
// fee(): a zero or negative value or amount is 0; an Amount row is its value; a Rate row is clamp(Value * amount, Minimum, Maximum) rounded MidpointRounding.AwayFromZero to MinorUnit; the rate applies to the whole amount
public decimal FeeFor(decimal amount);
}
// src/LedgerTM.Contracts/Pricing/PriceLists/IPriceProvider.cs — changed (D3)
decimal GetPrice(string priceType, DateOnly valueDate, PriceContext context); // the two-argument forms call these with PriceContext.Empty
decimal? TryGetPrice(string priceType, DateOnly valueDate, PriceContext context);
PriceQuote Quote(string priceType, DateOnly valueDate, PriceContext context); // throws UnpricedOnDateException on a miss, as GetPrice does (ADR-704)
PriceQuote? TryQuote(string priceType, DateOnly valueDate, PriceContext context);
// src/LedgerTM.Contracts/Pricing/PriceLists/IPriceTypeCatalog.cs — changed (D2)
public sealed record PriceSelectorInfo(string Key, IReadOnlyList<string> AllowedValues);
public sealed record PriceTypeInfo(string Key, string Label, PriceKind Kind, bool IsActive, IReadOnlyList<PriceSelectorInfo> Selectors);
// src/LedgerTM.Pricing/PriceLists/Domain/Price.cs — changed (D1)
public class Price
{
public PriceTypeId PriceType { get; set; }
public DateOnly EffectiveDate { get; set; }
public decimal Value { get; set; } // >= 0; a waived fee is 0
public Dictionary<string, string> Selectors { get; set; } = []; // lower-case kebab keys and values; empty = the fallback series
public decimal? FromAmount { get; set; } // [From, To): inclusive bottom, exclusive top; null From = no band; null To = open top; From >= 0
public decimal? ToAmount { get; set; }
public decimal? Minimum { get; set; } // Rate rows only: the fee's floor and cap in the list's currency, dated with the row
public decimal? Maximum { get; set; }
public bool Retired { get; set; } // a dated row that ends its series: from its date the series is absent (D1)
public int Specificity => Selectors.Count + (FromAmount is null ? 0 : 1);
public bool Matches(PriceContext context) =>
Selectors.All(s => context.Attributes.TryGetValue(s.Key, out var v) && v == s.Value)
&& (FromAmount is null || (context.Amount is { } a && FromAmount <= a && (ToAmount is null || a < ToAmount)));
public bool SameSeriesAs(Price other); // same selector set and band
public bool BandOverlaps(Price other); // a.From < (b.To ?? ∞) && b.From < (a.To ?? ∞); an unbanded row overlaps every band
}
// PriceList.Quote(PriceTypeId, DateOnly valueDate, PriceContext context): rows of the type with EffectiveDate <= valueDate and Matches(context), grouped by series; a series whose latest row at or before the date is Retired is absent;
// ordered by Specificity desc then EffectiveDate desc, first row; null when none. GetPrice is Quote?.Value; the old GetPrice(type, date) is GetPrice(type, date, PriceContext.Empty).
// PriceList.ChangePrice(type, value, valueDate, selectors, fromAmount, toAmount, minimum, maximum, retired): replaces the row of the same series and date, else adds. RemovePrice(type, valueDate, selectors, fromAmount, toAmount) likewise.
// src/LedgerTM.Pricing/PriceLists/Domain/PriceSelector.cs — new (D2); PriceTypeEntry.cs — changed
public sealed class PriceSelector { public string Key { get; set; } = ""; public List<string> AllowedValues { get; set; } = []; } // VocabularyKey.Pattern on both; at least one value
public List<PriceSelector> Selectors { get; set; } = []; // on PriceTypeEntry
// src/LedgerTM.Pricing/PriceLists/Domain/PriceSettings.cs — the refusals live here (D1, D2, D6), DomainException, 422, the message naming type, selectors, band and date of each row named:
// PRICE_SELECTOR_MALFORMED (a key or value not lower-case kebab); PRICE_SELECTOR_UNDECLARED (a row names a key the type does not declare); PRICE_SELECTOR_VALUE_UNDECLARED (a value the key does not allow);
// PRICE_BAND_INVALID (FromAmount < 0, FromAmount >= ToAmount, or a ToAmount with no FromAmount); PRICE_FLOOR_INVALID (Minimum/Maximum on an Amount row, Minimum > Maximum, or a negative); PRICE_VALUE_NEGATIVE;
// PRICE_FALLBACK_REQUIRED (whole list, per type: the earliest {} unbanded row is on or before the earliest selected or banded row — checked after ChangePrice and RemovePrice, and once per list after an import);
// PRICE_ROW_TIE (per list, per type: two rows of different series with equal Specificity, selector sets that disagree on no shared key, and BandOverlaps — the fallback never ties — whatever their dates);
// PRICE_ROW_NOT_FOUND (RemovePrice of a row that does not exist; null Selectors = the empty map = the fallback series); PRICE_SELECTOR_IN_USE (a key or value dropped while a row names it); PRICE_KIND_IN_USE (a Kind changed while rows exist);
// PRICE_SELECTOR_MALFORMED also covers a declared selector with no values or a duplicate key, and runs before UNDECLARED. Retiring the fallback series while a selected row stands, or removing the last fallback, is PRICE_FALLBACK_REQUIRED. A Retired row's NewPrice is ignored and stored as 0.
// ChangePrice of an existing series-and-date replaces it; EditPriceTypeCommand with Selectors = null leaves the selectors unchanged. The importer's refusal surfaces as the same DomainException, wrapped as its other refusals are, and writes nothing.
// PriceList.Quote returns Price?; PriceList.ChangePrice(type, value, valueDate, selectors: Dictionary<string,string>? = null, fromAmount = null, toAmount = null, minimum = null, maximum = null, retired = false). YAML: a price type's `selectors: [{ key, allowedValues: [...] }]`; a price row's `selectors:` map, `fromAmount`, `toAmount`, `minimum`, `maximum`, `retired`. ListPrices' row field is `selectors`.
// The two-argument IPriceProvider forms are default interface methods over the context forms, so every double keeps compiling and the forms cannot drift.
// src/LedgerTM.Pricing/PriceLists/Application/Settings/… — changed (D1, D2, D6)
public record ChangePriceCommand(PriceListId PriceListId, PriceTypeId PriceType, decimal NewPrice, DateOnly EffectiveDate,
IReadOnlyDictionary<string, string>? Selectors = null, decimal? FromAmount = null, decimal? ToAmount = null, decimal? Minimum = null, decimal? Maximum = null, bool Retired = false) : ISettingsCommand<PriceSettings>;
public record RemovePriceCommand(PriceListId PriceListId, PriceTypeId PriceType, DateOnly EffectiveDate, IReadOnlyDictionary<string, string>? Selectors = null, decimal? FromAmount = null, decimal? ToAmount = null) : ISettingsCommand<PriceSettings>;
public record AddPriceTypeCommand(string Key, string Label, PriceKind Kind, IReadOnlyList<PriceSelectorInfo>? Selectors = null) : ISettingsCommand<PriceSettings>;
public record EditPriceTypeCommand(string Key, string Label, PriceKind Kind, bool IsActive, IReadOnlyList<PriceSelectorInfo>? Selectors = null) : ISettingsCommand<PriceSettings>;
// ListPrices (the inline endpoint) returns the new fields; its row id is {list}_{type}_{date}_{selectors sorted by key as k=v;…}_{from}-{to} with invariant, normalised decimals (F8).
// src/LedgerTM.Pricing/PricingPlans — changed (D3, F-1796)
public record PriceAdjustment(AdjustmentKind Kind, AdjustmentScope Scope, PriceTypeId? PriceType, decimal Value, DateOnly EffectiveDate, DateOnly? EndDate = null)
{ public bool Applies(PriceTypeId priceType, DateOnly valueDate) => (Scope == Global || PriceType == priceType) && EffectiveDate <= valueDate && (!EndDate.HasValue || EndDate >= valueDate); }
// PricingPlan.ApplyAdjustments(type, basePrice, valueDate): basePrice <= 0 → basePrice unchanged (never on a zero row). OverridePriceCommandValidator: NewPrice > 0; a Rate type's NewPrice above 1 → PRICE_OVERRIDE_RATE_ABOVE_ONE; PRICE_OVERRIDE_ON_WAIVED when the account's list has no positive row of the type, in any series, effective on EffectiveDate (a DomainException from the handler, which reads the list through the account's plan); an override dated before the type's first row is the same refusal.
// PriceProvider.Quote/TryQuote: the list's row, Value adjusted by the plan, Minimum/Maximum as the row has them, MinorUnit from the factory.
// src/LedgerTM.Scripting — changed (D3); Scripting references Infrastructure.Contracts only, so it takes two decimal functions and no quote type:
public sealed class ExpressionPriceProvider(Func<string, DateOnly, decimal?, decimal>? price, Func<string, DateOnly, decimal, decimal>? fee) // a null function evaluates to 0 (today's "declared but unsupplied" contract); ScriptRuntime.PriceLookup takes the third argument
// price(type, valueDate) and price(type, valueDate, amount): BoundPriceLookup gains an optional Amount node; fee(type, valueDate, amount): BoundFeeLookup, gated by ScriptCatalog.HasPriceLookup (Infrastructure.Contracts, unchanged), arity 3 only; rate() keeps arity 2.
// The Accounts adapter: price = (t, d, a) => provider.GetPrice(t, d, new PriceContext(attributes, a)); fee = (t, d, a) => provider.Quote(t, d, new PriceContext(attributes, a)).FeeFor(a) — the miss throws UnpricedOnDateException from Pricing, as today.
// src/LedgerTM.Contracts/Accounts/ProcessExternalSourceCommands.cs — changed (D3, D4), bite 2
// ProcessCardPurchaseCommand and ProcessCardFeeCommand gain IReadOnlyDictionary<string, string>? PricingAttributes = null (defaulted; every existing caller compiles; System.Text.Json keys survive the outbox). The refund and dispute commands do not.
// src/LedgerTM.Accounts/Application/Workflows/WorkflowInterpreter.cs — changed (D3), bite 2
// WorkflowDispatchContext is unchanged: ExternalSourceDispatcher.DispatchAsync takes pricingAttributes, binds price()/fee() through AccountGuardContextBuilder and merges the "pricing." properties into the dispatch's Properties (shipped with ADR-842's merchant sale).
// The interpreter binds price/fee with the attributes and declares the eight card keys as `$` parameters, camel-cased ($scheme, $cardType, $channel, $entryMode, $crossBorder, $currencyConversion, $originalCurrency, $dcc), bound to "" where the bag has no value;
// ExternalIntegrationsValidator lists the eight on the card sources (F10); AccountTypesSettingsValidator refuses an operation input of the same name (ACCOUNT_TYPE_INPUT_SHADOWS_PRICING_ATTRIBUTE). TransactionPosted.Properties gains "pricing.<key>" = StringValue (kebab key) on every leg of the dispatch.
// src/LedgerTM.Cards/Domain/CardTypesSettings.cs — changed (D4)
public string? Scheme { get; set; } // VocabularyKey.Pattern; the validator requires it on save (CARD_TYPE_SCHEME_REQUIRED, a malformed one CARD_TYPE_SCHEME_INVALID); existing rows carry null until edited; left out of the bag when empty; seeded "visa"
// src/LedgerTM.Cards/Application/Pricing/CardPricingAttributes.cs — new (D4), Cards-internal
internal static class CardPricingAttributes
{
public static IReadOnlyDictionary<string, string> For(CardType type, CardClearingItem line, CurrencyId accountCurrency, IsoCountryCode? domesticCountry); // the eight keys
public static IReadOnlyDictionary<string, string> For(CardType type); // scheme, card-type
}
// The clearing post passes line.FinalCurrency as accountCurrency, the currency the line posts in; the bag's `$` parameters are Accounts' CardPricing.With.
// channel: CardChannel in kebab-case (CardPresent → card-present), and "atm" also when line.Mcc is 6011; entry-mode likewise; cross-border: domesticCountry is null, or line.MerchantCountry does not parse as ISO 3166 alpha-2 (IsoCountryCode.TryParse), or equals it → no, else yes;
// currency-conversion: line.Dcc || line.OriginalCurrency == accountCurrency → no, else yes; original-currency: the ISO code lower-case; dcc: yes | no. Every value lower-case kebab.
// src/LedgerTM.Pricing/PriceLists/Application/Queries/GetPriceMatrix.cs — new (D6); GET /api/price/settings/price-lists/{listId}/price-matrix/{typeKey}, the endpoint and the query under one key
[PermissionKey("pricing.view-price-matrix")] public record GetPriceMatrixQuery(PriceListId PriceList, PriceTypeId PriceType) : IQuery<PriceMatrixView>; // unknown list or type → 404 (PRICE_LIST_UNKNOWN / PRICE_TYPE_UNKNOWN); a type the list does not price → 200, no rows; a deactivated type reads
public sealed record PriceMatrixView(PriceTypeId Type, string Label, PriceKind Kind, CurrencyId Currency, int MinorUnit, IReadOnlyList<PriceSelectorInfo> Selectors, IReadOnlyList<PriceMatrixRow> Rows); // the fallback series first, then by Specificity then selectors sorted by key; values by date
public sealed record PriceMatrixRow(IReadOnlyDictionary<string, string> Selectors, decimal? FromAmount, decimal? ToAmount, IReadOnlyList<PriceMatrixValue> Series); // a series is selectors + band
public sealed record PriceMatrixValue(DateOnly EffectiveDate, decimal Value, decimal? Minimum, decimal? Maximum, bool Retired);
// Template (D5) — PriceSettings.yaml, retail price list:
// priceTypes: card-currency-conversion-fee (Rate, selectors [currency-conversion: yes|no]), card-atm-fee (Rate, [cross-border: yes|no]); card-replacement-fee gains [card-type: debit|virtual-debit|single-account|credit]; card-cash-advance-fee gains [cross-border: yes|no]
// prices: card-currency-conversion-fee {} 0, { currency-conversion: yes } 0.0275; card-atm-fee {} 0.02 min 10, { cross-border: no } 0.02 min 10, { cross-border: yes } 0.03 min 60;
// card-replacement-fee {} 150 (as today), { card-type: credit } 0; card-cash-advance-fee {} 50 (as today), { cross-border: yes } 100
// AccountTypesSettings.yaml, every type carrying cardPurchase: CardCurrencyConversionFeeCharged (Fee; on CreditCard Dr Fees, Dr Outstanding, costOfCreditCategory Fee, taxed as CashAdvanceFeeCharged); the deposit types: CardAtmFeeCharged (Fee);
// card-purchase gains, after the purchase leg and before any payment allocation: whenCondition price('card-currency-conversion-fee', valueDate, $amount) > 0 → CardCurrencyConversionFeeCharged fee('card-currency-conversion-fee', valueDate, $amount);
// deposit types only: whenCondition $channel == 'atm' → CardAtmFeeCharged fee('card-atm-fee', valueDate, $amount) (the credit card's cash-advance row stands)
// CardTypesSettings.yaml: scheme: visa on every type, ADR-838's credit type included (the demo customer's credit card is of that type)
Bites
| Bite | Description | Acceptance criterion | Status |
|---|---|---|---|
| 1 | The attribute-banded price: Price selectors, band, floor, cap and retire, PriceTypeEntry selectors with values, PriceContext and PriceQuote with its fee, the lookup with specificity and the series rule, the settings refusals on the aggregate, the dated override (F-1796) and the waived-row refusal, the YAML round-trip, price(type, valueDate, amount) and fee() |
a price is chosen by its selectors and its band, dated; an undeclared selector, a floor on an amount row and a tie are refused; an override applies from its date and never to a waived row | Done |
| 2 | The card attributes: CardType.Scheme, the eight attributes on every purchase posting, the $ parameters and pricing. properties, the four card fees priced by attribute in the retail template, the purchase workflow’s currency-conversion and ATM fee rows, the fixture |
a cross-currency purchase charges the conversion fee and a domestic one nothing; an ATM withdrawal charges the fee cross-border and at home; a replaced credit card is charged nothing and a debit card 150 without a code change; a customer’s override applies to the row chosen | Done |
| 3 | The matrix on the price list page, the override dialog’s kind, the card types’ scheme on their settings page, the probe, the guide articles, the register row | a type’s rows read as a matrix and a new row is entered by its selectors | Done |
Scenarios
Feature: a price is chosen by the attributes of the thing being priced
# Bite 1
Scenario: a price is chosen by its selectors and its band, dated
Given a price type declaring the selectors region (home, abroad) and channel (atm, online), with rows: no selectors 10; region abroad 60; region abroad and channel atm 75 from 1 March; region home for amounts 0 to 2 000, 8
When an abroad ATM price is read on 15 March, an abroad online price, a home price for 500, a home price for 2 000, a home price with no amount, and an abroad ATM price on 1 February
Then they are 75, 60, 8, 10, 10 and 60
And the most specific matching row wins, a band counts toward specificity, the band includes its bottom and excludes its top, a banded row needs an amount, and a row dated after the value date is not seen
And a rate row of 2% with a floor of 10 and a cap of 100 quotes 10 on 200, 50.77 on 2 538.25, and 100 on 10 000, half-up to the cent, and quotes 0 on an amount of 0 or when the rate is 0
And a three-argument read of an unbanded type equals the two-argument read, a fee read of an amount row is its value on any amount above zero, and a series retired from 1 April falls through to the next row from that date
# Seen at: route:/settings/price-lists
# Bite 1
Scenario: an undeclared selector, a floor on an amount row and a tie are refused
Given a price type declaring the selector region with the values home and abroad
When a row naming the selector channel is saved, a row with region abroad is saved twice on one date, and the type is given a second selector with rows region abroad and channel atm that both match one context
Then the first is refused naming the selector, the second replaces the first as an edit, and the third is refused as a tie naming both rows
And a row with the value Abroad is refused as malformed and a row with the value overseas as undeclared, a selected row on a list with no fallback row of its type is refused, a row of 0 is accepted, and a floor on an amount row is refused
And a dated change in one series is not a tie, bands 0 to 1 000 and 1 000 upward are not a tie, removing a selected row leaves the fallback, and dropping a selector key or value a row still names is refused
And the rows survive the template's export and import with their selectors, bands, floors, caps and retirements, a card-type key included
# Seen at: route:/settings/price-lists
# Bite 1
Scenario: an override applies from its date and never to a waived row
Given an account whose price list prices a fee at 100 and waives another at 0
When an override of 50 on the first is dated the 10th, and an override on the waived fee is attempted
Then a read on the 9th is 100 and on the 10th is 50, and the override on the waived fee is refused
And a percentage discount leaves the waived fee at 0
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: a cross-currency purchase charges the conversion fee and a domestic one nothing
Given the demo customer's credit card and a currency-conversion fee of 2.75% where the currency was converted
When a 100 USD purchase clears billed 1 850.00, a 500 domestic purchase clears, and a 100 USD purchase billed in rand by the merchant clears
Then the first posts a currency-conversion fee of 50.88 and the other two post no fee
And the fee posting records that it was priced for a converted currency, and a purchase posted with no attributes at all posts and charges nothing
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: an ATM withdrawal charges the fee cross-border and at home
Given a debit card on a current account, a home ATM fee of 2% with a floor of 10, and a cross-border ATM fee of 3% with a floor of 60
When 200 is withdrawn at home, 3 000 at home, and 90 GBP billed 2 000 abroad
Then the ATM fees are 10, 60 and 60, and the withdrawal abroad also pays the currency-conversion fee of 55
And the same withdrawal abroad on the credit card pays the cross-border cash-advance fee of 100 and the conversion fee, and no ATM fee
And a withdrawal whose line names merchant category 6011 at a card-present terminal charges the ATM fee, and one whose merchant country the processor sent malformed charges the home fee
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: a replaced credit card is charged nothing and a debit card 150 without a code change
Given a replacement fee of 150 as the fallback and 0 for the credit card type
When a credit card and a debit card are each reported stolen and replaced
Then the credit card's account is charged nothing and the debit card's 150
# Seen at: route:/accounts/{id}
# Bite 2
Scenario: a customer's override applies to the row chosen
Given a customer whose pricing plan overrides the currency-conversion fee to 1% from the 3rd
When a 100 USD purchase dated the 1st clears on the 5th billed 1 850.00, another dated the 4th clears billed 1 850.00, and a 500 domestic purchase clears
Then the first pays the list rate, the second 18.50, and the domestic purchase still charges nothing
# Seen at: route:/accounts/{id}
# Bite 3
Scenario: a type's rows read as a matrix and a new row is entered by its selectors
Given the retail price list's ATM fee rows
When an operator adds the selector channel with its values to the type and a row for cross-border and ATM
Then the type reads as a matrix with the fallback first, a column per selector and the band, and the new row sits in it with its value, floor and cap
# Seen at: route:/settings/price-lists
Scenario → test
| Scenario | Bite | Project | Class | Method | Probe |
|---|---|---|---|---|---|
| a price is chosen by its selectors and its band, dated | 1 | LedgerTM.Tests.Unit |
AttributeBandedPriceTests |
a_price_is_chosen_by_its_selectors_and_its_band_dated |
— |
| an undeclared selector, a floor on an amount row and a tie are refused | 1 | LedgerTM.Tests.Component |
PriceSelectorSettingsTests |
an_undeclared_selector_a_floor_on_an_amount_row_and_a_tie_are_refused |
— refusal |
| an override applies from its date and never to a waived row | 1 | LedgerTM.Tests.Component |
PriceSelectorSettingsTests |
an_override_applies_from_its_date_and_never_to_a_waived_row |
— |
| a cross-currency purchase charges the conversion fee and a domestic one nothing | 2 | LedgerTM.Tests.Component |
CardFeePricingTests |
a_cross_currency_purchase_charges_the_conversion_fee_and_a_domestic_one_nothing |
adr-841-server-probe.ts |
| an ATM withdrawal charges the fee cross-border and at home | 2 | LedgerTM.Tests.Component |
CardFeePricingTests |
an_atm_withdrawal_charges_the_fee_cross_border_and_at_home |
adr-841-server-probe.ts |
| a replaced credit card is charged nothing and a debit card 150 without a code change | 2 | LedgerTM.Tests.Component |
CardFeePricingTests |
a_replaced_credit_card_is_charged_nothing_and_a_debit_card_150_without_a_code_change |
adr-841-server-probe.ts |
| a customer’s override applies to the row chosen | 2 | LedgerTM.Tests.Component |
CardFeePricingTests |
a_customers_override_applies_to_the_row_chosen |
— |
| a type’s rows read as a matrix and a new row is entered by its selectors | 3 | LedgerTM.Tests.Component |
PriceMatrixViewTests |
a_types_rows_read_as_a_matrix_and_a_new_row_is_entered_by_its_selectors |
adr-841-server-probe.ts |
The bite 1 unit test drives PriceList.Quote and PriceQuote.FeeFor directly, with one ExpressionEvaluator line per scripting arity. Reachability: the bite 3 query is dispatched by PriceMatrixViewTests; the settings commands by PriceSelectorSettingsTests; AccountValuationPriceLookupTests guards the adapter.
UI-surface sweep
Swept src/ui-apps/bank/src for ChangePrice, AddPriceType, EditPriceType, priceType,
priceLists, price-lists, PriceSettings, selectors, fromAmount:
features/settings/forms/add-price-form.tsx,edit-price-form.tsx— the price row forms; gain selector pickers (one per declared key) and the band.features/settings/forms/add-price-type-form.tsx,edit-price-type-form.tsx— gain the selector keys.features/settings/registry.ts:8-46,components/price-type-cell.tsx,hooks/price-types.ts— the price list page’s wiring; the matrix component is added beside them.features/accounts/shared/panels/pricing-panel.tsx,dialogs/override-price-dialog.tsx— the per-account override; unchanged (an override covers every band, D3), but its label should say so.features/entity-types/card-types.tsx— gainsScheme.components/input/price-list-field.tsx,features/accounts/create/*— pick a price list; unchanged.settings-class-map.ts:4—"price-lists": "PriceSettings"; unchanged.- Permission keys:
pricing.view-price-matrixlands inpermissions.generated.tsthrough the catalog.
Footprint
Feature projects touched: 7 — LedgerTM.Accounts, LedgerTM.Cards, LedgerTM.Contracts, LedgerTM.Pricing, LedgerTM.Scripting, LedgerTM.Seeding.Provisioning, ui-apps
LedgerTM.Accounts— 6 changed, 0 newLedgerTM.Cards— 3 changed, 0 newLedgerTM.Contracts— 4 changed, 0 newLedgerTM.Pricing— 11 changed, 0 newLedgerTM.Scripting— 2 changed, 0 newLedgerTM.Seeding.Provisioning— 5 changed, 0 newui-apps— 4 changed, 0 new Files: 91 named, 77 code, 4 config
Contracts types: 28 named, 20 changed by this ADR
Price— fan-in 7, changed (LedgerTM.Accounts, LedgerTM.Infrastructure.Contracts, LedgerTM.Metering, LedgerTM.Payments, LedgerTM.Pricing, LedgerTM.Seeding.Provisioning, ui-apps)IPriceProviderResolver— fan-in 6, referenced (LedgerTM.Accounts, LedgerTM.Audit, LedgerTM.Contracts, LedgerTM.Hosting, LedgerTM.Payments, LedgerTM.Pricing)PriceTypeId— fan-in 6, referenced (LedgerTM.Accounts, LedgerTM.Contracts, LedgerTM.Metering, LedgerTM.Payments, LedgerTM.Pricing, LedgerTM.Seeding.Provisioning)IPriceTypeCatalog— fan-in 4, changed (LedgerTM.Contracts, LedgerTM.Metering, LedgerTM.Payments, LedgerTM.Pricing)PriceKind— fan-in 4, referenced (LedgerTM.Contracts, LedgerTM.Pricing, LedgerTM.Seeding.Provisioning, ui-apps)PriceListId— fan-in 4, referenced (LedgerTM.Accounts, LedgerTM.Contracts, LedgerTM.Pricing, LedgerTM.Seeding.Provisioning)CardType— fan-in 3, changed (LedgerTM.Cards, LedgerTM.Seeding.Provisioning, ui-apps)IPriceProvider— fan-in 3, changed (LedgerTM.Accounts, LedgerTM.Contracts, LedgerTM.Pricing)PriceTypeEntry— fan-in 3, changed (LedgerTM.Contracts, LedgerTM.Pricing, LedgerTM.Seeding.Provisioning)AmendCardTypesCommand— fan-in 2, referenced (LedgerTM.Cards, ui-apps)CardChannel— fan-in 2, referenced (LedgerTM.Cards, LedgerTM.Contracts)CardClearingItem— fan-in 2, referenced (LedgerTM.Cards, LedgerTM.Contracts)CardEntryMode— fan-in 2, referenced (LedgerTM.Cards, LedgerTM.Contracts)ExpressionPriceProvider— fan-in 2, changed (LedgerTM.Accounts, LedgerTM.Scripting)PriceTypeInfo— fan-in 2, changed (LedgerTM.Contracts, LedgerTM.Pricing)AddPriceTypeCommand— fan-in 1, changed (LedgerTM.Pricing)ChangePriceCommand— fan-in 1, changed (LedgerTM.Pricing)EditPriceTypeCommand— fan-in 1, changed (LedgerTM.Pricing)PriceAdjustment— fan-in 1, changed (LedgerTM.Pricing)RemovePriceCommand— fan-in 1, changed (LedgerTM.Pricing)GetPriceMatrixQuery— fan-in 0, changedPriceContext— fan-in 0, changedPriceMatrixRow— fan-in 0, changedPriceMatrixValue— fan-in 0, changedPriceMatrixView— fan-in 0, changedPriceQuote— fan-in 0, changedPriceSelector— fan-in 0, changedPriceSelectorInfo— fan-in 0, changed
Files reading each changed type: 20 types
AddPriceTypeCommand— 4 filesLedgerTM.Tests.Component/Metering/MeteringComponentFixture.csLedgerTM.Tests.Component/ServiceEnrolment/AddServiceTests.csLedgerTM.Tests.Component/ServiceEnrolment/ServiceEnrolmentComponentFixture.cssrc/LedgerTM.Pricing/PriceLists/Application/Settings/PriceTypes/AddPriceType.cs
CardType— 12 filesLedgerTM.Tests.Component/Cards/CardControlsAndFundingTests.csLedgerTM.Tests.Component/Cards/CardTypesSettingsTests.csLedgerTM.Tests.Component/Cards/CardsComponentFixture.csLedgerTM.Tests.Component/Cards/IssueCardTests.cssrc/LedgerTM.Cards/Application/Queries/GetCardTypes.cssrc/LedgerTM.Cards/Application/Settings/AmendCardTypes.cssrc/LedgerTM.Cards/Domain/CardFundingRuleCheck.cssrc/LedgerTM.Cards/Domain/CardTypesSettings.cssrc/LedgerTM.Seeding.Provisioning/PackageImporter.cssrc/ui-apps/bank/src/features/cards/hooks/card-types.tssrc/ui-apps/bank/src/features/entity-types/card-types.tsxsrc/ui-apps/bank/src/lib/api.ts
ChangePriceCommand— 1 filessrc/LedgerTM.Pricing/PriceLists/Application/Settings/Prices/ChangePrice.cs
EditPriceTypeCommand— 1 filessrc/LedgerTM.Pricing/PriceLists/Application/Settings/PriceTypes/EditPriceType.cs
ExpressionPriceProvider— 7 filesLedgerTM.Scripting.Tests.Unit/ExpressionPriceProviderTests.csLedgerTM.Tests.Architecture/Pricing/DatedLookupDefaultTests.csLedgerTM.Tests.Architecture/Pricing/dated-lookup-allowlist.txtsrc/LedgerTM.Accounts/Application/Operations/AccountGuardContextBuilder.cssrc/LedgerTM.Accounts/Domain/Valuation/AccountValuation.cssrc/LedgerTM.Scripting/Evaluation/ExpressionEvaluator.cssrc/LedgerTM.Scripting/Evaluation/ExpressionPriceProvider.cs
GetPriceMatrixQuery— 0 filesIPriceProvider— 37 filesLedgerTM.Testing.Infrastructure/Stubs/AccountServiceStubs.csLedgerTM.Tests.Architecture/Pricing/DatedLookupDefaultTests.csLedgerTM.Tests.Component/Pricing/PriceRefusalTests.csLedgerTM.Tests.Component/Seeding/InstalmentPreviewTests.csLedgerTM.Tests.Component/Seeding/RegulatoryLimitSeedAdvisoryTests.csLedgerTM.Tests.Unit/Accounts/Configuration/RegulatoryLimitAdvisoryValidatorTests.csLedgerTM.Tests.Unit/Accounts/Operations/InheritedInputRailPinTests.csLedgerTM.Tests.Unit/Accounts/Operations/NoticeEarlyWithdrawalTests.csLedgerTM.Tests.Unit/Accounts/Operations/ZaRetailPayoutMigrationTests.csLedgerTM.Tests.Unit/Accounts/RegulatoryLimitAdvisorySkipTests.csLedgerTM.Tests.Unit/Accounts/Valuation/AccountValuationPriceLookupTests.csLedgerTM.Tests.Unit/Accounts/Valuation/InstalmentSolverGoldenTests.csLedgerTM.Tests.Unit/Accounts/Valuation/InstalmentSolverPerformanceTests.csLedgerTM.Tests.Unit/Accounts/Valuation/InstalmentSolverScenarios.csLedgerTM.Tests.Unit/Payments/Settlement/RailFeeResolutionTests.cssrc/LedgerTM.Accounts/Application/Commands/CreateAccount.cssrc/LedgerTM.Accounts/Application/Commands/ProcessToDate.cssrc/LedgerTM.Accounts/Application/Commands/RevalueAccount.cssrc/LedgerTM.Accounts/Application/DayEnd/ProvisionRecomputeStep.cssrc/LedgerTM.Accounts/Application/Designer/DesignerForecast.cssrc/LedgerTM.Accounts/Application/Limits/RegulatoryLimitAdvisoryValidator.cssrc/LedgerTM.Accounts/Application/Operations/AccountGuardContextBuilder.cssrc/LedgerTM.Accounts/Application/Operations/OperationAvailabilityEndpoint.cssrc/LedgerTM.Accounts/Application/Operations/OperationInterpreter.cssrc/LedgerTM.Accounts/Application/Operations/OperationPreflightGuard.cssrc/LedgerTM.Accounts/Application/Queries/ForecastAccount.cssrc/LedgerTM.Accounts/Application/Services/ConsequenceResolver.cssrc/LedgerTM.Accounts/Application/Services/InstalmentRecalculator.cssrc/LedgerTM.Accounts/Application/Services/RateChangeConsequenceComputer.cssrc/LedgerTM.Accounts/Domain/Valuation/AccountValuation.cssrc/LedgerTM.Contracts/Pricing/PriceLists/IPriceProvider.cssrc/LedgerTM.Contracts/Pricing/PricingPlans/GetTransientPriceProviderQuery.cssrc/LedgerTM.Contracts/Pricing/PricingPlans/IPriceProviderResolver.cssrc/LedgerTM.Pricing/PricingPlans/Application/Factories/PriceProvider.cssrc/LedgerTM.Pricing/PricingPlans/Application/Factories/PriceProviderFactory.cssrc/LedgerTM.Pricing/PricingPlans/Application/Factories/PriceProviderResolver.cssrc/LedgerTM.Pricing/PricingPlans/Application/Queries/GetTransientPriceProviderQueryHandler.cs
IPriceTypeCatalog— 8 filesLedgerTM.Tests.Component/Metering/AddChargeableMetricTests.cssrc/LedgerTM.Contracts/Pricing/PriceLists/IPriceTypeCatalog.cssrc/LedgerTM.Metering/Application/Settings/AddChargeableMetric.cssrc/LedgerTM.Metering/Application/Settings/UpdateChargeableMetric.cssrc/LedgerTM.Payments/Settlement/Application/Settings/AddSettlementRail.cssrc/LedgerTM.Payments/Settlement/Application/Settings/EditSettlementRail.cssrc/LedgerTM.Pricing/Bootstrapper.cssrc/LedgerTM.Pricing/PriceLists/Application/Factories/PriceTypeCatalog.cs
Price— 55 filesLedgerTM.Tests.Architecture/VocabularyReferenceTypingTests.csLedgerTM.Tests.Unit/Accounts/Application/RequiredAccountPropertiesGuardTests.csLedgerTM.Tests.Unit/Accounts/Valuation/OpeningTransactionTriggerTests.cssrc/LedgerTM.Accounts/Application/Commands/CreateAccount.cssrc/LedgerTM.Infrastructure.Contracts/Features/FeatureCatalog.cssrc/LedgerTM.Infrastructure.Contracts/JsonConversion/StrongIdJsonConverterFactory.cssrc/LedgerTM.Metering/Application/Settings/AddChargeableMetric.cssrc/LedgerTM.Payments/Settlement/Application/Settings/AddSettlementRail.cssrc/LedgerTM.Pricing/PriceLists/Application/EventLabels/PriceListEventLabelResolver.cssrc/LedgerTM.Pricing/PriceLists/Application/Settings/PriceLists/EditPriceList.cssrc/LedgerTM.Pricing/PriceLists/Application/Settings/PriceTypes/DeactivatePriceType.cssrc/LedgerTM.Pricing/PriceLists/Application/Settings/PriceTypes/EditPriceType.cssrc/LedgerTM.Pricing/PriceLists/Application/Settings/Prices/ChangePrice.cssrc/LedgerTM.Pricing/PriceLists/Application/Settings/Prices/RemovePrice.cssrc/LedgerTM.Pricing/PriceLists/Domain/Price.cssrc/LedgerTM.Pricing/PriceLists/Domain/PriceList.cssrc/LedgerTM.Pricing/PriceLists/Domain/PriceSettings.cssrc/LedgerTM.Pricing/PriceLists/Domain/UnknownPriceListException.cssrc/LedgerTM.Pricing/PriceLists/Domain/UnknownPriceTypeException.cssrc/LedgerTM.Pricing/PriceLists/Domain/UnpricedOnDateException.cssrc/LedgerTM.Pricing/PricingPlans/Application/Commands/AdjustPrice.cssrc/LedgerTM.Pricing/ReferenceDataChange/Domain/ReferenceDataChangeRun.cssrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/investment-house/AccountTypesSettings.yamlsrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/personal-lender/AccountTypesSettings.yamlsrc/LedgerTM.Seeding.Provisioning/tenant-templates/packages/retail-bank/AccountTypesSettings.yamlsrc/ui-apps/bank/src/__tests__/components/input/price-list-field.test.tsxsrc/ui-apps/bank/src/__tests__/features/settings/chargeable-metrics.test.tsxsrc/ui-apps/bank/src/__tests__/features/settings/refused-write.test.tsxsrc/ui-apps/bank/src/__tests__/features/settings/settings-list-tabs.test.tsxsrc/ui-apps/bank/src/__tests__/fixtures/type-catalogs.za-retail.jsonsrc/ui-apps/bank/src/features/accounts/shared/dialogs/cancel-override-dialog.tsxsrc/ui-apps/bank/src/features/accounts/shared/dialogs/change-price-list-dialog.tsxsrc/ui-apps/bank/src/features/accounts/shared/dialogs/discount-price-dialog.tsxsrc/ui-apps/bank/src/features/accounts/shared/dialogs/markup-price-dialog.tsxsrc/ui-apps/bank/src/features/accounts/shared/dialogs/override-price-dialog.tsxsrc/ui-apps/bank/src/features/accounts/shared/panels/pricing-panel.tsxsrc/ui-apps/bank/src/features/back-office/back-office-groups.tssrc/ui-apps/bank/src/features/reference-data-changes/reference-data-change-list.tsxsrc/ui-apps/bank/src/features/service-enrolment/enrolments/amend-enrolment-drawer.tsxsrc/ui-apps/bank/src/features/service-enrolment/enrolments/service-enrolments-panel.tsxsrc/ui-apps/bank/src/features/settings/category-leaves.tssrc/ui-apps/bank/src/features/settings/category-taxonomy.tssrc/ui-apps/bank/src/features/settings/forms/add-price-form.tsxsrc/ui-apps/bank/src/features/settings/forms/add-price-list-form.tsxsrc/ui-apps/bank/src/features/settings/forms/add-price-type-form.tsxsrc/ui-apps/bank/src/features/settings/forms/chargeable-metric-form.tsxsrc/ui-apps/bank/src/features/settings/forms/edit-price-form.tsxsrc/ui-apps/bank/src/features/settings/forms/edit-price-list-form.tsxsrc/ui-apps/bank/src/features/settings/forms/edit-price-type-form.tsxsrc/ui-apps/bank/src/features/settings/forms/service-price-editor.tsxsrc/ui-apps/bank/src/features/settings/forms/settlement-rail-fields.tsxsrc/ui-apps/bank/src/features/settings/registry.tssrc/ui-apps/bank/src/features/settings/selectors/price-list-selector.tsxsrc/ui-apps/bank/ui-review/adr-uat/flows/adr-168-client-probe.tssrc/ui-apps/bank/ui-review/adr-uat/flows/adr-256-client-probe.ts
PriceAdjustment— 4 filesLedgerTM.Tests.Unit/Pricing/PriceAdjustmentTests.cssrc/LedgerTM.Pricing/PricingPlans/Application/Projections/PricingPlanReadModel.cssrc/LedgerTM.Pricing/PricingPlans/Domain/PriceAdjustment.cssrc/LedgerTM.Pricing/PricingPlans/Domain/PricingPlan.cs
PriceContext— 0 filesPriceMatrixRow— 0 filesPriceMatrixValue— 0 filesPriceMatrixView— 0 filesPriceQuote— 0 filesPriceSelector— 0 filesPriceSelectorInfo— 0 filesPriceTypeEntry— 8 filesLedgerTM.Tests.Architecture/VocabularyRowIdTests.csLedgerTM.Tests.Unit/Infrastructure/Configuration/VocabularyRowIdIsDerivedTests.csLedgerTM.Tests.Unit/Pricing/PriceTypeIdentityTests.cssrc/LedgerTM.Contracts/Pricing/PriceLists/PriceTypeId.cssrc/LedgerTM.Pricing/PriceLists/Application/Settings/PriceTypes/ListPriceTypes.cssrc/LedgerTM.Pricing/PriceLists/Domain/PriceSettings.cssrc/LedgerTM.Pricing/PriceLists/Domain/PriceTypeEntry.cssrc/LedgerTM.Seeding.Provisioning/tenant-templates/countries/za/SettlementRailSettings.yaml
PriceTypeInfo— 2 filessrc/LedgerTM.Contracts/Pricing/PriceLists/IPriceTypeCatalog.cssrc/LedgerTM.Pricing/PriceLists/Application/Factories/PriceTypeCatalog.cs
RemovePriceCommand— 1 filessrc/LedgerTM.Pricing/PriceLists/Application/Settings/Prices/RemovePrice.csImplementations of changed types: 22
AddPriceTypeCommand— 1:AddPriceTypeCommandValidator(src/LedgerTM.Pricing/PriceLists/Application/Settings/PriceTypes/AddPriceType.cs)CardType— 1:GetCardTypesQuery(src/LedgerTM.Cards/Application/Queries/GetCardTypes.cs)ChangePriceCommand— 1:ChangePriceCommandValidator(src/LedgerTM.Pricing/PriceLists/Application/Settings/Prices/ChangePrice.cs)EditPriceTypeCommand— 1:EditPriceTypeCommandValidator(src/LedgerTM.Pricing/PriceLists/Application/Settings/PriceTypes/EditPriceType.cs)IPriceProvider— 13:FakePriceProvider(LedgerTM.Tests.Unit/Accounts/Valuation/AccountValuationPriceLookupTests.cs),FixedPriceProvider(LedgerTM.Tests.Unit/Accounts/Valuation/InstalmentSolverPerformanceTests.cs),GetTransientPriceProviderQuery(src/LedgerTM.Contracts/Pricing/PricingPlans/GetTransientPriceProviderQuery.cs),ListBackedProvider(LedgerTM.Tests.Unit/Accounts/Valuation/AccountValuationPriceLookupTests.cs),OnePercentFeePriceProvider(LedgerTM.Tests.Unit/Accounts/Operations/InheritedInputRailPinTests.cs),OnePercentFeePriceProvider(LedgerTM.Tests.Unit/Accounts/Operations/NoticeEarlyWithdrawalTests.cs),OnePercentFeePriceProvider(LedgerTM.Tests.Unit/Accounts/Operations/ZaRetailPayoutMigrationTests.cs),PriceList(LedgerTM.Tests.Unit/Accounts/Configuration/RegulatoryLimitAdvisoryValidatorTests.cs),PriceProvider(src/LedgerTM.Pricing/PricingPlans/Application/Factories/PriceProvider.cs),RefusingPriceList(LedgerTM.Tests.Unit/Accounts/RegulatoryLimitAdvisorySkipTests.cs),SeededPriceList(LedgerTM.Tests.Component/Seeding/RegulatoryLimitSeedAdvisoryTests.cs),StubPrice(LedgerTM.Tests.Component/Seeding/InstalmentPreviewTests.cs),StubPriceProvider(LedgerTM.Tests.Unit/Payments/Settlement/RailFeeResolutionTests.cs)IPriceTypeCatalog— 1:PriceTypeCatalog(src/LedgerTM.Pricing/PriceLists/Application/Factories/PriceTypeCatalog.cs)Price— 3:UnknownPriceListException(src/LedgerTM.Pricing/PriceLists/Domain/UnknownPriceListException.cs),UnknownPriceTypeException(src/LedgerTM.Pricing/PriceLists/Domain/UnknownPriceTypeException.cs),UnpricedOnDateException(src/LedgerTM.Pricing/PriceLists/Domain/UnpricedOnDateException.cs)RemovePriceCommand— 1:RemovePriceCommandValidator(src/LedgerTM.Pricing/PriceLists/Application/Settings/Prices/RemovePrice.cs) Files reading a touched file by path: 5ExpressionEvaluator.cs—src/_creditplus/docs/archive/options/option-1/architecture.md,src/_creditplus/docs/superpowers/plans/2026-03-14-rook-phase1-foundation.mdPackageExporter.cs—LedgerTM.Tests.Component/Currencies/ExchangeRateProvisioningTests.csdocs/standards/README.md—LedgerTM.Tests.Component/Seeding/StandardsRegisterPinTests.cs,LedgerTM.Tests.Unit/Payments/ExternalAccounts/ExternalAccountProxyTests.cs,src/LedgerTM.Payments/ExternalAccounts/Domain/ProxyKinds.cs,src/LedgerTM.Payments/Submissions/Channels/Bacs/Format/BacsAdviceFileFormat.cs,src/LedgerTM.Payments/Submissions/Channels/Bacs/Format/Standard18FileFormat.cs,src/LedgerTM.Payments/Submissions/Channels/Bacs/README.md,src/LedgerTM.Payments/Submissions/Channels/BankservAfrica/BankservAfricaReturnReasons.cs,src/LedgerTM.Payments/Submissions/Channels/BankservAfrica/Format/BankservAfricaReturnFileFormat.cslib/api.ts—LedgerTM.Tests.Component/Books/CostCentreOperationAvailabilityTests.cs,src/LedgerTM.Accounts/Application/Queries/GetAccountDetail.cs,src/_creditplus/docs/architecture-overview.md,src/_creditplus/docs/superpowers/plans/2026-03-15-phase2-multitenancy-auth.md,src/_creditplus/docs/superpowers/plans/2026-03-15-phase3-ui-commands-batch.md,src/_creditplus/docs/superpowers/plans/2026-03-17-data-init-saga-workers.md,src/_creditplus/docs/superpowers/plans/2026-03-18-ui-phase2-account-config-counterparties.md,src/_creditplus/docs/superpowers/plans/2026-03-20-accounttype-crud-complete-fields.md,src/_creditplus/docs/superpowers/plans/2026-03-20-ui-polish-crud-validation.md,src/_creditplus/docs/superpowers/specs/2026-03-19-openapi-typescript-pipeline-design.md,src/ui-apps/bank/src/__tests__/field-kind-coverage-guard.test.ts,src/ui-apps/bank/src/__tests__/lib/api-no-drift.test.ts,src/ui-apps/bank/src/__tests__/window-location-guard.test.ts,src/ui-apps/bank/src/lib/api.ts,src/ui-apps/bank/src/lib/dev-act-as.tssrc/LedgerTM.Accounts/Domain/Valuation/AccountValuation.cs—LedgerTM.Tests.Architecture/EvaluationContextConstructionSiteTests.cs
Domain events touched: 0 Aggregates touched: 0
Methods at CRAP 30+ in changed files: 7 (unit coverage at main 413bc4524)
LedgerTM.Accounts.Domain.Valuation.AccountValuation.Brent— CRAP 812, complexity 28, 0% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csLedgerTM.Accounts.Application.Commands.ExternalSourceDispatcher.BuildEvaluationContext— CRAP 506, complexity 22, 0% covered —src/LedgerTM.Accounts/Application/Commands/ProcessExternalSourcePaymentHandlers.csExternalSourceDispatcher.DispatchAsync— CRAP 420, complexity 20, 0% covered —src/LedgerTM.Accounts/Application/Commands/ProcessExternalSourcePaymentHandlers.csLedgerTM.Accounts.Domain.Valuation.AccountValuation.RunSecant— CRAP 57, complexity 56, 95% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csLedgerTM.Accounts.Domain.Valuation.AccountValuation.BuildContext— CRAP 46, complexity 46, 94% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csLedgerTM.Accounts.Domain.Valuation.AccountValuation.SolveInstalment— CRAP 45, complexity 24, 67% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csLedgerTM.Accounts.Domain.Valuation.AccountValuation.ProcessScheduledTransactions— CRAP 32, complexity 32, 100% covered —src/LedgerTM.Accounts/Domain/Valuation/AccountValuation.csPermission keys to add: 6 — add-price-type, amend-card-types, change-price, edit-price-type, remove-price, get-price-matrix-query
Warnings
Priceis changed and read by 7 projects — name the seam in the ADR.IPriceTypeCatalogis changed and read by 4 projects — name the seam in the ADR.PriceTypeEntryis changed and read by 3 projects — name the seam in the ADR.IPriceProvideris changed and read by 3 projects — name the seam in the ADR.CardTypeis changed and read by 3 projects — name the seam in the ADR.LedgerTM.Accounts.Domain.Valuation.AccountValuation.Brentis at CRAP 812 (and 4 more in that file) — write its test before the bite edits it, and name the test in the plan.LedgerTM.Accounts.Application.Commands.ExternalSourceDispatcher.BuildEvaluationContextis at CRAP 506 (and 1 more in that file) — write its test before the bite edits it, and name the test in the plan.- 7 feature projects touched — say why this is not two ADRs.
At land: 21 files touched, 91 predicted, 7 unplanned. LedgerTM.Tests.Architecture/ShapeGate/stored-shapes.tsv, LedgerTM.Tests.Unit/Seeding/preset-snapshots.txt, src/LedgerTM.Cards/Application/Commands/ChargeCardFee.cs, src/LedgerTM.Cards/Application/DayEnd/PostCardClearingBatch.cs, src/LedgerTM.Cards/Application/Settings/AmendCardTypes.cs, src/LedgerTM.Seeding.Provisioning/tenant-templates/countries/gb/retail-bank/PriceSettings.yaml, src/LedgerTM.Seeding.Provisioning/tenant-templates/countries/za/retail-bank/PriceSettings.yaml
Land batches
Two lands, with a recorded reason: batch A, bites 1 and 3 — the shape, the lookup, fee() and
the matrix are demonstrable alone and are the contract the merchant settlement ADR builds its
merchant pricing on; batch B, bite 2 — after ADR-836, ADR-838, ADR-839 and ADR-840 land (F1),
since it edits their files. reseed: true on both.
Notes
- A row with no selectors and no band is today’s row, and the empty context is today’s lookup, so nothing seeded prices differently until a selected row is added.
- The bag’s keys and values are kebab-case and the validator enforces it on the type’s declared keys and values and on a row’s; a bag value that is not kebab-case never matches a row.
- Rounding is
PriceQuote.FeeFor’s: half-up to the list currency’s minor unit after the floor and cap, the unit from the tenant’s currency setting;price() * amountin a script rounds as the posting rounds today. - The credit card’s ATM fee is its cash-advance fee (F5); the template’s ATM fee rows are the
deposit types’.
channel: atmis one fact — the processor’s channel or merchant category 6011 — wherever a tenant branches on it; ADR-838 branches its cash advance on 6010/6011, which is the cash concept, not the ATM one. - A per-account override (
PricingPlan.OverridePrice) applies to the value of whichever row is chosen from its own date; a rate row’s floor and cap stay; no row, or a zero row → no override, and an override over a waived type is refused. Banded overrides are a later item if a tenant asks. - A bag with no value for a key records no
pricing.property for it. The fee leg is value-dated as the purchase line, which is what prices a back-dated line at its own date. - Fee rows follow the purchase leg in every workflow: a zero fee posts nothing, and a fee leg placed first would claim the dispatch id for nothing and let a redelivery double-post.
- Fixtures. The cards fixture’s types gain
scheme: visa; its price list gains the retail rows and is assigned to its accounts; the demo customer’s credit card is ADR-838’scredittype; a USD purchase line at 18.50 comes through ADR-836’s clearing post withOriginalCurrencyUSD, an ATM line withChannel: Atmand a merchant country; dates sit in a past month so a dated override passes its validator (F-1797 stands). - The guide article names ISO 4217 for the original-currency value, the selector vocabulary
as the tenant’s own, and lifts its numbers from
CardFeePricingTests.
Landing notes
- ADR-836, ADR-839:
ProcessCardPurchaseCommandandProcessCardFeeCommandgain a defaultedPricingAttributesparameter once ADR-841 bite 2 lands; their callers fill it fromCardPricingAttributes;ExternalIntegrationsValidator’s card sources list the eight keys. - ADR-838:
card-cash-advance-feegains thecross-borderselector; the credit card’s purchase workflow gains the conversion-fee row before its payment allocation; F-1799 (its one-argumentprice()) is ADR-838’s. - ADR-840: its dispute postings carry no bag; the auditor reads the line’s attributes on the purchase posting the dispute links to.
- Coordinator findings (F7): F-1796 the retroactive override (P1, fixed in bite 1), F-1797 the
wall-clock validator, F-1798 the advisory’s empty context, F-1799 ADR-838’s one-argument
price()(owned by ADR-838). - Landing note (coordinator, 2026-10-03): batch A (bites 1 and 3) builds beside ADR-840 (lane
cards-authorisation) and ADR-845 (lanecashier-management). It sharesAccountValuation.cswith ADR-840, andPackageModel.cs,PackageImporter.csandPackageExporter.cswith ADR-845; the second to land resolves them. Batch B (bite 2) waits for ADR-840 to land. - Decided:
Price.Specificity()andIsFallback()are methods, not the properties## Interfacesshows · rests on: a public getter on a Settings document is stored (StoredShapeGateTests) · wrong if:stored-shapes.tsvlists aSpecificityfield. - Decided: the waived-row refusal is
PriceSettings.RequireOverridable, called byOverridePriceCommandHandlerwithISettingsProviderbeside the plan; it also carriesPRICE_OVERRIDE_RATE_ABOVE_ONE· rests on: D3 · wrong if: an override dispatched in a nested system invoke meetsDefaultTenantUsageDisabledException. - Decided: a package with no
priceTypes(the gb overlays) enters its rows unchecked, as before, and the whole-list check still runs · rests on: the importer’s existing allowance · wrong if: a gb provision fails onPRICE_FALLBACK_REQUIRED. - Decided: bite 1’s tests are not measured against untouched code — they compile only against bite 1’s contracts, so they went green inside bite 1’s own commit;
[Measure]records bite 3’s · rests on: ADR-787 D5 · wrong if: a bite 1 criterion is found green before bite 1. - Bite 3’s tests were re-authored (phase B, Opus):
RowOfdid not compile (anoutvariable in an expression tree), and the clerk test asserted the matrix grant opens the price-row read, whichview.accountsguards. The correctedADR-841-tests/bite-3.cs.txtreplaces the original at land. Its red is compile-only: the tests nameGetPriceMatrixQuery, which bite 3 creates. - Decided: bite 3 leaves the card types’
Schemefield anddocs/guide/features/cards.md’s card fees to bite 2, which addsCardType.Schemeand the fees · rests on: the batch split (F1) · wrong if: batch B lands without them. - Decided: the matrix is an extra child tab (“Price Matrix”) on the price list page, reading live settings; a staged draft row shows in the Prices table but not in the matrix until published · rests on: D6 · wrong if: UAT expects the matrix to show draft rows.
- Bite 2’s tests were re-authored once (phase B, Opus): two types are named
PropertyValue—TransactionPostedcarriesInfrastructure.Contracts.Domain‘s, the test importedContracts.Properties’. The correctedADR-841-tests/bite-2.cs.txtreplaces the original at land. Its red was compile-only (CardType.Scheme,PricingAttributes), so it rode the bite commit, as bite 1’s did. - Decided: the selected card-fee rows sit on the retail Standard list only; Premium, Staff and Notice Deposit (za and gb) carry only the two new types’ fallbacks at 0 · rests on: D7, every existing fee prices as before · wrong if: UAT expects a Premium customer to pay the conversion or ATM fee.
- Decided: the rows live in
countries/za|gb/retail-bank/PriceSettings.yaml, where the price lists are;packages/retail-bank/PriceSettings.yamlcarries the types and selectors · rests on: the template’s layout · wrong if: the gb preset fails to compose. - Decided:
currency-conversioncompares the original currency with the line’s billed currency, the currency it posts in · rests on: D4 · wrong if: a line posts to an account in a currency other than itsFinalCurrency. - Decided: each fee row guards on
fee(...) > 0, and the ATM row nests under$channel == 'atm', so a zero fee posts no leg and an off-channel line never prices the ATM type · rests on: Notes, “a zero fee posts nothing” · wrong if: a statement shows a 0.00 fee leg. - Decided:
ACCOUNT_TYPE_INPUT_SHADOWS_PRICING_ATTRIBUTElives inExternalIntegrationsValidator, on the cardPurchase and cardFee workflows only, where the$parameters are bound · rests on: D3 · wrong if: a non-card operation’schannelinput is expected refused. - Decided: a scheme that is not a kebab key is refused as
CARD_TYPE_SCHEME_INVALID· rests on:## Interfaces, VocabularyKey.Pattern · wrong if: a caller expectsCARD_TYPE_SCHEME_REQUIREDfor it. - Decided: the dispute case fee posts with no bag · rests on: the ADR-840 landing note above · wrong if: an auditor expects
pricing.card-typeon a dispute fee. - Decided: the fixture’s own call-deposit type gains no conversion or ATM row; bite 2’s tests reach the rows through the composed CurrentAccount and CreditCard · rests on:
CardFeePricingTestsgreen · wrong if: a test onZarCallDepositexpects a conversion fee.