Business requirement

An online store has several promotions, but only one may be applied. First-order eligibility has highest priority, followed by Gold membership, high order value, and bulk quantity.

  1. Give 20% off for a first order of at least ₹500.
  2. Otherwise give Gold members 15% off when the amount is at least ₹2,000.
  3. Otherwise give 12% off when the order is at least ₹5,000.
  4. Otherwise give 8% off when the order contains at least five items.
  5. Apply only the first matching rule and display the selected promotion, discount, and final total.
  6. Validate that amount and item count are positive.