docs(18): amend D-09 to scale-4 int64 money after plan-count checkpoint
This commit is contained in:
@@ -43,6 +43,7 @@ Not in this phase: `Golem15.PaymentGatewaySubscriptions` and pgstripe's subscrip
|
||||
|
||||
### Money
|
||||
- **D-09:** **Money is `int64` minor units plus an ISO currency code**, a small value type that mirrors moneyphp (`Money::PLN(3984)`). It needs no new dependency. Arithmetic, allocation and rounding follow moneyphp's behavior, and the currency `ratio` (decimal 8,4) and NBP conversion use exact integer or `math/big` arithmetic, never floats. The researcher decides whether the type lives in the plugin or in `wire` (it goes in `wire` only if it's generic). — **Reversibility:** costly — every model, the cart and the consumer API take this type.
|
||||
- **Amended 2026-10-13 (plan-phase checkpoint, research A1/F-1/F-2):** the amount is a **scale-4 `int64`** (amount × 10 000, four decimal places for every currency, mirroring Keios MoneyRight's `GAAP_PRECISION = 4`), not minor units. Legacy sub-cent `*_amount_stored` values (for example `85.4193` from currency conversion) round-trip exactly; input with more than four decimals is a validation error, never rounded (A2). The rest of D-09 stands: ISO currency code, no new dependency, exact integer or `math/big` arithmetic, never floats.
|
||||
- **D-10:** **The `decimal(12,4)` / `decimal(10,4)` `*_amount_stored` columns are major units.** The Money type implements an exact `sql.Scanner`/`driver.Valuer` that parses and formats the decimal string with no float (PITFALLS.md #5). Values with more precision than the currency's minor unit are preserved or explicitly rejected, never silently rounded; the researcher checks what PHP actually writes. Unit tests cover the column ceiling and the edge cases.
|
||||
- **D-11:** **`cart` and `details` (`mediumText`, JMS-serializer JSON) are read in the legacy shape and written in a versioned Go shape.** The guardrails:
|
||||
1. New rows carry a format version marker (for example `"v": 2`).
|
||||
|
||||
Reference in New Issue
Block a user