add volume and graduated tiers to metered prices
Closed
ST
2mo ago+355+355+012345678901234567890123456789-72-72-01234567890123456789
Summary
This PR adds volume and graduated pricing tiers to metered prices, behind a internal org feature flag.
Backend
- ProductPriceMeteredUnit extends the reusable TieredPrice mixin. A metered price sets either unit_amount (flat rate) or tiers, never both. Model validator checks this. Tiered metered prices must leave the last tier unbounded, since usage has no ceiling.
- The shared tier engine (Tiers.calculate, volume + graduated) now accepts Decimal quantities, not just whole ints.
Frontend
- Regenerated client (unit_amount is now nullable on metered prices) plus minor temporary frontend addition for the typechecker that will be removed in dashboard branch
In upcoming PR we will make this actually useful when creating a product and seeing it in checkout.