ATG Commerce Programming Guide

Base Commerce Classes and Interfaces

The base commerce classes and interfaces are the core objects that are used throughout ATG Commerce. These objects store the data that represent shopping carts, items to be purchased, shipping information, pricing information, and payment information. All the individual parts of ATG Commerce use these classes.

The ATG Commerce class hierarchy is divided into classes and interfaces. The interfaces provide access to the data in the objects in a way that frees it from the underlying implementation. The interfaces are described below. For information on how all the classes and interfaces are related, refer to the Purchase Process Class Diagrams section.

Interface

Description

Order

The Order interface represents the delivery and payment information for a collection of items. An Order contains CommerceItems, ShippingGroups, PaymentGroups, and Relationships.

CommerceItem

The CommerceItem interface represents information about a product to be purchased. A CommerceItem contains the SKU (also called the catalogRefId) and the quantity of the item purchased.

ShippingGroup

The ShippingGroup interface contains information about the delivery of a collection of CommerceItem objects. A ShippingGroup could contain a physical delivery address.

PaymentGroup

The PaymentGroup interface contains payment information, shipping costs, and tax information for each item or the entire Order. This includes information such as a credit card number, an expiration date, and the amount to be charged.

Relationship

The Relationship interface represents an association between two or more of the commerce objects listed above, such as the relationship between a CommerceItem and a ShippingGroup.

It is important to understand the concept of relationships, although they are usually hidden from the ATG Commerce user. The commerce-specific interfaces that extend Relationship are CommerceItemRelationship, ShippingGroupRelationship, PaymentGroupRelationship, and OrderRelationship. For more information, see the Using Relationship Objects section.

HandlingInstruction

The HandlingInstruction interface describes special handling for a CommerceItem within a given ShippingGroup. Gift wrapping is an example of HandlingInstruction.

The following types of classes implement the interfaces described above:

In some cases, there may be only one implementation. Other interfaces are implemented by more than one class. For example, PaymentGroupImpl, CreditCard, and GiftCertificate all implement the PaymentGroup interface.

Order Classes

Class

Description

OrderImpl

This class implements Order. It contains data structures for managing collections of other commerce objects. It manages collections of CommerceItem, ShippingGroup, PaymentGroup, and Relationship objects.

Note1: Order equality is determined by comparing the orderId, the lastModified time, and transient properties.

Note2: If you write any new code that modifies the Order object, make sure the code synchronizes on the Order object before it is modified.

Item Classes

Class

Description

CommerceItemImpl

This class implements CommerceItem. It stores the data about a specific item in an Order.

Shipping Classes

Classes

Description

ShippingGroupImpl

This class implements ShippingGroup. It stores the data describing where and how to ship CommerceItems, as well as the Relationships to items in the shipping group. This class provides no functionality itself; it is used through the HardgoodShippingGroup and ElectronicShippingGroup subclasses (described below).

HardgoodShippingGroup

This class implements ShippingGroup and extends ShippingGroupImpl. In addition to storing inherited data, it stores information about how the CommerceItems are to be shipped to a physical street address, such as the carrier and postal address.

ElectronicShippingGroup

This class implements ShippingGroup and extends ShippingGroupImpl. In addition to storing inherited data, it stores information about how CommerceItems are to be delivered electronically, such as an e-mail address.

Payment Classes

Payment Classes

PaymentGroupImpl

This class implements PaymentGroup. It stores the payment information for CommerceItems, shipping costs, and tax. It also can contain Relationships to those items, shipping costs, or tax costs in the PaymentGroup. This class provides no functionality itself, but is used through the CreditCard and GiftCertificate subclasses (described below in this table).

CreditCard

This class implements PaymentGroup and extends PaymentGroupImpl. In addition to storing inherited data, it stores information about how CommerceItems, shipping costs, and tax costs are paid for using a credit card.

GiftCertificate

This class implements PaymentGroup and extends PaymentGroupImpl. In addition to storing inherited data, it stores information about how CommerceItems, shipping costs, and tax costs are paid for using a gift certificate.

StoreCredit

This class implements PaymentGroup and extends PaymentGroupImpl. In addition to storing inherited data, it stores information about how CommerceItems, shipping costs, and tax costs are paid for using a store credit.

Relationship Classes

Classes

Description

ShippingGroupCommerceItemRelationship

When this Relationship is added to a ShippingGroup and CommerceItem, the CommerceItem is shipped using the information in the ShippingGroup. This Relationship object itself contains data such as the quantity to be shipped.

PaymentGroupCommerceItemRelationship

When this Relationship is added to a PaymentGroup and CommerceItem, the CommerceItem is paid for using the information in the PaymentGroup. This Relationship object itself contains data such as the quantity of the item to be paid for using the PaymentGroup.

PaymentGroupShippingGroupRelationship

When this Relationship is added to a PaymentGroup and ShippingGroup, the shipping cost is paid for using the information in the PaymentGroup. This Relationship object itself contains data such as the amount of the shipping cost to be paid for using the PaymentGroup.

PaymentGroupOrderRelationship

When this Relationship is added to a PaymentGroup and Order, the tax cost or order cost is paid for using the information in the PaymentGroup. This Relationship object itself contains data such as the amount of the tax cost to be paid for using the PaymentGroup.

Handling Classes

Classes

Description

HandlingInstructionImpl

This class implements HandlingInstruction. It contains a ShippingGroup ID, CommerceItem ID, and quantity, as well as data about what quantity of CommerceItems in which ShippingGroups need special handling. This class provides no functionality itself, but should be used through a subclass.

GiftlistHandlingInstruction

This class implements HandlingInstruction and extends HandlingInstructionImpl. In addition to storing all the basic data that it inherits, it also stores data about which CommerceItems in the Order were added from a gift list.