Chapter 14. Ordering and Payment

WHAT'S IN THIS CHAPTER?

  • Creating the checkout and using PayPal as the payment merchant

  • Creating an order history section within the customer account

  • Using domain events to trigger workflow

In this final case study chapter, you will complete Agatha's online store by adding the facility for customers to place an order and pay for it using PayPal. You will also add screens to the customer account area to enable customers to view their order history.

CHECKOUT

Figure 14-1 shows the screens you will be creating in this chapter. The Customer Account section will include new screens for customers to view their order history. The checkout section will enable customers to order products placed in their basket. The payment merchant you will be using is PayPal, but the system will be designed to allow any payment merchant who uses the post callback method to take payments.

As with the previous three chapters, you will begin by designing the domain model of the order aggregation.

Order Model

Figure 14-2 shows the domain model for the order aggregation. As you can see, an order contains a collection of order items. It also contains a payment object that represents details of the transaction made to pay for the order. The order also contains a property of type IOrderState, which defines the order's state. The states of an order are open and submitted. An order in the open state has been created but not paid for. When an order is paid, it changes to the state of submitted. ...

Get Professional ASP.NET Design Patterns 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.