docs(openspec): plan shop coupons, accounts, points, flash sales, and group buying

Capture exclusive promotion composition, empty-group cancel, and mall surface scope so the five marketing changes can be implemented without stacking or lifecycle ambiguity.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Chengdong Zhang
2026-09-18 17:32:08 +08:00
co-authored by Cursor
parent e10cae5789
commit 53548196f8
38 changed files with 894 additions and 31 deletions
@@ -0,0 +1,22 @@
## ADDED Requirements
### Requirement: Shop coupon template management
A shop_owner or shop_staff SHALL create, list, update, disable, and delete only that shop's coupon templates. A template SHALL contain localized title, fixed `amount_minor`, `threshold_minor`, enabled ISO currency, non-negative claim stock, and an inclusive active window; amount MUST be positive and threshold MUST NOT be negative.
#### Scenario: cross-shop template is hidden
- **WHEN** a shop user requests or mutates another shop's coupon template
- **THEN** the API returns 404
### Requirement: Customer coupon claim and listing
An authenticated customer SHALL list owned coupons and claim an active template at most once. Claiming SHALL atomically create a user-held snapshot and decrement claim stock only when stock remains; listing SHALL distinguish claimed, redeemed, and expired coupons.
#### Scenario: concurrent final claim
- **WHEN** two customers claim the final remaining template instance concurrently
- **THEN** exactly one claim succeeds and the other receives 409
### Requirement: Coupon redemption lifecycle
A claimed coupon SHALL be redeemable only by its owner, for its issuing shop, within its snapshot window, and when the shop-order subtotal reaches its snapshot threshold. Redemption SHALL bind the coupon to one order; cancellation of that pending-payment order SHALL restore it to claimed. Later activity-priced shop orders (flash sale or group buy) SHALL NOT redeem a coupon; those changes restated this exclusion on checkout.
#### Scenario: cancelled order restores coupon
- **WHEN** a customer cancels a pending-payment order redeemed with a coupon
- **THEN** the coupon again has claimed status and no order binding