freshyo/docs/test-cases/coupon-application.md
2026-10-18 10:59:18 +05:30

4.5 KiB
Raw Permalink Blame History

Coupon eligibility, targeting and multi-coupon stacking

Scope: getEligible/getMyCoupons, cart selection, checkout couponIds, shared pricing, validation and coupon usage. New regional/product-targeting policy supersedes the older sanity-plan global-only assumptions.

ID Priority Action / input Expected result
CPA-01 P0 Apply valid whole-cart percentage coupon, place COD order. Goods-only discount/cap; preview=persisted detail; one usage.
CPA-02 P0 Apply flat coupon, remove it, reapply. Exact discount restoration; fee/threshold recomputed; no usage until placement.
CPA-03 P0 Browse A/B with A-regional/B-regional/global coupons. List and server spend enforce region; globals allowed in both.
CPA-04 P0 U1-only coupon listed/applied by U2, including direct guessed ID. U2 denied; no usage/order created.
CPA-05 P1 Target P only in mixed P/Q cart. Discount only P; Q subtotal unaffected.
CPA-06 P0 Target P but cart contains only Q; empty target list. Targeted no-match rejected; untargeted applies to eligible whole cart.
CPA-07 P0 Min ₹200 targeted goods: P ₹50 + unrelated ₹300. UI disables; server rejects, no consumed usage. Regression R7.
CPA-08 P1 Targeted min−0.01/min/min+0.01; change qty/flash price/stock. Eligibility based on actual available target subtotal and recomputed.
CPA-09 P0 Stack percentage and flat coupons in reverse input order. Each coupon applies to the remaining eligible amount in the supplied selection order; reversing the order can change the total; each coupon's cap applies to its own reduced base.
CPA-10 P0 Exclusive coupon alone, exclusive plus one/another exclusive. Alone works; all combinations with another coupon rejected.
CPA-11 P1 Select exclusive after nonexclusive and vice versa. Clear selection/replacement behavior; UI cannot knowingly submit invalid combination.
CPA-12 P1 Duplicate coupon IDs, empty array, many eligible coupons. Dedupe usages; no imposed coupon-count cap; empty works.
CPA-13 P0 Missing/negative/fractional/nonfinite IDs, unknown coupon and legacy couponId. Invalid contract safely rejected/no silently discounted legacy input; hard-switch behavior explicit.
CPA-14 P0 Overlapping targets across ₹100/₹900 split slots. No negative sub-order or discount offset against unrelated goods. Regression R3.
CPA-15 P0 Combined individual discounts exceed goods. Shared aggregate cap on both UI/server; nonnegative quote. Regression R4.
CPA-16 P0 OOS/suspended lines, flash-priced items and combo SKU targets. Unavailable lines excluded; actual flash/combo purchased SKU values used.
CPA-17 P0 Invalidated/expired/missing coupon after checkout opened. Server rejects stale coupon; no order/usage writes.
CPA-18 P0 Per-user limit exactly reached; another user below limit. Correct per-user count, no global-count confusion.
CPA-19 P0 Concurrent orders with one remaining permitted use. Approved atomic limit guarantee; no overuse.
CPA-20 P0 First-order U0, one split group, subsequent order. Split group counts as one effective order; first-order coupon no longer eligible.
CPA-21 P1 Cancel only one sibling vs every sibling, then first-order/usage retry. Group-aware restored eligibility follows effective-order policy.
CPA-22 P1 Coupon edited after placement; reopen customer/admin history. Stored discount read, not recomputed from new percent/cap/targets.
CPA-23 P0 Split placement with several coupons. One usage per coupon on same deterministic primary sub-order.
CPA-24 P1 Expiry exact boundary/client clock skew. Server deadline authoritative; UI stale state recoverable.
CPA-25 P1 Coupon list request with missing/foreign/invalid region. Explicit safe contract; customer does not accidentally see/apply foreign promotion.
CPA-26 P1 Coupon query fails, relogin U2, region changes. No stale U1/other-region selected coupon leakage.
CPA-27 P1 Small target contribution rounds below minor unit. Agreed currency rounding/usage behavior; per-order sum reconciles.
CPA-28 P1 Quantity reduction makes selected coupon ineligible before submit. UI flags/removes invalid discount and submits coherent IDs.

Policies: coupons stack sequentially on the remaining eligible amount in selection order, rounded to the nearest rupee. Zero-cap/zero-limit semantics still need explicit approval. Caps, targeting, exclusive-only behavior and client/server parity are mandatory.