Calculation framework
Commerce systems need to calculate monetary amounts and apply them to business objects. Business rules and legal requirements specify how and when these monetary amounts should be calculated. When these rules and requirements change, a good commerce system can adapt to the changes with little or no programming changes.
WebSphere Commerce provides a flexible, generic framework that can be used to implement different kinds of calculations and apply them to the business objects. The framework can handle a wide variety of business and legal requirements without programming. WebSphere Commerce provides a number of method implementations from which you can select to do the calculations. If business or legal requirements require a programming change, you can make many such changes just by programming additional method implementations, without having to change existing programming. These implementations can be overridden.
The calculation framework is part of the WebSphere Commerce order subsystem. The order subsystem is a component of the WebSphere Commerce Server that provides shopping carts, order processing, and order management function support. The order system also includes related services, such as pricing, taxation, payment, inventory, and fulfillment.
WebSphere Commerce business objects and the calculation framework
The WebSphere Commerce calculation framework calculates monetary amounts associated with OrderItem business objects. An OrderItem represents something that a customer has selected for purchase. Each OrderItem has a reference to an offer, a contract, a shipping mode, and a fulfillment center. Monetary amounts that are determined by the calculation framework are stored with each OrderItem.
Each OrderItem also has a quantity attribute that is a unitless number. The quantity attribute can be multiplied by the nominal quantity attribute of the CatalogEntryShippingInformation object associated with the CatalogEntry object to arrive at the actual quantity represented by the OrderItem. The CatalogEntryShippingInformation object specifies the unit of measurement in which quantities are stated.
OrderItems can be grouped to make an Order. OrderItems that are part of an Order can be grouped to form SubOrders. OrderItems in a SubOrder object have the same shipping address, and can be used to display subtotals of their OrderItem amounts.
All OrderItems in an Order are associated with a single currency.
The total monetary amounts that are calculated for the discounts, shipping charges, and taxes for the OrderItems in the Order are stored with the Order.
Calculation framework overview
There are five major components to the WebSphere Commerce calculation framework:
- Calculation methods
- Calculation methods reference task commands to implement the parts of the calculation framework.
- Calculation usages
- Calculation usages are the categories of calculations that are performed using the calculation framework. These include discounts and sales tax.
- Calculation codes
- Calculation codes indicate the calculations to be performed for OrderItems.
- Calculation rules
- Calculation rules calculate the monetary amounts for the calculation codes associated with an OrderItem.
- Calculation scales and calculation ranges
- Calculation scales allow a calculation rule for determining monetary amounts in a manner that is similar to looking up a value from a table. Calculation ranges define the relationship between a look-up number and value to be located for a calculation scale.
Some of the major relationships between the calculation framework components are shown in the following unified modeling language (UML) diagram. Calculation methods have been omitted to make the illustration simpler.
Notes:
- StoreEntityCalculationUsageRel describes the high-level behavior of a calculation usage within a store or store group.
- The relationship between CalculationRule and TaxCategory applies only for sales tax and shipping tax calculation usages.
(C) Copyright IBM Corporation 1996, 2006. All Rights Reserved.