\chapter{Sales}

The convention manager includes an extensive ecommerce section where attendees can purchase registrations, donation, meals, sporting events and commemorative merchandise. Each sale creates a new order and a transaction, once paid. The sequence of events is as follows:

\begin{outline}[enumerate]
    \1 Browse the registration page which includes the registration plus all products
        \2 Users use the increment/decrement icons to add/remove items from their shopping cart
    \1 Review shopping cart. 
        \2 Click Edit to return to the registration page where they can make adjustments
    \1 Process payment 
        \2 Purchase is processed through Stripe
        \2 Transaction number is created by Stripe and fetched by our system
        \2 System creates a new transaction record in our database using the Stripe transaction number  
    \1 View receipt 
        \2 A copy is also emailed to them.
\end{outline}

During this process the system evaluates whether the customer is an existing user by email address. If there is no match, a new user is created. If there is a match, this order is added to their existing account. 

\section{Orders}
Orders are created at the beginning of user shopping process. Each order record has a status\_id field which is 0 by default. We update the value of status\_id to 1 upon a successful transaction. This allows us to see all orders, including abandoned carts.

\section{Transactions}
A transaction is automatically created upon successful purchase. It means that the users credit card was authorized and payment accepted. For credit card purchases, we submit the payment intent to Stripe who authorzes, processes the payment and generates a transaction number. We get that transaction number during the payment submission and create a transaction record in our database which includes the Stripe transaction number and other pertinent information for reporting purposes. For cash purchases, including checks, a manual transaction record is created and identified accordingly. 

\section{Attendees Orders (Badges)}
For orders with event registrations, the name(s) of the registrants and their meeting/group name are recorded in the aattendees\_orders table, a one to many relationship. This info is used in reports and when printing the badges.
