Coupon Validation Rules
Specify coupon validation that cannot be bypassed by the client. The server decides the discount at charge time. COUPON FIELDS Code, percent or fixed amount, currency if fixed, starts and ends, max redemptions, per-customer limit, minimum subtotal, included or excluded products, first-time customers only, stackable or not. DELIVER 1) The validation order: exists, not expired, redemption counts, customer eligibility, cart eligibility, then compute. Each failure has a code the UI can translate, not a stack trace. 2) The compute function: integer minor units, a maximum so a coupon cannot make the total negative, and the line items it applies to. 3) The race on max redemptions: increment in the same transaction as the order, with a constraint, so the last use cannot be taken twice. 4) What the client sends: the code, not the discounted total. The server recomputes. Show the bug if we trust a total from the browser. 5) Tests for expired, wrong currency, excluded product, and a stacked pair when stacking is off. Do not log the list of all valid codes in a public error message.
🌟 Example Output / Preview
Prompt Metadata
Primary Use Cases:
- •Legacy code modernization & technical refactoring
- •Full-stack layout generation & component structuring
- •CI/CD workflow automation & unit/E2E testing suites
Associated Tags:
💡 Pro Tips & Advice
1. Use bracketed items: Be sure to fill out all [PLACEHOLDER] elements with specific details before sending the prompt to the AI model.
2. Adjust temperature: For creative tasks, set AI temperature higher (e.g., 0.8), or lower (e.g., 0.2) for strict coding/technical tasks.
🔗 Related AI Prompts
Full SaaS Landing Page Build Spec (SEO + Conversion)
You are a Staff Product Designer + Frontend Engineer + SEO strategist. Build a complete, production-ready marketing landing page f...
SaaS Analytics Dashboard Full Build Spec
You are a Principal Product Designer + Frontend Lead. Design and specify a complete [LIGHT | DARK] analytics dashboard for [PRODUC...
SaaS Admin Panel Dashboard Build Spec
Design a full internal Admin Dashboard for [PRODUCT_NAME] used by [ADMIN_ROLE: support | ops | super-admin]. --- 🎯 CONTEXT Adm...