Building the Shopping Cart Feature

Now that you understand the data model, let’s build our first piece of checkout functionality: adding items to the shopping cart.

Our requirements are simple:

  • The user needs to be able to go to the page for an event and select the number of tickets to be purchased for a specific performance.

  • The user needs to be taken to a shopping cart page that shows the newly entered items.

That’s the happy path, and once we get that in place, I’ll talk about some failure scenarios or edge cases.

We’ll build our shopping cart feature using test-driven development (TDD), which also gives us an opportunity to see how we’ll be writing tests as we move forward. A common TDD process is called outside-in, which starts with an ...

Get Take My Money now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.