FA-59360 / Subscription proration billing / Member archive
Daily plan-change proration: downgrade credit balance · case 05
Downgrades produce a negative amount due on the invoice.
Case contract
Input {old, new prices per period, start, end (exclusive), change} dates with start <= change < end. Remaining days = end - change; period days = end - start. Credit = old*remaining/period and charge = new*remaining/period, each rounded half-up. Net = charge - credit; a positive net is due now, a negative net becomes a credit balance. Return [credit, charge, amount_due, credit_balance].
Why this case matters
Mid-cycle plan changes must credit unused time on the old plan and charge the new plan for the same days.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [2059, 1581, -478, 0] | [2059, 1581, 0, 478] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗