Payment Total Concatenates Decimal String Amounts
Level 1 · node · Correctness · Missing amount type normalization
Scenario
A payment provider adapter returns approved amounts as decimal strings, and a settlement service calculates the approved total per order. A single approval or numeric fixtures look correct, but multiple real provider string amounts produce an abnormally large total. Adapter, service, and repository are separated.
Requirements
- Calculate approved payment amounts as a numeric total - Correctly handle decimal strings returned by the provider - Exclude declined payments from the total - Return 0 when an order has no payments - Do not mutate original payment records
Acceptance criteria
- Multiple numeric approved amounts are summed
- Multiple string approved amounts are summed numerically
- Only approved amounts are included when statuses are mixed
- An order without payments returns 0
- Fetched payment records are not mutated