2.1 KiB
Phase 08 — Refunds are demo-only, and off by 100×
Blocker: blockers.md § "Payments" (refunds). Depends on: nothing.
Root cause — the mock. client/src/services/refunds/constants.ts:18 — USE_REFUNDS_MOCK = true. The
real server side (RefundsController.cs, CreateRefundCommand, GetCancellationPolicyPreviewQuery) is live
and correct; the client just never calls it for anything but the bare status read.
Root cause — the ×100 bug, exact. The server's refundPercentageApplied/feePercentage are 0–100
values (GetCancellationPolicyPreviewQuery.Handler.cs:74: 100m - policy.RefundPercentage). The client's
own type comment claims 0–1 (refunds/types.ts:110-112) — true of the mock (MOCK_POLICY_TIERS,
refunds/constants.ts:45-52, uses 1 | 0.5 | 0) but not the real server. The render function
(CancellationPolicyDisclosure.tsx:19-21,36-37) does Math.round(fraction * 100) — correct by luck against
the mock's 0–1 scale, but against the real server's 100.00 it produces "10000%".
Important nuance: the actual IRR amounts shown are server-supplied strings passed straight through — not multiplied by 100 themselves. It's specifically the percent-chip labels that are 100× too large.
The fix
- Flip
USE_REFUNDS_MOCKtofalse— the real endpoints are live and correct. - Fix the scale mismatch at the contract level, not just the one render site: type
CancellationPolicyPreview.refundPercentageApplied/feePercentageas 0–100 (matching the real server), fixCancellationPolicyDisclosure.tsx'stoPercentto stop re-multiplying an already-0–100 value, and fix the mock (mockApi.ts:127-128,MOCK_POLICY_TIERS) to also emit 0–100 so mock and real can never silently disagree on scale again. Checkrefunds/types.ts:167,201for other render sites reusing the same field before considering this fully closed. - Same cross-mock-import problem as BNPL (phase 05):
refunds/apis/mockApi.ts:3imports directly from the (real)bookingsmock store — moot once step 1 lands.