Rune-stone

Online Bookstore - Order Processing

Context

We’re building the order processing module for an online bookstore. Customers browse books, add them to a cart, apply coupon codes, and check out. We need three core functions for the checkout flow.

Business Rules

1. Calculate Order Total

The system must calculate the total cost of an order including tax.

Example: 2 books at $15.99 + 1 book at $24.50 with 8.5% tax = $61.28

2. Validate Coupon

The system must validate coupon codes and return the discount they provide.

Example: Code “SAVE10” → matches coupon with 10% discount, not expired → valid

3. Check Free Shipping Eligibility

The system must determine if an order qualifies for free shipping.

Example: Subtotal $45, loyalty member → free shipping (loyalty program)

Acceptance Criteria