Files
vmall/openspec/specs/currency/spec.md
T

24 lines
976 B
Markdown

# currency Specification
## Purpose
TBD - created by archiving change catalog-i18n-currency. Update Purpose after archive.
## Requirements
### Requirement: Currency registry
The system SHALL maintain a currencies table: ISO code, localized name, symbol, exponent (minor units), enabled flag, and `rate_to_base` (NUMERIC). Exactly one currency is the base.
#### Scenario: seeded currencies
- **WHEN** migrations finish
- **THEN** USD exists as base with rate 1, and CNY/EUR/JPY exist with positive rates
### Requirement: Amount conversion
`GET /api/currencies/convert` SHALL convert integer minor units between enabled currencies via base rates, rounding half-up to the target exponent.
#### Scenario: USD to JPY
- **WHEN** converting 1000 minor USD (=$10.00) to JPY with rate 150
- **THEN** the result is 1500 minor JPY (¥1500), an integer
#### Scenario: disabled currency rejected
- **WHEN** converting to a disabled or unknown currency
- **THEN** the API returns 400