feat: currency-aware minor units (proper ISO 4217 scaling) #68
Labels
No labels
area:backend
area:frontend
area:infra
area:ocr
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
phase:M1
phase:M2
phase:M3
phase:M4
phase:M5
phase:M6
phase:M7
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
TJC/bill-splitter#68
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The system treats a minor unit as hundredths of the major unit everywhere, regardless of currency.
ReceiptParser.ToMinormultiplies whole units by 100 unconditionally, andBill,SplitCalculator, andMaxAmountMinorall follow that convention. This is wrong for currencies whose real minor unit is not 1/100:1000minor, not100000.1250minor, and the parser's\d{2}fraction regex can't even read them.The frontend money layer was matched to the backend's fixed-100 convention as a stopgap (PR #67) so display and entry are at least self-consistent. That is the right short-term call, but it means a JPY split shows
¥1,000.00semantics internally and the whole stack is quietly assuming 2-decimal money.Scope
Make minor-unit scaling currency-aware end to end:
ReceiptParser.ToMinor+ the money regex handle 0/2/3-decimal currencies from the detected currency.MaxAmountMinor/ validation bounds reason in the currency's own scale.SplitCalculatorlargest-remainder rounding is correct at each currency's minor unit.money.ts/moneyInput.tsscale by the currency's ISO fraction digits again (revert the fixed-100 stopgap from #67).Intl) so display and entry can't drift.docs/02-domain-model.md#moneyshould state the per-currency minor-unit rule.Non-goals
No currency conversion / FX. Each session stays in a single currency.
Context
Deferred from the #67 review. See the money-scale fix commit for the stopgap.