blocker fix phases added
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# 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
|
||||
|
||||
1. Flip `USE_REFUNDS_MOCK` to `false` — the real endpoints are live and correct.
|
||||
2. Fix the scale mismatch at the contract level, not just the one render site: type
|
||||
`CancellationPolicyPreview.refundPercentageApplied`/`feePercentage` as 0–100 (matching the real server),
|
||||
fix `CancellationPolicyDisclosure.tsx`'s `toPercent` to 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. Check `refunds/types.ts:167,201` for other render sites reusing the same
|
||||
field before considering this fully closed.
|
||||
3. Same cross-mock-import problem as BNPL (phase 05): `refunds/apis/mockApi.ts:3` imports directly from the
|
||||
(real) `bookings` mock store — moot once step 1 lands.
|
||||
Reference in New Issue
Block a user