Design: Pricing Strategy System
Design covers discount and coupon management, validation, application logic, and usage tracking. Payment processing and product catalog are out of scope.
Functional Requirements
FR1: Support multiple types of discounts: percentage off, fixed amount off, buy-one-get-one (BOGO)
FR2: Allow creation and management of coupons with unique codes
FR3: Coupons can have constraints: expiration date, usage limits per user and overall
FR4: Apply discounts and coupons during checkout to calculate final price
FR5: Support stacking rules: which discounts can be combined or are exclusive
FR6: Track coupon usage for analytics and enforcement
FR7: Provide APIs for frontend to validate and apply discounts in real-time
Non-Functional Requirements
NFR1: Handle up to 10,000 concurrent users applying discounts
NFR2: API response time for discount validation must be under 100ms p99
NFR3: System availability target 99.9% uptime
NFR4: Ensure data consistency for coupon usage counts to prevent overuse