Commit Graph
2 Commits
Author SHA1 Message Date
james 5c30760351 fix(api): keep the flash-sale discovery test isolation-safe
The inactive-window test asserted that no active session exists at all, which
the shared test database breaks once another test has created one. Assert that
this session is absent from discovery instead.
2026-09-18 12:53:26 +00:00
james 393e7f7209 feat(api): flash sales resolved server-side at checkout
Shop-owned timed sessions carry SKU activity items with their own reserved
inventory and per-customer limit. Checkout resolves eligibility on the server,
locks candidate items by primary key after the SKU locks, and splits a cart line
into an activity-priced item plus a standard-priced remainder, so every unit
price snapshot is honest and a customer cannot exceed the limit.

Reserved activity stock and SKU stock decrement together under guards, and a
pending-payment cancellation restores both plus any redeemed coupon. Coupons are
rejected on a shop order that applied activity pricing, and a SKU cannot join
two overlapping enabled sessions.

The overlap check against group buying is present but dormant: that capability
lands later, so the check activates only once its table exists.

Surfaces (shop-admin, mall) and seeding follow.
2026-09-18 12:47:46 +00:00