The goal for this iteration is to complete the online ordering process by implementing the code to collect the necessary customer information. Also, we want to store this information in a database for later use. But before we start the implementation, we need to know exactly what information will be collected and which forms we will use.
12.3.1 User Interfaces
After online customers have put items into their shopping cart, they can proceed to the checkout procedure. This area of Online Photo Shop will require a login step to identify the customer. We need this identification to make sure that we do not display someone's payment information to any third party. Also, new customers can use the login page to register themselves using their e-mail address and a password. Figure 12.1 shows the sketch of the login page.
Figure 12.1. Login Form
After a customer is logged in, the shipping and payment information is collected for new customers, or verified for returning customers. This can actually be done on the same page. For returning customers, however, by default the fields will be set to the information used for the most recent order. Figure 12.2 shows the layout of the checkout form.
Figure 12.2. Checkout Form
12.3.2 Database Records
The data fields shown in Figures 12.1 and 12.2 also help to define the customer profile that will be stored in the customer database. Table 12.2 summarizes all fields and their types.
12.3.3 Tax and Shipping
Before an order can be completed, we need to compute the total cost, including shipping and sales tax if applicable. The business is a New Jersey-based company, so sales tax applies only to customers with NJ residences. The sales tax in New Jersey is 6%.
Only one shipping method is offered at this time. The cost of shipping consists of a fixed base amount of $1.25 plus $3.00 per pound.
12.3.4 Finalizing an Order
The requirement key F:checkout_summarize requires the Online Photo Shop application to make the information for each completed order available to order processing. We decide to use structured text files in XML format to make this information accessible to other applications. This XML file will contain the complete customer record, including shipping address and payment entered at the time of the order. Furthermore, the total amount of the order will be provided along with the amounts for shipping and sales tax. Next, all items ordered will be stored along with the file name of the uploaded digital picture for customizations. Such a file is shown in Listing 12.1.
Field |
Type |
Summary |
---|---|---|
|
Char[50] |
Customer's e-mail address. The e-mail address is also used to identify the customer. |
Password |
Char[50] |
Secret password used to authenticate the customer. |
Name |
Char[50] |
Customer's full name. |
Address1 |
Char[50] |
First line of address. |
Address2 |
Char[50] |
Second line of address (optional). |
City |
Char[50] |
U.S. city. |
State |
Char[2] |
U.S. state (abbreviation). |
Zip |
Integer |
Five-digit U.S. ZIP code. |
CCType |
Char[10] |
Credit card type (Visa, MasterCard, etc.). |
CCNumber |
Char[16] |
Credit card number (16 digits). |
CCExpMonth |
Integer |
Credit card's expiration month. |
CCExpYear |
Integer |
Credit card's expiration year. |
Listing 12.1 Example of Completed Order in XML
joe.smith@mail.com Joe Smith 100 Main St. Apt. 12 New Town NJ 08150 Visa 1234-5678-9087-6543 05 2007
The directory in which to store completed orders will be defined in the Web.config file of Online Photo Shop. We will address this parameter, among others, later in this chapter.
Introducing .NET
Introducing Software Engineering
A .NET Prototype
Project Planning
The Photo Editor Application
GDI+ Graphics Extensions
Advanced GDI+ Operations
Dynamic Loading of Components
Accessing System Resources
Performance Optimization, Multithreading, and Profiling
Building the Web Application with ASP.NET
Security and Database Access
Product Release