FA-60813 / Loyalty points ledgers / Member archive
Purchased points with volume bonus: price basis · case 03
Members are charged for the bonus points they receive free.
Case contract
Input {requests:[pts], price_per_1000, tiers:[[min_base, bonus_bp]] ascending, annual_limit, bought_ytd}. Each request is floored to whole thousands ("too small" when that is 0). A request whose base would push purchased base points above annual_limit is rejected whole ("limit"); bonus points never count toward the limit. Bonus = floor(base*bp/10000) with bp from the highest tier whose min_base <= this request base. Price = base/1000*price_per_1000. Return {results:[[base,bonus,price]|reason], bought_ytd}.
Why this case matters
Member point balances, statements and the program liability depend on this ledger rule.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| big buy | {"bought_ytd": 21000, "results": [[21000, 5250, 28600]]} | {"bought_ytd": 21000, "results": [[21000, 5250, 23100]]} | 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 ↗