B.2 Subsystem Ordering


The Ordering subsystem contains those classes and relationships that deal with the process of ordering merchandise from the bookstore.

The class diagram for this subsystem is shown in Figure B.2.

Figure B.2. Ordering Subsystem Class Diagram

graphics/bfig02.gif

Customer

A customer is an individual or organization that has placed orders for books and other products offered by the store.

A customer must have purchased books; a user who simply browses to the site is not considered a customer until he or she places an order.

Customers remain active for six months after their last order. An active customer receives periodic e-mail reminders of sales and can be eligible for discounts based on how much he or she has previously purchased.

Attributes

email: InternetEmailAddress

The customer's e-mail address, also used as the customer's login and unique identifier.

name: PersonalName

The customer's name.

shippingAddress: MailingAddress

The address to which the customer's orders are normally sent.

phone: TelephoneNumber

The customer's telephone number.

purchasesMade: Count

How many purchases the customer has made since becoming a customer.

Associations & Relationships

R5

PLACES 1..* Order

Customers place orders for products. An order that is not yet checked out does not have to be associated with a customer, but every customer must have placed at least one order.

Order

An order is a request to purchase one or more books. An order is started when a customer checks out a shopping cart by specifying a credit card number and shipping address. If the credit card charge is approved, the contents of the order are shipped to the customer.

State Machine

See Figure B.3.

Figure B.3. Order Statechart

graphics/bfig03.gif

Attributes

orderID: arbitrary_id

A unique number assigned by the bookstore to the order.

dateOrderPlaced: date

The date the order was started when a shopping cart is checked out. In some instances, this may be different from the date that the order is shipped.

totalValue: Money

The total value of the order: the sum of all of the product selections on the order.

The bookstore does not collect tax or shipping charges on orders.

recipient: PersonalName

The name of the person to whom the order is to be shipped. This is generally the same as the customer, but a customer may place an order to be shipped to someone else (as a gift, for example).

deliveryAddress: MailingAddress

The location where the order is to be shipped.

contactPhone: TelephoneNumber

A telephone number to contact someone (generally, the customer) in case of problems or questions about the order, the charge, or the shipments.

Associations & Relationships

R8

IS PAID FOR BY 0..1 CreditCardCharge

Each order must be paid for using a credit card. When the order is checked out, a credit card charge is created and submitted for approval (association R7). Only if the charge is approved (and therefore actually pays for the order) is this association created.

Consequently, there may be many attempts (R7) but only one actual payment (R8).

R6

IS SENT TO CUSTOMER AS 0..1 Shipment

When an order's payment is approved, a Shipment is created and associated to the Order.

R5

IS PLACED BY 0..1 Customer

Customers place orders for products. An order that is not yet checked out does not have to be associated with a customer, but every customer must have placed at least one order.

R7

PAYMENT IS ATTEMPTED BY 0..* CreditCardCharge

When a customer checks out an order, he provides a credit card number, expiration date, and such. This information is submitted to the credit card company, who may approve or decline the charge. This association represents the attempted charge: An instance of this association is created each time a charge is submitted to pay for an order, regardless of whether or not the charge is actually approved. Contrast this with association R8, the actual payment.

R10

IS A PURCHASE OF SELECTIONS IN 1 ShoppingCart

The Shopping Cart is distinct from the Order. The Shopping Cart has Product Selections added to and removed from it. The Order, on the other hand, is not placed until the Shopping Cart is checked out.

ProductSelection

Each ProductSelection represents a single selection by a customer of products in a shopping cart. A ProductSelection is created each time a customer adds a product to a cart.

State Machine

See Figure B.4.

Figure B.4. ProductSelection Statechart

graphics/bfig04.gif

Attributes

quantity: Count

The quantity of the related product that the customer has selected.

unitPriceOfSelection: Money

Represents the unit price of a product added to a shopping cart at the time the product is selected and added to the cart. This attribute is initialized with Product.unitPrice but is kept separately so as to capture the price the customer actually pays even if the actual product price changes.

selectionValue: Money

The total price of the selection.

Associations & Relationships

R9

IS INCLUDED IN 0..* Shipment

When an order is paid for, the selections in the order are shipped to the customer. This association identifies which selections are shipped in which shipment.

Some selections are not shipped from the bookstore because they are selections of special-order products shipped directly from the publisher. It is even possible for a paid order to have no shipment. However, a shipment must contain at least one selection.

Future versions of this system will also support partial shipments in which items are shipped only when there is sufficient stock on hand. In that situation, we will need to identify which shipments contain which selections. This association will capture this information.

R4

formalizes association between Product and ShoppingCart

Each time a customer makes a selection, the customer's cart is linked to the corresponding selection, creating an instance of a ProductSelection.

ShoppingCart

A shopping cart contains a customer's product selections. A cart is started when a customer selects a first product. Additional products may be added to the cart. The customer then checks out the cart to place an order.

State Machine

See Figure B.5.

Figure B.5. ShoppingCart Statechart

graphics/bfig05.gif

Attributes

cartID: arbitrary_id

An arbitrary ID to refer to a specific cart.

totalValue: Money

The total value of all of the items in the cart.

Associations & Relationships

R4

INCLUDES SELECTIONS OF 1..* Product

Each time a customer makes a selection, the customer's cart is linked to the corresponding selection, creating an instance of a ProductSelection.

R10

SELECTIONS ARE PURCHASED IN 0..1 Order

The Shopping Cart is distinct from the Order. The Shopping Cart has Product Selections added to and removed from it. The Order, on the other hand, is not placed until the Shopping Cart is checked out.

CreditCardCharge

All purchases are paid by credit card. A credit card charge is created when an order is placed. The charge is submitted to the bookstore's credit card processing company. This company either approves or declines the charge. When the charge is approved, the order can be packed and shipped to the customer.

State Machine

See Figure B.6.

Figure B.6. CreditCardCharge Statechart

graphics/bfig06.gif

Attributes

chargeID: arbitrary_id

A unique identifier assigned by the bookstore to the charge submission.

accountNumber: BankCardAccountNumber

The credit card account to be charged.

cardholderName: PersonalName

The name of the accountholder as it appears on the credit card.

billingAddress: MailingAddress

The billing address on the credit card account. The credit card processing company compares this to the account's billing address to ensure that the charge submission is correct.

cardExpirationDate: MonthYear

The expiration date as shown on the credit card. The credit card processing company compares this to the account's expiration date to ensure that the charge submission is correct. The processing company will not accept a charge for an expired card, even if a future (but incorrect) expiration date is submitted.

dateChargeMade: date

The date that the charge is sent for processing.

chargeAmount: Money

The amount of the charge submitted for processing. Normally this is the same as the totalValue of the related order.

approvalCode: BankCardApprovalCode

The result code returned from the credit card processing. See the definition of the datatype BankCardApprovalCode for the possible values of this attribute.

Associations & Relationships

R8

PAYS FOR 1 Order

Each order must be paid for using a credit card. When the order is checked out, a credit card charge is created and submitted for approval (association R7). Only if the charge is approved (and therefore actually pays for the order) is this association created.

Consequently, there may be many attempts (R7) but only one actual payment (R8).

R7

IS AN ATTEMPT TO PAY FOR 1 Order

When a customer checks out an order, he provides a credit card number, expiration date, and such. This information is submitted to the credit card company, who may approve or decline the charge. This association represents the attempted charge: An instance of this association is created each time a charge is submitted to pay for an order, regardless of whether or not the charge is actually approved. Contrast this with association R8, the actual payment.



Executable UML. A Foundation for Model-Driven Architecture
Executable UML: A Foundation for Model-Driven Architecture
ISBN: 0201748045
EAN: 2147483647
Year: 2001
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net