freshyo/docs/test-cases/coupon-management.md
2026-10-11 18:21:24 +05:30

3.2 KiB

Coupon administration and global authoring

Scope: regional admin coupon CRUD/user targeting/product targeting, superadmin global coupon CRUD and form serialization. Regional coupons have region ID; global coupons have null region and are authored only by superadmin.

ID Priority Action / input Expected result
CPM-01 P0 Admin A creates general percentage coupon. A-scoped coupon with exact code/limits/cap; A eligible path works.
CPM-02 P1 Create flat coupon and edit all supported fields. Correct persisted discount type/expiry/min/limit/exclusive values.
CPM-03 P0 Superadmin creates global coupon. Null region; usable across regions subject to user/product rules.
CPM-04 P0 Regional admin attempts null-region/global creation or edit. Cannot author/change global coupon through any endpoint.
CPM-05 P1 Auto-generated code vs multiple explicit codes. Intended unique count; deterministic code normalization and collisions.
CPM-06 P1 Both/neither discount type, negative values, percentage >100. Business/schema constraints; no negative unintended promotion.
CPM-07 P1 Empty/space/case-variant/duplicate code. Approved normalization and uniqueness; no accidental empty code.
CPM-08 P0 User-only coupon for U1 vs all-users flag. Eligibility/applicability reflects exact intended scope.
CPM-09 P1 Missing/nonexistent/duplicate user IDs. Validation/deduplication; no orphan applicable-user rows.
CPM-10 P0 Target A SKU and global SKU; try B regional SKU in A coupon. Valid targets allowed; foreign regional target denied.
CPM-11 P1 Empty targets vs relation targets vs legacy skuIds. Defined canonical semantics; no drift that expands target scope unexpectedly.
CPM-12 P1 Replace/remove all product/user targets on edit. Old relations removed as intended; empty target means whole cart.
CPM-13 P1 Null/zero maxValue/minOrder/max-user-limit. Defined unlimited/zero behavior; omission differs from explicit clearing.
CPM-14 P1 Expiry past/now/future, invalid date/timezone boundary. Valid serialization and eligibility deadline.
CPM-15 P0 B admin reads/edits/invalidates A coupon ID. Foreign access denied; coupon unchanged.
CPM-16 P1 Invalidate used coupon then inspect old order. New spend blocked; persisted historical discount unchanged.
CPM-17 P1 Multi-code batch has later duplicate/invalid code. Agreed atomic batch behavior; any committed subset explicitly reported, not hidden partial failure.
CPM-18 P1 Concurrent duplicate creation/save failure mid-relations. One coherent coupon; no duplicate/orphan target relations.
CPM-19 P1 Global coupon creator has no staff-user row. Supported author metadata persists without FK error; audit policy explicit.
CPM-20 P2 Product/user picker with same names, global badges and edit hydration. Correct IDs retained; hidden target selection not lost on unrelated save.

Policy checkpoint: global coupons targeting regional-only products and audit attribution for superadmin creation. Do not assume an unimplemented global-coupon UI exists: API cases remain applicable.