Shopping Cart Framework APIs

This section discusses the classes that you can use for implementing a shopping cart.

The Shopping Cart framework supports a set of Application Programming Interfaces (APIs) that comprise the functionality common to all shopping carts. These APIs are application classes. These APIs exist in the SCC_COMMON application package as shown in the following diagram:

This example illustrates the fields and controls on the Shopping cart APIs in the SCC_COMMON application package. You can find definitions for the fields and controls later on this page.

Shopping cart APIs in the SCC_COMMON application package

The following diagram shows the delivered enrollment shopping cart implementation. This implementation uses the Shopping Cart framework, and the delivered CourseShoppingCart and CourseShoppingCartItem entities.

This example illustrates the fields and controls on the Example of a delivered shopping cart implementation. You can find definitions for the fields and controls later on this page.

Example of a delivered shopping cart implementation

The following table describes the delivered classes that are shown in the preceding diagram.

Classes/Tables Description

CartConfigurationTable

This table contains details about the available carts and the implementation classes that support these carts. The database table for CartConfigurationTable is SCC_SHOPCART.

ShoppingCartHandler

This class is the only web service handler that the system needs to drive the shopping cart. To access the Shopping Cart framework, all the web services will use this web service handler. This class is part of the SCC_COMMON application package.

ShoppingCartManager

The generic handler class uses the ShoppingCartManager core class to create and return the appropriate entity specific to the Campus Solutions application. Additionally, a user interface can use the ShoppingCartManager class to retrieve the items from a cart specific to the Campus Solutions application. This class is part of the SCC_COMMON application package.

ShoppingCart

This core class contains the common functions available to all carts. Note that we have modeled this class as a WorkEntity and therefore, this class does not require real database persistence (table). The feature, adopting the Shopping Cart framework, must extend this class. This class is part of the SCC_COMMON package.

Note: The purchase() & validateCart() methods, which are used by the SCC_SC_CHECKOUT and SCC_SC_VALIDATE service operations respectively, are defined as abstract in the ShoppingCart class. Therefore, you must provide the implementation code in the adopting class.

ShoppingCartItem

The adopting feature must extend this core class to hold any items in the cart. Note that we have modeled this class as a BasicEntity having a real underlying database table that contains the cart items. This class is part of the SCC_COMMON package.

BasicEntity

You must create the adopting feature entity with an entity type set to ShoppingCartItem. We have defined this type with the base application class called SCC:COMMON:SHOPCART:ShoppingCartItem. This base class extends the SCC_COMMON:ENTITY:BasicEntity application class. Therefore, when creating a shopping cart, you create an application class that extends the BasicEntity class. The BasicEntity class is part of the SCC_COMMON package.

CommonSubRecord

This is a table that contains the Shopping Cart framework's common fields that any adopting feature's item table should include. This enables the cart to track the common system data, with no effort from the adopting feature. The database table for CommonSubRecord is SCC_SHOPCRT_SBR.

CourseShoppingCart

This class pertains to the implementation for enrollment shopping cart. This class is part of the SSR_COURSE application package.

The CourseShoppingCart class extends the core ShoppingCart class. The CourseShoppingCart class contains the implementation for the purchase() & validateCart() methods that are abstract in the core ShoppingCart class.

Note that the CourseShoppingCart class is attached to a work entity (SCC_SHOPCRT_WRK) because the class has nothing to save and therefore does not require a real database table.

CourseShoppingCartItem

This class pertains to the implementation for enrollment shopping cart (which is specific to the Student Records Campus Solutions application). This class is part of the SSR_COURSE application package. This class handles the storage of the enrollment shopping cart items (academic classes). The CourseShoppingCartItem entity is attached to the enrollment shopping cart item table (SSR_REGFORM) that holds the enrollment shopping cart items (academic classes).

WorkEntity

This class is extended by entities that have nothing to save, meaning they do not have a real underlying database table. The core ShoppingCart class extends WorkEntity. The WorkEntity class is part of the SCC_COMMON package.