Commit
Apply fixed fee once per bundle transaction, not per pack
Commit details
Commit notes
Fixes an edge case in the fee floor added earlier: createBundlePurchase ran calculatePlatformFeeForAmount once per pack, so the fixed per-transaction component (PLATFORM_FEE_FIXED_CENTS) was charged N times for a single Stripe checkout. A 5-pack bundle took 5×€0.35 in fixed fees while the platform pays the processor's fixed cost only once — eroding seller earnings and contradicting the "per-transaction cost" rationale.
- Add calculateBundleFeesForAmounts: percentage fee per pack, but the fixed component applied once across the bundle, distributed to packs that have room, capped so per-pack earnings stay >= 0. Fees + earnings reconcile exactly to the bundle price. - Extract a shared percentageFeeCents helper; single-pack fees unchanged. - Wire the bundle helper into createBundlePurchase. - Export allocateBundleAmounts (the proportional largest-remainder splitter) and add unit tests for it (conservation, proportionality, all-free split, empty list) plus the new bundle fee logic (single fixed component, reconciliation, zero-amount, one-pack == single-pack parity). - Document the once-per-bundle behavior in PRICING.md.
[private session redacted]
- Files changed
- 3
- Lines added
- +157
- Lines removed
- −7