FA-59437 / Subscription proration billing / Member archive
Coupons on invoices with proration lines: repeating coupon window · case 02
A three-month coupon discounts a fourth invoice.
Case contract
Input {lines: signed cents, coupon {type percent|amount, value, duration once|repeating|forever, months}, idx (0-based invoice number since redemption)}. Coupon active: forever always; once only at idx 0; repeating while idx < months. Percent coupons discount each positive line separately (half-up); credit lines are not discounted. Amount coupons subtract value capped at the sum of positive lines. Total = sum(lines) - discount. Return [discount, amount_due = max(0,total), credit = max(0,-total)].
Why this case matters
Coupons interact with proration credits; discounting a credit line or over-applying an amount-off coupon changes what customers pay.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [23984, 0, 13203] | [0, 10781, 0] | 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 ↗