← Alle Vorlagen

Gast- und Kundenwarenkörbe, beim Anmelden zusammengeführt, Bestands- und Preisprüfung.

Spec — Shopping cart

Status: draft · Created: 2026-11-10

1. Context and goal

Shoppers collect items before paying, signed in or not, and never reach payment with a price or stock that is out of date.

2. Functional requirements (EARS)

  • FR-1: WHEN a guest adds an item, THE SYSTEM SHALL create a cart tied to an opaque cookie id and keep it for 30 days of inactivity.
  • FR-2: WHILE a shopper is signed in, THE SYSTEM SHALL keep one cart per account, the same on every device.
  • FR-3: WHEN a guest with a cart signs in, THE SYSTEM SHALL merge it into the account cart, adding quantities of the same item up to stock and the item limit, and delete the guest cart.
  • FR-4: THE SYSTEM SHALL accept quantities from 1 to 99 per line and answer 422 outside that range.
  • FR-5: IF a requested quantity exceeds available stock, THEN THE SYSTEM SHALL answer 409 with the available quantity.
  • FR-6: WHEN a cart is read, THE SYSTEM SHALL compare each line with the current price and stock, and flag every line whose price changed or that is out of stock.
  • FR-7: WHEN checkout starts, THE SYSTEM SHALL check stock and prices again and answer 409 listing the changed lines until the shopper confirms them.
  • FR-8: THE SYSTEM SHALL compute subtotal, discounts, tax and total on the server, ignoring any amount sent by the client.
  • FR-9: IF a cart change carries a version older than the stored one, THEN THE SYSTEM SHALL answer 409, so concurrent changes never overwrite each other.

3. Out of scope

  • Reserving stock during payment.
  • Saved-for-later lists.