atg.commerce.pricing
Class PricingTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.messaging.SourceSinkTemplate
              extended by atg.commerce.pricing.PricingTools
All Implemented Interfaces:
MessageSink, MessageSource, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class PricingTools
extends SourceSinkTemplate

A class which can perform a variety of pricing functions across different types of PricingEngine. It simplifies interaction with a spectrum of PricingEngines. It also has a number of static currency-related methods for use by all pricing engines.

The pricing engines themselves are not tasked with assigning prices to a given CommerceItem. ShippingGroup or Order. They generate "quotes" whose price info objects can then be associated with the objects. The pricing methods in this class are designed to perform that association for the developer automatically. For example, if one invokes the priceOrderTotal method that will execute the Item Pricing Engine, assign each ItemPriceInfo to each CommerceItem, then execute the Shipping Pricing Engine, and assign all shipping costs to the ShippingGroups, calculate the order subtotal through the Order Pricing Engine, and determine the amount of taxes owed through the Tax Pricing Engine. Finally it takes the shipping and tax totals and assigns those into the OrderPriceInfo object of the order supplied.

The other methods follow the same methodology, where they generate a quote from a pricing engine and then assign that new price to the object.

There are three main ways one can supply pricing models for pricing. Each type of pricing has overloaded methods which perform these three different styles.

  1. Extract the pricing models from the profile through the pricing engine
  2. Retrieve the correct pricing models from the PricingModelHolder, which "caches" the lists of pricing models generated by the pricing engines in the user's session
  3. Directly supplying the collection of pricing models

Properties:

See Also:
ItemPricingEngine, TaxPricingEngine, ShippingPricingEngine, OrderPricingEngine

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String DETAILED_ITEM_PRICE_AMOUNT_PROPERTY
           
static java.lang.String DETAILED_ITEM_PRICE_ORDER_DISCOUNT_SHARE_PROPERTY
           
static java.lang.String DETAILED_ITEM_PRICE_ORDER_MANUAL_ADJUSTMENT_SHARE_PROPERTY
           
protected  ItemPriceSourceHandler[] mItemPriceSourceHandlers
           
protected  boolean mUsingPriceLists
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
PricingTools()
          Constructs an instanceof PricingTools
 
Method Summary
protected  void addPriceBeanForInfo(DetailedItemPriceInfo pInfo, java.util.List pBeans)
          Given a DetailedItemPrice info, check the list of beans to see if one has the same unit price and pricing model adjusters.
 double calculateItemsOrderManualAdjustmentShare(CommerceItem pCommerceItem)
          Adds up the manual adjustment share from the item's detailedItemPriceInfos
 ItemPriceInfo calculatePrice(RepositoryItem pProduct, RepositoryItem pSku, long pQuantity)
          Return a price for the given quantity of the product and sku.
 ItemPriceInfo calculatePrice(RepositoryItem pProduct, RepositoryItem pSku, long pQuantity, boolean pIgnorePromotions, RepositoryItem pProfile, java.util.Locale pLocale, java.util.Map pExtraParameters)
          Return a price for the given quantity of the product and sku
 double calculateTaxableAmount(CommerceItem pItem, Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Calculates the taxable amount of an item.
 double calculateTaxableAmount(ShippingGroupCommerceItemRelationship pRelationship, Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Calculates the taxable amount of an relationship.
 double calculateTaxableAmountByAverage(CommerceItemRelationship pRelationship, Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          This method does the same thing as calcualteTaxableAmount except the an average amount is used for the items rather than the actual amount.
 double calculateTaxableAmountByAverage(ShippingGroupCommerceItemRelationship pRelationship, Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          This method does the same thing as calcualteTaxableAmount except the an average amount is used for the items rather than the actual amount.
 void compareClosenessQualifiers(java.util.List pClosenessQualifiers1, java.util.List pClosenessQualifiers2, java.lang.String pJMSType, Order pOrder, RepositoryItem pProfile)
          Checks to see if the closenessQualifiers in the pClosenessQualifiers1 parameter are contained in pClosenessQualifiers2.
protected  void compareQualifiers(AmountInfo pOldPriceInfo, AmountInfo pNewPriceInfo, Order pOrder, RepositoryItem pProfile)
           
 DetailedItemPriceInfo createDetailedItemPriceInfo()
          Returns a new instance of the of the class defined through the detailedItemPriceInfoClass property.
 DetailedItemPriceInfo createDetailedItemPriceInfo(DetailedItemPriceInfo pDetailedItemPriceInfo)
          Returns a new instance of the of the class defined through the detailedItemPriceInfoClass property.
protected  DetailedItemPriceInfo createInitialSubSkuDetailedPriceInfo(double pTotalPrice, ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, java.lang.String pAdjustmentDescription, atg.core.util.Range pRange)
          Create the initial DetailedItemPriceInfos with the given price for the given range
 ItemPriceSource createItemPriceSource(CommerceItem pCommerceItem, CommerceItem pParentCommerceItem, java.lang.String pCurrencyCode)
          Creates a new ItemPriceSource object based on the given item and parent item.
 ItemPriceSource createItemPriceSource(java.lang.String pProductId, java.lang.String pSkuId, java.lang.String pParentSkuId, java.lang.String pCommerceItemType, java.lang.String pCurrencyCode)
          Instantiates a new ItemPriceSource object with the given parameters.
 OrderPriceInfo createOrderPriceInfo()
          Returns a new instance of the class defined through the OrderTools.defaultOrderPriceInfoClass property.
 PriceChanged createPriceChangedEvent(Order pOrder, RepositoryItem pProfile, CommerceIdentifier pRepricedObject, AmountInfo pOldPrice)
          This method will create a PriceChanged event and send it.
 CommerceItem createPricingCommerceItem(java.lang.String pCatalogRefId, java.lang.String pProductId, long pQuantity)
          Creates a temporary commerceItem object for pricing
protected  AmountInfo createSubSkuPriceInfo()
          Returns a new instance of the class defined through the subSkuPriceInfoClass property.
 void deriveUsingPriceLists()
          Figure out if the system is configured to use price lists or not.
 boolean doesOrderContainPriceLists(Order pOrder)
          Returns true if the order contains any price lists on the commerce item price info objects
 void doStartService()
          Derives some property values based on configuration settings
 java.util.List findAdjustmentsByDescription(ItemPriceInfo pItemPriceInfo, java.lang.String pDescription)
          Returns all the PricingAdjustments found in the price info's adjustments property whose description matches the given description
 ItemPriceSource findMatchingSource(java.util.Collection pItemPriceSource, CommerceItem pCommerceItem, CommerceItem pParentCommerceItem, java.lang.String pCurrencyCode)
          Iterates over the collection of ItemPriceSource objects and returns the first one that matches the given item and parent item combination
 void firePromotionClosenessMessage(java.lang.String pJMSType, Order pOrder, RepositoryItem pProfile, RepositoryItem pClosenessQualifier)
          Constructs and sends a PromotionClosenessMessage of the given JMS type (PromotionClosenessQualification or PromotionClosenessDisqualification)
protected  void generateItemPriceSources(java.util.List pItemPriceSources, Order pOrder, CommerceItem pCommerceItem, CommerceItem pParentCommerceItem, java.lang.String pCurrencyCode, java.util.Map pExtraParameters)
          Creates a new ItemPriceSource object and calls each handler to populate its values.
 java.util.List generateItemPriceSources(Order pOrder, java.util.Map pExtraParameters)
          Generates a List of ItemPriceSource objects based on the pricing information contained in the given Order.
 java.util.Map generateItemPricingSourceMap(java.util.List pItemPriceSources, java.util.List pCommerceItems, CommerceItem pParentCommerceItem, java.lang.String pCurrencyCode)
          Maps the CommerceItems to the ItemPriceSource objects
 java.lang.Object generateKeyForTieredProcessedItem(CommerceItem pItem)
          Called by the tiered pricing calculators to generate the key used to store the quantity info about an Item processed during the pricing operation.
 java.util.List generatePriceBeans(CommerceItem pItem)
          Given a commerce item, loop through its detailed item price infos and create the price beans.
 java.util.List generatePriceBeans(java.util.List<DetailedItemPriceInfo> pInfos)
          Given a list of detailed item price infos, loop through each one and create the price beans.
 double getAverageItemPrice(CommerceItem pCommerceItem)
          This method will return the average price for a given commerce item.
 CatalogTools getCatalogTools()
          The CatalogTools used to retrieve skus and products
 MessageSender getClosenessQualificationMessageSender()
           
 CommerceItemManager getCommerceItemManager()
          Manager class used to manipulate commerce items
static java.lang.String getCurrencySymbol(java.util.Locale pLocale)
          Returns the currency symbol for the given locale
static java.lang.String getCurrencySymbol(java.lang.String pLocale)
          Returns the currency symbol for the given locale
static java.text.DecimalFormatSymbols getDecimalFormatSymbols(java.util.Locale pLocale)
          Returns the DecimalFormatSymbols object for the given locale
static java.text.DecimalFormatSymbols getDecimalFormatSymbols(java.lang.String pLocale)
          Returns the DecimalFormatSymbols object for the given locale
 java.util.Locale getDefaultLocale()
          Returns property DefaultLocale.
 java.lang.Class getDetailedItemPriceInfoClass()
          The class that is used for detailed item price infos.
 DetailedItemPriceTools getDetailedItemPriceTools()
          The class for providing various methods for manipulating DetailedItemPriceInfos
static java.lang.String getInternationalCurrencySymbol(java.util.Locale pLocale)
          Returns the currency code for the given locale
static java.lang.String getInternationalCurrencySymbol(java.lang.String pLocale)
          Returns the currency code for the given locale
 ItemPriceSource getItemPriceSource(ItemPriceInfo pPriceQuote, CommerceItem pItem, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          This method returns the ItemPriceSource mapped to the commerce item id in the pricing overide Map stored in the extra parameters.
 ItemPriceSourceHandler[] getItemPriceSourceHandlers()
          Configures an array of ItemPriceSourceHandler components that are used to generate price overrides.
 ItemPricingEngine getItemPricingEngine()
          Returns property ItemPricingEngine
 double getItemsOrderDiscountShare(Order pOrder, CommerceItem pItem, double pDiscount)
          Get a particular items order discount share.
 RepositoryItem getListPriceListFromOrder(Order pOrder)
          Returns the list price list from the order.
 java.util.Locale getLocale(java.util.Locale pLocale)
           
 java.lang.String getLoggingIdentifier()
          Returns property LoggingIdentifier
 IdGenerator getMessageIdGenerator()
          The service that generates Ids for all messages.
 java.lang.String getMessageIdSpaceName()
          The name of the idspace to get our message ids from
 java.lang.String getNextMessageId()
          Returns the next unique Id for commerce messages.
 OrderManager getOrderManager()
          Manager class used to manipulate commerce items
 OrderPricingEngine getOrderPricingEngine()
          Returns property OrderPricingEngine
 OrderTools getOrderTools()
          The order tools from which to get the default itemPriceInfo class
 RepositoryItem getPriceList(RepositoryItem pProfile, java.lang.String pPriceListPropertyName, boolean pUseDefaultPriceList, java.util.Map pExtraParameters)
          Gets the price list.
 RepositoryItem getPriceListFromParameters(java.util.Map pExtraParameters, java.lang.String pPriceListPropertyName)
          Get the price list from the extra parameters.
 PriceListManager getPriceListManager()
          Returns the reference to the PriceListManager which handles the operations of the PriceList
 PricingContextFactory getPricingContextFactory()
          Factory to create PricingContext instances
 java.util.Locale getPricingLocale(RepositoryItem pProfile, java.lang.String pPriceListPropertyName, boolean pUseDefaultPriceList, java.util.Map pExtraParameters, java.util.Locale pLocale)
          Gets the locale for pricing.
 RepositoryItem getProfile(java.lang.String pProfileId)
          Gets the profile repository item with the given id
 java.lang.String getProfileItemType()
           
 MutableRepository getProfileRepository()
           
 java.lang.String getPromotionClosenessDisqualificationJMSType()
           
 java.lang.String getPromotionClosenessQualificationJMSType()
           
 java.lang.String getRangeClassType()
          The class used when creating range objects.
 atg.core.util.RangeComparator getRangeComparator()
          The object that is used to compare ranges
 double getRelationshipsSubtotal(java.util.List pRelationships, java.lang.String pDetailProperty)
          This method will return the sum of the amounts of all the DetailedItemPriceInfos that refer to an item in any of these relationship.
 int getRoundingDecimalPlaces()
          number of decimal places to which prices should be rounded
 RepositoryItem getSalePriceListFromOrder(Order pOrder)
          Returns the sale price list from the order.
 java.lang.String getScenarioEventPort()
          The name of the port to send pricing events to
 double getShipItemRelPriceTotal(ShippingGroupCommerceItemRelationship pRelationship, java.lang.String pDetailProperty)
          Sum the amount for all the details that refer to a specific relationship If the range of the relationship is null, 0.0 is returned.
 ShippingGroupCommerceItemRelationship getShippingGroupCommerceItemRelationship(CommerceItem pItem, DetailedItemPriceInfo pPriceInfo)
          Return a ShippingGroupCommerceItemRelationship based on the commerceItem and a DetailedItemPriceInfo.
 ShippingPricingEngine getShippingPricingEngine()
          Returns property ShippingPricingEngine
 java.lang.Class getSubSkuPriceInfoClass()
          Returns property PriceInfoClass
 TaxPricingEngine getTaxPricingEngine()
          Returns property TaxPricingEngine
 long getTotalQuantityForBulkPricing(java.util.List pItems, CommerceItem pItem)
          Returns the total quantity of the items in the List that match the given pItem.
 boolean isGeneratePriceChangedEvents()
          If this is true, whenever an order gets repriced and the price is different, a PriceChanged event will be sent
protected  boolean isMatchForBulkPricing(CommerceItem pItem1, CommerceItem pItem2)
          determines if the two items should be considered a match for aggregating quantity
 boolean isSendEventsWithNoProfile()
          It is possible for some orders to have a null profile (if the user was anonymous).
 boolean isSendPromotionClosenessMessages()
           
 boolean isShippingSubtotalUsesAverageItemPrice()
          If true, a shipping groups subtotal is calculated by multiplying each item prices' average by the quantity in the given shipping group.
 boolean isTaxable(CommerceItem pItem, ItemPriceInfo pItemPriceInfo, OrderPriceInfo pOrderPriceInfo, Order pOrder, ShippingPriceInfo pShippingPriceInfo, ShippingGroup pShippingGroup, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Determines whether a CommerceItem is taxable.
 boolean isUseDefaultLocaleIfNotSpecified()
          Whether to use the default locale if one is not specified
 boolean isUsePassedLocaleAsPricingLocale()
          Returns the boolean value of usePassedLocaleAsPricingLocale which if true means getPricingLocale will just return the locale passed into it.
 boolean isUsingPriceLists()
          Sets property usingPriceLists, which indicates whether the application uses price lists or SKU-based pricing.
 boolean isUsingPriceListsExplicitlySet()
          This will return true if the value of usingPriceLists has been explicitly set either through code or through a properties file.
 boolean needsRounding(double pNumber)
          This method determines whether the input number needs to be rounded based on the value of the roundingDecimalPlaces property.
 void performPricingOperation(java.lang.String pPricingOperation, Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Dispatch off of the Pricing Operation constant supplied to determine what type of pricing should be performed.
 void priceEachItem(java.util.List pCommerceItems, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price all the items, and set each of their priceInfo to the result.
protected  void priceEachItem(java.util.List pCommerceItems, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, boolean pGenerateItemRanges)
          Price all the items, and set each of their priceInfo to the result.
 void priceEachItem(java.util.List pCommerceItems, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price all the items, and set each of their priceInfo to the result.
 void priceEachItem(java.util.List pCommerceItems, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price all the items, and set each of their priceInfo to the result.
 void priceItem(CommerceItem pCommerceItem, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price all the single item, and set it's priceInfo to the result.
protected  void priceItem(CommerceItem pCommerceItem, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, boolean pGenerateItemRanges)
          Price all the single item, and set it's priceInfo to the result.
 void priceItem(CommerceItem pCommerceItem, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price the single item, and set it's priceInfo to the result.
 void priceItem(CommerceItem pCommerceItem, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price the single item, and set it's priceInfo to the result.
protected  double priceItemsForOrderTotal(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price all the items, and set each of their priceInfo to the result.
protected  double priceItemsForOrderTotal(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, boolean pGenerateOrderRanges)
          Price all the items, and set each of their priceInfo to the result.
 double priceItemsForOrderTotal(Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price all the items, and set each of their priceInfo to the result.
 double priceItemsForOrderTotal(Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price all the items, and set each of their priceInfo to the result.
protected  double priceOrderForOrderTotal(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price the sub total and any order level discounts.
protected  double priceOrderForOrderTotal(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, boolean pGenerateOrderRanges)
          Price the sub total and any order level discounts.
 double priceOrderForOrderTotal(Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price the sub total and any order level discounts.
 double priceOrderForOrderTotal(Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price the sub total and any order level discounts.
 OrderPriceInfo priceOrderSubtotal(Order pOrder, java.util.Collection pItemPricingModels, java.util.Collection pOrderPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order subtotal, including each item, but not shipping and taxes.
 OrderPriceInfo priceOrderSubtotal(Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order subtotal, including each item, but not shipping and taxes.
 OrderPriceInfo priceOrderSubtotal(Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order subtotal, including each item, but not shipping and taxes.
 OrderPriceInfo priceOrderSubtotalShipping(Order pOrder, java.util.Collection pItemPricingModels, java.util.Collection pShippingPricingModels, java.util.Collection pOrderPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order subtotal, including each item, and all shipping costs, but not taxes.
 OrderPriceInfo priceOrderSubtotalShipping(Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order subtotal, including each item, and all shipping costs, but not taxes.
 OrderPriceInfo priceOrderSubtotalShipping(Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order subtotal, including each item, and all shipping costs, but not taxes.
 OrderPriceInfo priceOrderSubtotalTax(Order pOrder, java.util.Collection pItemPricingModels, java.util.Collection pOrderPricingModels, java.util.Collection pTaxPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order subtotal, including each item, and all taxes, but not shipping.
 OrderPriceInfo priceOrderSubtotalTax(Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order subtotal, including each item, and all taxes, but not shipping.
 OrderPriceInfo priceOrderSubtotalTax(Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order subtotal, including each item, and all taxes, but not shipping.
 OrderPriceInfo priceOrderTotal(Order pOrder)
          Computes the order total, including each item, all shipping groups and taxes.
 OrderPriceInfo priceOrderTotal(Order pOrder, java.util.Collection pItemPricingModels, java.util.Collection pShippingPricingModels, java.util.Collection pOrderPricingModels, java.util.Collection pTaxPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order total, including each item, all shipping groups and taxes.
 OrderPriceInfo priceOrderTotal(Order pOrder, java.util.Locale pLocale)
          Computes the order total, including each item, all shipping groups and taxes.
 OrderPriceInfo priceOrderTotal(Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order total, including each item, all shipping groups and taxes.
 OrderPriceInfo priceOrderTotal(Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Computes the order total, including each item, all shipping groups and taxes.
 double priceShippingForOrderTotal(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price each shipping group, and set their priceInfo's to the result This method will regenerate order ranges if necessary
protected  double priceShippingForOrderTotal(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, boolean pGenerateOrderRanges)
          Price each shipping group, and set their priceInfo's to the result
 double priceShippingForOrderTotal(Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price each shipping group, and set their priceInfo's to the result.
 double priceShippingForOrderTotal(Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price each shipping group, and set their priceInfo's to the result.
 double priceTaxForOrderTotal(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price the taxes for the entire order This method will regenerate order ranges if necessary
protected  double priceTaxForOrderTotal(Order pOrder, java.util.Collection pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, boolean pGenerateOrderRanges)
          Price the taxes for the entire order
 double priceTaxForOrderTotal(Order pOrder, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price the taxes for the entire order.
 double priceTaxForOrderTotal(Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          Price the taxes for the entire order.
 double round(double pNumber)
          Rounds the input number to the number of decimal places specified by the roundingDecimalPlaces property.
 double round(double pNumber, int pRoundingDecimalPlaces)
          Rounds the input number to the number of decimal places specified by the pRoundingDecimalPlaces argument.
 double roundDown(double pNumber)
          Rounds the input number to the number of decimal places specified by the roundingDecimalPlaces property.
 void sendPriceChangedEvent(PriceChanged pMessage)
          This method will send the given PriceChanged event on the scenarioEventPort port.
protected  void sendPromotionClosenessQualificationMessage(PromotionClosenessMessage pMessage)
          Sends the given PromotionClosenessMessage.
 void setCatalogTools(CatalogTools pCatalogTools)
           
 void setClosenessQualificationMessageSender(MessageSender pClosenessQualificationMessageSender)
          Sets the component that fires PromotionClosenessQualification and PromotionClosenessDisqualification events
 void setCommerceItemManager(CommerceItemManager pCommerceItemManager)
           
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          Sets property DefaultLocale
 void setDetailedItemPriceInfoClass(java.lang.Class pDetailedItemPriceInfoClass)
           
 void setGeneratePriceChangedEvents(boolean pGeneratePriceChangedEvents)
           
 void setItemPriceSourceHandlers(ItemPriceSourceHandler[] pItemPriceSourceHandlers)
           
 void setItemPricingEngine(ItemPricingEngine pItemPricingEngine)
          Sets property ItemPricingEngine
 void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
          Sets property LoggingIdentifier
 void setMessageIdGenerator(IdGenerator pMessageIdGenerator)
           
 void setMessageIdSpaceName(java.lang.String pMessageIdSpaceName)
           
 void setOrderManager(OrderManager pOrderManager)
           
 void setOrderPricingEngine(OrderPricingEngine pOrderPricingEngine)
          Sets property OrderPricingEngine
 void setOrderTools(OrderTools pOrderTools)
           
 void setPriceListManager(PriceListManager pPriceListManager)
          Sets property PriceListManager which handles the operations of the PriceList
 void setPricingContextFactory(PricingContextFactory pPricingContextFactory)
           
 void setProfileItemType(java.lang.String pProfileItemType)
           
 void setProfileRepository(MutableRepository pProfileRepository)
           
 void setPromotionClosenessDisqualificationJMSType(java.lang.String pPromotionClosenessDisqualificationJMSType)
          Sets the JMS type of the PromotionClosenessDisqualification message
 void setPromotionClosenessQualificationJMSType(java.lang.String pPromotionClosenessQualificationJMSType)
          Sets the JMS type of the PromotionClosenessQualification message
 void setRangeClassType(java.lang.String pRangeClassType)
           
 void setRangeComparator(atg.core.util.RangeComparator pRangeComparator)
           
 void setRoundingDecimalPlaces(int pRoundingDecimalPlaces)
          number of decimal places to which prices should be rounded
 void setScenarioEventPort(java.lang.String pScenarioEventPort)
           
 void setSendEventsWithNoProfile(boolean pSendEventsWithNoProfile)
           
 void setSendPromotionClosenessMessages(boolean pSendPromotionClosenessMessages)
          boolean indicating if the promotion-closeness JMS messages should be sent.
 void setShippingPricingEngine(ShippingPricingEngine pShippingPricingEngine)
          Sets property ShippingPricingEngine
 void setShippingSubtotalUsesAverageItemPrice(boolean pShippingSubtotalUsesAverageItemPrice)
           
 void setSubSkuPrice(CommerceItem pSubItem, double pUnitPrice, PricingAdjustment pAdjustment, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, java.lang.String pMsg, RepositoryItem pPriceList)
          Create and set the priceinfo object for a subsku.
 void setSubSkuPriceInfoClass(java.lang.Class pSubSkuPriceInfoClass)
          Sets property SubSkuPriceInfoClass
 void setSubSkuSalePrice(CommerceItem pSubItem, double pSalePrice, PricingAdjustment pAdjustment, RepositoryItem pPricingModel, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters, java.lang.String pMsg, RepositoryItem pPriceList)
          Update the priceinfo object for a subsku with a sale price.
 void setTaxPricingEngine(TaxPricingEngine pTaxPricingEngine)
          Sets property TaxPricingEngine
 void setUseDefaultLocaleIfNotSpecified(boolean pUseDefaultLocaleIfNotSpecified)
           
 void setUsePassedLocaleAsPricingLocale(boolean pUsePassedLocaleAsPricingLocale)
          Sets property usePassedLocaleAsPricingLocale which if true means getPricingLocale will just return the locale passed into it rather than trying to determine it from the price list or the default Defaults to false.
 void setUsingPriceLists(boolean pUsingPriceLists)
          Sets property usingPriceLists, which indicates whether the application uses price lists or SKU-based pricing.
 
Methods inherited from class atg.commerce.messaging.SourceSinkTemplate
getDelayOnSendRetry, getMessageSourceContext, getMessageSourceName, getTransactionManager, isAllowMessageSending, receiveMessage, sendCommerceMessage, sendObjectMessage, setAllowMessageSending, setDelayOnSendRetry, setMessageSourceContext, setMessageSourceName, setTransactionManager, startMessageSource, stopMessageSource
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


DETAILED_ITEM_PRICE_AMOUNT_PROPERTY

public static final java.lang.String DETAILED_ITEM_PRICE_AMOUNT_PROPERTY
See Also:
Constant Field Values

DETAILED_ITEM_PRICE_ORDER_DISCOUNT_SHARE_PROPERTY

public static final java.lang.String DETAILED_ITEM_PRICE_ORDER_DISCOUNT_SHARE_PROPERTY
See Also:
Constant Field Values

DETAILED_ITEM_PRICE_ORDER_MANUAL_ADJUSTMENT_SHARE_PROPERTY

public static final java.lang.String DETAILED_ITEM_PRICE_ORDER_MANUAL_ADJUSTMENT_SHARE_PROPERTY
See Also:
Constant Field Values

mItemPriceSourceHandlers

protected ItemPriceSourceHandler[] mItemPriceSourceHandlers

mUsingPriceLists

protected boolean mUsingPriceLists
Constructor Detail

PricingTools

public PricingTools()
Constructs an instanceof PricingTools

Method Detail

getItemPriceSourceHandlers

public ItemPriceSourceHandler[] getItemPriceSourceHandlers()
Configures an array of ItemPriceSourceHandler components that are used to generate price overrides.

If null, this method will dynamically build the array of handlers from the ItemPriceEngine's preCalculators.

Returns:
an array of ItemPriceSourceHandlers
See Also:
generateItemPriceSources(Order, Map)

setItemPriceSourceHandlers

public void setItemPriceSourceHandlers(ItemPriceSourceHandler[] pItemPriceSourceHandlers)

setPricingContextFactory

public void setPricingContextFactory(PricingContextFactory pPricingContextFactory)

getPricingContextFactory

public PricingContextFactory getPricingContextFactory()
Factory to create PricingContext instances


setCommerceItemManager

public void setCommerceItemManager(CommerceItemManager pCommerceItemManager)

getCommerceItemManager

public CommerceItemManager getCommerceItemManager()
Manager class used to manipulate commerce items


setOrderManager

public void setOrderManager(OrderManager pOrderManager)

getOrderManager

public OrderManager getOrderManager()
Manager class used to manipulate commerce items


setRangeClassType

public void setRangeClassType(java.lang.String pRangeClassType)

getRangeClassType

public java.lang.String getRangeClassType()
The class used when creating range objects. It must be a subclass of atg.core.util.Range


setRoundingDecimalPlaces

public void setRoundingDecimalPlaces(int pRoundingDecimalPlaces)
number of decimal places to which prices should be rounded

Parameters:
pRoundingDecimalPlaces - new value to set

getRoundingDecimalPlaces

public int getRoundingDecimalPlaces()
number of decimal places to which prices should be rounded

Returns:
property RoundingDecimalPlaces

setLoggingIdentifier

public void setLoggingIdentifier(java.lang.String pLoggingIdentifier)
Sets property LoggingIdentifier


getLoggingIdentifier

public java.lang.String getLoggingIdentifier()
Returns property LoggingIdentifier


setSubSkuPriceInfoClass

public void setSubSkuPriceInfoClass(java.lang.Class pSubSkuPriceInfoClass)
Sets property SubSkuPriceInfoClass


getSubSkuPriceInfoClass

public java.lang.Class getSubSkuPriceInfoClass()
Returns property PriceInfoClass


setItemPricingEngine

public void setItemPricingEngine(ItemPricingEngine pItemPricingEngine)
Sets property ItemPricingEngine


getItemPricingEngine

public ItemPricingEngine getItemPricingEngine()
Returns property ItemPricingEngine


setOrderPricingEngine

public void setOrderPricingEngine(OrderPricingEngine pOrderPricingEngine)
Sets property OrderPricingEngine


getOrderPricingEngine

public OrderPricingEngine getOrderPricingEngine()
Returns property OrderPricingEngine


setTaxPricingEngine

public void setTaxPricingEngine(TaxPricingEngine pTaxPricingEngine)
Sets property TaxPricingEngine


getTaxPricingEngine

public TaxPricingEngine getTaxPricingEngine()
Returns property TaxPricingEngine


setShippingPricingEngine

public void setShippingPricingEngine(ShippingPricingEngine pShippingPricingEngine)
Sets property ShippingPricingEngine


getShippingPricingEngine

public ShippingPricingEngine getShippingPricingEngine()
Returns property ShippingPricingEngine


setProfileRepository

public void setProfileRepository(MutableRepository pProfileRepository)

getProfileRepository

public MutableRepository getProfileRepository()

setProfileItemType

public void setProfileItemType(java.lang.String pProfileItemType)

getProfileItemType

public java.lang.String getProfileItemType()

setShippingSubtotalUsesAverageItemPrice

public void setShippingSubtotalUsesAverageItemPrice(boolean pShippingSubtotalUsesAverageItemPrice)

isShippingSubtotalUsesAverageItemPrice

public boolean isShippingSubtotalUsesAverageItemPrice()
If true, a shipping groups subtotal is calculated by multiplying each item prices' average by the quantity in the given shipping group. If false, the shipping group subtotal is calculated using PricingTools.getShipItemRelSubtotal

default value is true


setRangeComparator

public void setRangeComparator(atg.core.util.RangeComparator pRangeComparator)

getRangeComparator

public atg.core.util.RangeComparator getRangeComparator()
The object that is used to compare ranges


setDefaultLocale

public void setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale


getDefaultLocale

public java.util.Locale getDefaultLocale()
Returns property DefaultLocale. If the property value is null, then JVM's default locale is returned.


getDetailedItemPriceTools

public DetailedItemPriceTools getDetailedItemPriceTools()
The class for providing various methods for manipulating DetailedItemPriceInfos


setDetailedItemPriceInfoClass

public void setDetailedItemPriceInfoClass(java.lang.Class pDetailedItemPriceInfoClass)

getDetailedItemPriceInfoClass

public java.lang.Class getDetailedItemPriceInfoClass()
The class that is used for detailed item price infos. The value must be a subtype of DetailedItemPriceInfo


setGeneratePriceChangedEvents

public void setGeneratePriceChangedEvents(boolean pGeneratePriceChangedEvents)

isGeneratePriceChangedEvents

public boolean isGeneratePriceChangedEvents()
If this is true, whenever an order gets repriced and the price is different, a PriceChanged event will be sent

See Also:
PriceChanged

setMessageIdGenerator

public void setMessageIdGenerator(IdGenerator pMessageIdGenerator)

getMessageIdGenerator

public IdGenerator getMessageIdGenerator()
The service that generates Ids for all messages.


setMessageIdSpaceName

public void setMessageIdSpaceName(java.lang.String pMessageIdSpaceName)

getMessageIdSpaceName

public java.lang.String getMessageIdSpaceName()
The name of the idspace to get our message ids from


setScenarioEventPort

public void setScenarioEventPort(java.lang.String pScenarioEventPort)

getScenarioEventPort

public java.lang.String getScenarioEventPort()
The name of the port to send pricing events to


setSendEventsWithNoProfile

public void setSendEventsWithNoProfile(boolean pSendEventsWithNoProfile)

isSendEventsWithNoProfile

public boolean isSendEventsWithNoProfile()
It is possible for some orders to have a null profile (if the user was anonymous). If this property is false, those event on those orders will not be sent. If true, all events are sent, regardless of the order's profile. The default value is false.


setCatalogTools

public void setCatalogTools(CatalogTools pCatalogTools)

getCatalogTools

public CatalogTools getCatalogTools()
The CatalogTools used to retrieve skus and products


setOrderTools

public void setOrderTools(OrderTools pOrderTools)

getOrderTools

public OrderTools getOrderTools()
The order tools from which to get the default itemPriceInfo class


setUseDefaultLocaleIfNotSpecified

public void setUseDefaultLocaleIfNotSpecified(boolean pUseDefaultLocaleIfNotSpecified)

isUseDefaultLocaleIfNotSpecified

public boolean isUseDefaultLocaleIfNotSpecified()
Whether to use the default locale if one is not specified


setClosenessQualificationMessageSender

public void setClosenessQualificationMessageSender(MessageSender pClosenessQualificationMessageSender)
Sets the component that fires PromotionClosenessQualification and PromotionClosenessDisqualification events

Parameters:
pMessageSender - the component that fires PromotionClosenessQualification and PromotionClosenessDisqualification events

getClosenessQualificationMessageSender

public MessageSender getClosenessQualificationMessageSender()
Returns:
the component that fires PromotionClosenessQualification and PromotionClosenessDisqualification events

setPromotionClosenessDisqualificationJMSType

public void setPromotionClosenessDisqualificationJMSType(java.lang.String pPromotionClosenessDisqualificationJMSType)
Sets the JMS type of the PromotionClosenessDisqualification message

Parameters:
pPromotionClosenessDisqualificationJMSType - the JMS type of the PromotionClosenessDisqualificationMessage

getPromotionClosenessDisqualificationJMSType

public java.lang.String getPromotionClosenessDisqualificationJMSType()
Returns:
the JMS type of the PromotionClosenessDisqualification message

setPromotionClosenessQualificationJMSType

public void setPromotionClosenessQualificationJMSType(java.lang.String pPromotionClosenessQualificationJMSType)
Sets the JMS type of the PromotionClosenessQualification message

Parameters:
pPromotionClosenessQualificationJMSType - the JMS type of the PromotionClosenessQualificationMessage

getPromotionClosenessQualificationJMSType

public java.lang.String getPromotionClosenessQualificationJMSType()
Returns:
the JMS type of the PromotionClosenessQualification message

setSendPromotionClosenessMessages

public void setSendPromotionClosenessMessages(boolean pSendPromotionClosenessMessages)
boolean indicating if the promotion-closeness JMS messages should be sent.

Parameters:
pSendPromotionClosenessMessages - boolean indicating if the promotion-closeness JMS messages should be sent.

isSendPromotionClosenessMessages

public boolean isSendPromotionClosenessMessages()
Returns:
boolean indicating if the promotion-closeness JMS messages should be sent.

setPriceListManager

public void setPriceListManager(PriceListManager pPriceListManager)
Sets property PriceListManager which handles the operations of the PriceList

Parameters:
pPriceListManager - the new value to set

getPriceListManager

public PriceListManager getPriceListManager()
Returns the reference to the PriceListManager which handles the operations of the PriceList

Returns:
the reference to the PriceListManager

setUsePassedLocaleAsPricingLocale

public void setUsePassedLocaleAsPricingLocale(boolean pUsePassedLocaleAsPricingLocale)
Sets property usePassedLocaleAsPricingLocale which if true means getPricingLocale will just return the locale passed into it rather than trying to determine it from the price list or the default Defaults to false.

Parameters:
pUsePassedLocaleAsPricingLocale - the new boolean value to set

isUsePassedLocaleAsPricingLocale

public boolean isUsePassedLocaleAsPricingLocale()
Returns the boolean value of usePassedLocaleAsPricingLocale which if true means getPricingLocale will just return the locale passed into it. Defaults to false.

Returns:
the boolean value of usePassedLocaleAsPricingLocale

setUsingPriceLists

public void setUsingPriceLists(boolean pUsingPriceLists)
Sets property usingPriceLists, which indicates whether the application uses price lists or SKU-based pricing. If not explicitly configured, the value is determined at startup based on which ItemPricingCalculators are configured.

Parameters:
pUsingPriceLists - the new boolean value to set

isUsingPriceLists

public boolean isUsingPriceLists()
Sets property usingPriceLists, which indicates whether the application uses price lists or SKU-based pricing. If not explicitly configured, the value is determined at startup based on which ItemPricingCalculators are configured.

Returns:
the boolean value of usingPriceLists

isUsingPriceListsExplicitlySet

public boolean isUsingPriceListsExplicitlySet()
This will return true if the value of usingPriceLists has been explicitly set either through code or through a properties file.

Returns:
the boolean value of usingPriceListsExplicitlySet

doStartService

public void doStartService()
                    throws ServiceException
Derives some property values based on configuration settings

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up

deriveUsingPriceLists

public void deriveUsingPriceLists()
Figure out if the system is configured to use price lists or not. Honor explicit configuration if it was provided.


getInternationalCurrencySymbol

public static java.lang.String getInternationalCurrencySymbol(java.lang.String pLocale)
Returns the currency code for the given locale

See Also:
DecimalFormatSymbols.getInternationalCurrencySymbol()

getInternationalCurrencySymbol

public static java.lang.String getInternationalCurrencySymbol(java.util.Locale pLocale)
Returns the currency code for the given locale

See Also:
DecimalFormatSymbols.getInternationalCurrencySymbol()

getCurrencySymbol

public static java.lang.String getCurrencySymbol(java.lang.String pLocale)
Returns the currency symbol for the given locale

See Also:
DecimalFormatSymbols.getCurrencySymbol()

getCurrencySymbol

public static java.lang.String getCurrencySymbol(java.util.Locale pLocale)
Returns the currency symbol for the given locale

See Also:
DecimalFormatSymbols.getCurrencySymbol()

getDecimalFormatSymbols

public static java.text.DecimalFormatSymbols getDecimalFormatSymbols(java.lang.String pLocale)
Returns the DecimalFormatSymbols object for the given locale

See Also:
DecimalFormatSymbols

getDecimalFormatSymbols

public static java.text.DecimalFormatSymbols getDecimalFormatSymbols(java.util.Locale pLocale)
Returns the DecimalFormatSymbols object for the given locale

See Also:
DecimalFormatSymbols

createPriceChangedEvent

public PriceChanged createPriceChangedEvent(Order pOrder,
                                            RepositoryItem pProfile,
                                            CommerceIdentifier pRepricedObject,
                                            AmountInfo pOldPrice)
                                     throws PricingException
This method will create a PriceChanged event and send it. This implementation only supports changes to the subtotal of the order. This means pRepricedObject must be pOrder. If other price change events are needed, this method should be extended. For example, if you want to create a ShippingPriceChangedEvent, you should extend this method to look for a ShippingGroup as the pRepricedObject You will probably want the type of the PriceChange message to reflect the kind of price change.

Parameters:
pOrder - The order that was repriced
pProfile - The owner of the order
pOldPrice - The previous price of the order
Throws:
PricingException

sendPriceChangedEvent

public void sendPriceChangedEvent(PriceChanged pMessage)
This method will send the given PriceChanged event on the scenarioEventPort port.

Parameters:
pMessage - The scenario event to send

getNextMessageId

public java.lang.String getNextMessageId()
Returns the next unique Id for commerce messages.


createPricingCommerceItem

public CommerceItem createPricingCommerceItem(java.lang.String pCatalogRefId,
                                              java.lang.String pProductId,
                                              long pQuantity)
                                       throws CommerceException
Creates a temporary commerceItem object for pricing

Parameters:
pCatalogRefId - the id of the sku
pProductId - the id of the product
pQuantity - the quantity
Returns:
the temporary commerceItem
Throws:
CommerceException

getProfile

public RepositoryItem getProfile(java.lang.String pProfileId)
                          throws RepositoryException
Gets the profile repository item with the given id

Parameters:
pProfileId - the id of the profile to retrieve
Returns:
the profie repository item
Throws:
RepositoryException - if there was an error while retrieving the profile

priceOrderTotal

public OrderPriceInfo priceOrderTotal(Order pOrder)
                               throws PricingException
Computes the order total, including each item, all shipping groups and taxes. This method refetches the current pricing models for the user from each pricing engine. The first elements priced are the items, then shipping, then order (for sub total) and finally the taxes. After each of those elements are priced, the amount of the OrderPriceInfo for the order is updated to include the total shipping and taxes. This method will use the default locale and fetches the user profile directly from the order. This method will regenerate order ranges PriceChanged event will be thrown

Parameters:
pOrder - the order to price
Returns:
the complete order total
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
createPriceChangedEvent(atg.commerce.order.Order, atg.repository.RepositoryItem, atg.commerce.order.CommerceIdentifier, atg.commerce.pricing.AmountInfo)

priceOrderTotal

public OrderPriceInfo priceOrderTotal(Order pOrder,
                                      java.util.Locale pLocale)
                               throws PricingException
Computes the order total, including each item, all shipping groups and taxes. This method refetches the current pricing models for the user from each pricing engine. The first elements priced are the items, then shipping, then order (for sub total) and finally the taxes. After each of those elements are priced, the amount of the OrderPriceInfo for the order is updated to include the total shipping and taxes. This method will use the locale given. If the given locale is null, it will use the default locale if useDefaultLocaleIfNotSpecified is true. Otherwise, it will call ServletUtil to determine the user's locale. This method fetches the user profile directly from the order. This method will regenerate order ranges PriceChanged event will be thrown

Parameters:
pOrder - the order to price
pLocale - the locale to consider when pricing
Returns:
the complete order total
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
createPriceChangedEvent(atg.commerce.order.Order, atg.repository.RepositoryItem, atg.commerce.order.CommerceIdentifier, atg.commerce.pricing.AmountInfo)

getLocale

public java.util.Locale getLocale(java.util.Locale pLocale)

priceOrderTotal

public OrderPriceInfo priceOrderTotal(Order pOrder,
                                      java.util.Locale pLocale,
                                      RepositoryItem pProfile,
                                      java.util.Map pExtraParameters)
                               throws PricingException
Computes the order total, including each item, all shipping groups and taxes. This method refetches the current pricing models for the user from each pricing engine. The first elements priced are the items, then shipping, then order (for sub total) and finally the taxes. After each of those elements are priced, the amount of the OrderPriceInfo for the order is updated to include the total shipping and taxes. This method will regenerate order ranges PriceChanged event will be thrown

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order total
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
createPriceChangedEvent(atg.commerce.order.Order, atg.repository.RepositoryItem, atg.commerce.order.CommerceIdentifier, atg.commerce.pricing.AmountInfo)

priceOrderTotal

public OrderPriceInfo priceOrderTotal(Order pOrder,
                                      PricingModelHolder pPricingModels,
                                      java.util.Locale pLocale,
                                      RepositoryItem pProfile,
                                      java.util.Map pExtraParameters)
                               throws PricingException
Computes the order total, including each item, all shipping groups and taxes. This method extracts the promotions from the session-scoped PricingModelHolder parameter. The first elements priced are the items, then shipping, then order (for sub total) and finally the taxes. After each of those elements are priced, the amount of the OrderPriceInfo for the order is updated to include the total shipping and taxes. This method will regenerate order ranges PriceChanged event will be thrown

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order total
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
createPriceChangedEvent(atg.commerce.order.Order, atg.repository.RepositoryItem, atg.commerce.order.CommerceIdentifier, atg.commerce.pricing.AmountInfo)

priceOrderTotal

public OrderPriceInfo priceOrderTotal(Order pOrder,
                                      java.util.Collection pItemPricingModels,
                                      java.util.Collection pShippingPricingModels,
                                      java.util.Collection pOrderPricingModels,
                                      java.util.Collection pTaxPricingModels,
                                      java.util.Locale pLocale,
                                      RepositoryItem pProfile,
                                      java.util.Map pExtraParameters)
                               throws PricingException
Computes the order total, including each item, all shipping groups and taxes. This method is supplied with the pricing models that should be used for each pricing engine. The first elements priced are the items, then shipping, then order (for sub total) and finally the taxes. After each of those elements are priced, the amount of the OrderPriceInfo for the order is updated to include the total shipping and taxes. This method will regenerate order ranges PriceChanged event will be thrown

Parameters:
pOrder - the order to price
pItemPricingModels - the pricing models that affect items
pShippingPricingModels - the pricing models that affect shipping
pOrderPricingModels - the pricing models that affect the order (e.g. sub total)
pTaxPricingModels - the pricing models that affect taxes
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order total
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
createPriceChangedEvent(atg.commerce.order.Order, atg.repository.RepositoryItem, atg.commerce.order.CommerceIdentifier, atg.commerce.pricing.AmountInfo)

priceOrderSubtotal

public OrderPriceInfo priceOrderSubtotal(Order pOrder,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters)
                                  throws PricingException
Computes the order subtotal, including each item, but not shipping and taxes. This method refetches the current pricing models for the user from each pricing engine. This method will regenerate order ranges if necessary PriceChanged event will be thrown

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order subtotal
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
createPriceChangedEvent(atg.commerce.order.Order, atg.repository.RepositoryItem, atg.commerce.order.CommerceIdentifier, atg.commerce.pricing.AmountInfo)

priceOrderSubtotal

public OrderPriceInfo priceOrderSubtotal(Order pOrder,
                                         PricingModelHolder pPricingModels,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters)
                                  throws PricingException
Computes the order subtotal, including each item, but not shipping and taxes. This method extracts the promotions from the session-scoped PricingModelHolder parameter. This method will regenerate order ranges if necessary PriceChanged event will be thrown

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order subtotal
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
createPriceChangedEvent(atg.commerce.order.Order, atg.repository.RepositoryItem, atg.commerce.order.CommerceIdentifier, atg.commerce.pricing.AmountInfo)

priceOrderSubtotal

public OrderPriceInfo priceOrderSubtotal(Order pOrder,
                                         java.util.Collection pItemPricingModels,
                                         java.util.Collection pOrderPricingModels,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters)
                                  throws PricingException
Computes the order subtotal, including each item, but not shipping and taxes. This method will regenerate order ranges if necessary If the subtotal changed and generatePriceChangedEvents then a PriceChanged event will be thrown

Parameters:
pOrder - the order to price
pItemPricingModels - the pricing models that affect items
pOrderPricingModels - the pricing models that affect the order (e.g. sub total)
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order subtotal
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
createPriceChangedEvent(atg.commerce.order.Order, atg.repository.RepositoryItem, atg.commerce.order.CommerceIdentifier, atg.commerce.pricing.AmountInfo)

priceOrderSubtotalShipping

public OrderPriceInfo priceOrderSubtotalShipping(Order pOrder,
                                                 java.util.Locale pLocale,
                                                 RepositoryItem pProfile,
                                                 java.util.Map pExtraParameters)
                                          throws PricingException
Computes the order subtotal, including each item, and all shipping costs, but not taxes. This method refetches the current pricing models for the user from each pricing engine. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order subtotal
Throws:
PricingException - if there was an error while computing the pricing information

priceOrderSubtotalShipping

public OrderPriceInfo priceOrderSubtotalShipping(Order pOrder,
                                                 PricingModelHolder pPricingModels,
                                                 java.util.Locale pLocale,
                                                 RepositoryItem pProfile,
                                                 java.util.Map pExtraParameters)
                                          throws PricingException
Computes the order subtotal, including each item, and all shipping costs, but not taxes. This method extracts the promotions from the session-scoped PricingModelHolder parameter. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order subtotal
Throws:
PricingException - if there was an error while computing the pricing information

priceOrderSubtotalShipping

public OrderPriceInfo priceOrderSubtotalShipping(Order pOrder,
                                                 java.util.Collection pItemPricingModels,
                                                 java.util.Collection pShippingPricingModels,
                                                 java.util.Collection pOrderPricingModels,
                                                 java.util.Locale pLocale,
                                                 RepositoryItem pProfile,
                                                 java.util.Map pExtraParameters)
                                          throws PricingException
Computes the order subtotal, including each item, and all shipping costs, but not taxes. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pItemPricingModels - the pricing models that affect items
pShippingPricingModels - the pricing models that affect shipping
pOrderPricingModels - the pricing models that affect the order (e.g. sub total)
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order subtotal
Throws:
PricingException - if there was an error while computing the pricing information

priceOrderSubtotalTax

public OrderPriceInfo priceOrderSubtotalTax(Order pOrder,
                                            java.util.Locale pLocale,
                                            RepositoryItem pProfile,
                                            java.util.Map pExtraParameters)
                                     throws PricingException
Computes the order subtotal, including each item, and all taxes, but not shipping. This method refetches the current pricing models for the user from each pricing engine. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order subtotal
Throws:
PricingException - if there was an error while computing the pricing information

priceOrderSubtotalTax

public OrderPriceInfo priceOrderSubtotalTax(Order pOrder,
                                            PricingModelHolder pPricingModels,
                                            java.util.Locale pLocale,
                                            RepositoryItem pProfile,
                                            java.util.Map pExtraParameters)
                                     throws PricingException
Computes the order subtotal, including each item, and all taxes, but not shipping. This method extracts the promotions from the session-scoped PricingModelHolder parameter. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order subtotal
Throws:
PricingException - if there was an error while computing the pricing information

priceOrderSubtotalTax

public OrderPriceInfo priceOrderSubtotalTax(Order pOrder,
                                            java.util.Collection pItemPricingModels,
                                            java.util.Collection pOrderPricingModels,
                                            java.util.Collection pTaxPricingModels,
                                            java.util.Locale pLocale,
                                            RepositoryItem pProfile,
                                            java.util.Map pExtraParameters)
                                     throws PricingException
Computes the order subtotal, including each item, and all taxes, but not shipping.

Parameters:
pOrder - the order to price
pItemPricingModels - the pricing models that affect items
pOrderPricingModels - the pricing models that affect the order (e.g. sub total)
pTaxPricingModels - the pricing models that affect taxes
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the complete order subtotal
Throws:
PricingException - if there was an error while computing the pricing information

priceItem

public void priceItem(CommerceItem pCommerceItem,
                      java.util.Locale pLocale,
                      RepositoryItem pProfile,
                      java.util.Map pExtraParameters)
               throws PricingException
Price the single item, and set it's priceInfo to the result. The pricing models are gathered from the Item Pricing Engine using the profile. This method will regenerate order ranges if necessary

Parameters:
pCommerceItems - the items to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException - if there was an error while computing the pricing information

priceItem

public void priceItem(CommerceItem pCommerceItem,
                      PricingModelHolder pPricingModels,
                      java.util.Locale pLocale,
                      RepositoryItem pProfile,
                      java.util.Map pExtraParameters)
               throws PricingException
Price the single item, and set it's priceInfo to the result. The pricing models are taken from the supplied PricingModelHolder. This method will regenerate order ranges if necessary

Parameters:
pCommerceItems - the items to price
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException - if there was an error while computing the pricing information

priceItem

public void priceItem(CommerceItem pCommerceItem,
                      java.util.Collection pPricingModels,
                      java.util.Locale pLocale,
                      RepositoryItem pProfile,
                      java.util.Map pExtraParameters)
               throws PricingException
Price all the single item, and set it's priceInfo to the result. This method will regenerate item ranges if necessary

Parameters:
pCommerceItems - the items to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException - if there was an error while computing the pricing information

priceItem

protected void priceItem(CommerceItem pCommerceItem,
                         java.util.Collection pPricingModels,
                         java.util.Locale pLocale,
                         RepositoryItem pProfile,
                         java.util.Map pExtraParameters,
                         boolean pGenerateItemRanges)
                  throws PricingException
Price all the single item, and set it's priceInfo to the result.

Parameters:
pCommerceItems - the items to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
pGenerateItemRanges - If this is true, CommerceItemManager.generateRangeForItem is called for each item
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
CommerceItemManager.generateRangeForItem(atg.commerce.order.CommerceItem)

priceEachItem

public void priceEachItem(java.util.List pCommerceItems,
                          java.util.Locale pLocale,
                          RepositoryItem pProfile,
                          java.util.Map pExtraParameters)
                   throws PricingException
Price all the items, and set each of their priceInfo to the result. The pricing models are gathered from the Item Pricing Engine using the profile. This method will regenerate item ranges if necessary

Parameters:
pCommerceItems - the items to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException - if there was an error while computing the pricing information

priceEachItem

public void priceEachItem(java.util.List pCommerceItems,
                          PricingModelHolder pPricingModels,
                          java.util.Locale pLocale,
                          RepositoryItem pProfile,
                          java.util.Map pExtraParameters)
                   throws PricingException
Price all the items, and set each of their priceInfo to the result. The pricing models are taken from the supplied PricingModelHolder. This method will regenerate item ranges if necessary

Parameters:
pCommerceItems - the items to price
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException - if there was an error while computing the pricing information

priceEachItem

public void priceEachItem(java.util.List pCommerceItems,
                          java.util.Collection pPricingModels,
                          java.util.Locale pLocale,
                          RepositoryItem pProfile,
                          java.util.Map pExtraParameters)
                   throws PricingException
Price all the items, and set each of their priceInfo to the result. This method will regenerate item ranges if necessary

Parameters:
pCommerceItems - the items to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException - if there was an error while computing the pricing information

priceEachItem

protected void priceEachItem(java.util.List pCommerceItems,
                             java.util.Collection pPricingModels,
                             java.util.Locale pLocale,
                             RepositoryItem pProfile,
                             java.util.Map pExtraParameters,
                             boolean pGenerateItemRanges)
                      throws PricingException
Price all the items, and set each of their priceInfo to the result.

Parameters:
pCommerceItems - the items to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
pGenerateItemRanges - If this is true, CommerceItemManager.generateRangeForItem is called for each item
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
CommerceItemManager.generateRangeForItem(atg.commerce.order.CommerceItem)

priceItemsForOrderTotal

public double priceItemsForOrderTotal(Order pOrder,
                                      java.util.Locale pLocale,
                                      RepositoryItem pProfile,
                                      java.util.Map pExtraParameters)
                               throws PricingException
Price all the items, and set each of their priceInfo to the result. The pricing models are gathered from the Item Pricing Engine using the profile. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total of all the items
Throws:
PricingException - if there was an error while computing the pricing information

priceItemsForOrderTotal

public double priceItemsForOrderTotal(Order pOrder,
                                      PricingModelHolder pPricingModels,
                                      java.util.Locale pLocale,
                                      RepositoryItem pProfile,
                                      java.util.Map pExtraParameters)
                               throws PricingException
Price all the items, and set each of their priceInfo to the result. The pricing models are taken from the supplied PricingModelHolder. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total of all the items
Throws:
PricingException - if there was an error while computing the pricing information

priceItemsForOrderTotal

protected double priceItemsForOrderTotal(Order pOrder,
                                         java.util.Collection pPricingModels,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters)
                                  throws PricingException
Price all the items, and set each of their priceInfo to the result. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total of all the items
Throws:
PricingException - if there was an error while computing the pricing information

priceItemsForOrderTotal

protected double priceItemsForOrderTotal(Order pOrder,
                                         java.util.Collection pPricingModels,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters,
                                         boolean pGenerateOrderRanges)
                                  throws PricingException
Price all the items, and set each of their priceInfo to the result.

Parameters:
pOrder - the order to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
pGenerateOrderRanges - If this is true, CommerceItemManager.generateRangesForOrder
Returns:
the total of all the items
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
CommerceItemManager.generateRangesForOrder(atg.commerce.order.Order)

priceShippingForOrderTotal

public double priceShippingForOrderTotal(Order pOrder,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters)
                                  throws PricingException
Price each shipping group, and set their priceInfo's to the result. The pricing models are gathered from the Shipping Pricing Engine using the profile. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total of all the shipping
Throws:
PricingException - if there was an error while computing the pricing information

priceShippingForOrderTotal

public double priceShippingForOrderTotal(Order pOrder,
                                         PricingModelHolder pPricingModels,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters)
                                  throws PricingException
Price each shipping group, and set their priceInfo's to the result. The pricing models are taken from the supplied PricingModelHolder. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total of all the shipping
Throws:
PricingException - if there was an error while computing the pricing information

priceShippingForOrderTotal

public double priceShippingForOrderTotal(Order pOrder,
                                         java.util.Collection pPricingModels,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters)
                                  throws PricingException
Price each shipping group, and set their priceInfo's to the result This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total of all the shipping
Throws:
PricingException - if there was an error while computing the pricing information

priceShippingForOrderTotal

protected double priceShippingForOrderTotal(Order pOrder,
                                            java.util.Collection pPricingModels,
                                            java.util.Locale pLocale,
                                            RepositoryItem pProfile,
                                            java.util.Map pExtraParameters,
                                            boolean pGenerateOrderRanges)
                                     throws PricingException
Price each shipping group, and set their priceInfo's to the result

Parameters:
pOrder - the order to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
pGenerateOrderRanges - If this is true, CommerceItemManager.generateRangesForOrder
Returns:
the total of all the shipping
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
CommerceItemManager.generateRangesForOrder(atg.commerce.order.Order)

priceOrderForOrderTotal

public double priceOrderForOrderTotal(Order pOrder,
                                      java.util.Locale pLocale,
                                      RepositoryItem pProfile,
                                      java.util.Map pExtraParameters)
                               throws PricingException
Price the sub total and any order level discounts. The OrderPriceInfo of the Order will contain the raw subtotal for all the items, and the amount will include any order level discounts. The tax and shipping are not set. The pricing models are gathered from the Order Pricing Engine using the profile. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total of the order, minus shipping and taxes
Throws:
PricingException - if there was an error while computing the pricing information

priceOrderForOrderTotal

public double priceOrderForOrderTotal(Order pOrder,
                                      PricingModelHolder pPricingModels,
                                      java.util.Locale pLocale,
                                      RepositoryItem pProfile,
                                      java.util.Map pExtraParameters)
                               throws PricingException
Price the sub total and any order level discounts. The OrderPriceInfo of the Order will contain the raw subtotal for all the items, and the amount will include any order level discounts. The tax and shipping are not set. The pricing models are taken from the supplied PricingModelHolder. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total of the order, minus shipping and taxes
Throws:
PricingException - if there was an error while computing the pricing information

priceOrderForOrderTotal

protected double priceOrderForOrderTotal(Order pOrder,
                                         java.util.Collection pPricingModels,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters)
                                  throws PricingException
Price the sub total and any order level discounts. The OrderPriceInfo of the Order will contain the raw subtotal for all the items, and the amount will include any order level discounts. The tax and shipping are not set. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total of the order, minus shipping and taxes
Throws:
PricingException - if there was an error while computing the pricing information

priceOrderForOrderTotal

protected double priceOrderForOrderTotal(Order pOrder,
                                         java.util.Collection pPricingModels,
                                         java.util.Locale pLocale,
                                         RepositoryItem pProfile,
                                         java.util.Map pExtraParameters,
                                         boolean pGenerateOrderRanges)
                                  throws PricingException
Price the sub total and any order level discounts. The OrderPriceInfo of the Order will contain the raw subtotal for all the items, and the amount will include any order level discounts. The tax and shipping are not set. This method assumes the commerce item ranges have been generated.

Parameters:
pOrder - the order to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
pGenerateOrderRanges - If this is true, CommerceItemManager.generateRangesForOrder
Returns:
the total of the order, minus shipping and taxes
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
CommerceItemManager.generateRangesForOrder(atg.commerce.order.Order)

priceTaxForOrderTotal

public double priceTaxForOrderTotal(Order pOrder,
                                    java.util.Locale pLocale,
                                    RepositoryItem pProfile,
                                    java.util.Map pExtraParameters)
                             throws PricingException
Price the taxes for the entire order. The pricing models are gathered from the Tax Pricing Engine using the profile. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total amount in taxes
Throws:
PricingException - if there was an error while computing the pricing information

priceTaxForOrderTotal

public double priceTaxForOrderTotal(Order pOrder,
                                    PricingModelHolder pPricingModels,
                                    java.util.Locale pLocale,
                                    RepositoryItem pProfile,
                                    java.util.Map pExtraParameters)
                             throws PricingException
Price the taxes for the entire order. The pricing models are taken from the supplied PricingModelHolder. This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax).
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total amount in taxes
Throws:
PricingException - if there was an error while computing the pricing information

priceTaxForOrderTotal

public double priceTaxForOrderTotal(Order pOrder,
                                    java.util.Collection pPricingModels,
                                    java.util.Locale pLocale,
                                    RepositoryItem pProfile,
                                    java.util.Map pExtraParameters)
                             throws PricingException
Price the taxes for the entire order This method will regenerate order ranges if necessary

Parameters:
pOrder - the order to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Returns:
the total amount in taxes
Throws:
PricingException - if there was an error while computing the pricing information

priceTaxForOrderTotal

protected double priceTaxForOrderTotal(Order pOrder,
                                       java.util.Collection pPricingModels,
                                       java.util.Locale pLocale,
                                       RepositoryItem pProfile,
                                       java.util.Map pExtraParameters,
                                       boolean pGenerateOrderRanges)
                                throws PricingException
Price the taxes for the entire order

Parameters:
pOrder - the order to price
pPricingModels - the pricing models used in this pricing
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
pGenerateOrderRanges - If this is true, CommerceItemManager.generateRangesForOrder
Returns:
the total amount in taxes
Throws:
PricingException - if there was an error while computing the pricing information
See Also:
CommerceItemManager.generateRangesForOrder(atg.commerce.order.Order)

performPricingOperation

public void performPricingOperation(java.lang.String pPricingOperation,
                                    Order pOrder,
                                    PricingModelHolder pPricingModels,
                                    java.util.Locale pLocale,
                                    RepositoryItem pProfile,
                                    java.util.Map pExtraParameters)
                             throws PricingException
Dispatch off of the Pricing Operation constant supplied to determine what type of pricing should be performed. The operations which are acceptable are defined in the atg.commerce.pricing.PricingConstants interface. They include: If this value is null, then the system will default to ORDER_TOTAL.

Parameters:
pPricingOperation - the pricing operation to perform
pOrder - the order to price
pPricingModels - the PricingModelHolder is an object which contains all the pricing models associated with a user (i.e. item, shipping, order and tax). If this is null, then the pricing models are extracted from the profile through the pricing engines.
pLocale - the locale of the user, may be null
pProfile - the user, may be null
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null
Throws:
PricingException - if there was an error while computing the pricing information

isTaxable

public boolean isTaxable(CommerceItem pItem,
                         ItemPriceInfo pItemPriceInfo,
                         OrderPriceInfo pOrderPriceInfo,
                         Order pOrder,
                         ShippingPriceInfo pShippingPriceInfo,
                         ShippingGroup pShippingGroup,
                         java.util.Locale pLocale,
                         RepositoryItem pProfile,
                         java.util.Map pExtraParameters)
                  throws PricingException
Determines whether a CommerceItem is taxable. This default implementation always returns true (all items are taxable by default).

Parameters:
pItem - the Item whose taxablility is in question
pItemPriceInfo - the price of the item whose taxability is in question
pOrderPriceInfo - the price of the order in which pItem resides
pOrder - the order in which pItem resides
pShippingPriceInfo - the price of the shippingGroup in which pItem resides
pShippingGroup - the shippingGroup in which pItem resides
pLocale - the locale in which the item is being taxed
pProfile - the person for whom pItem may be taxed
pExtraParameters - any extra information that this method may need to determine whether pItem is taxable.
Returns:
true if the item is taxable, false if it is not
Throws:
PricingException - if something prevented PricingTools from determining whether the item is taxable.

calculateTaxableAmount

public double calculateTaxableAmount(CommerceItem pItem,
                                     Order pOrder,
                                     java.util.Locale pLocale,
                                     RepositoryItem pProfile,
                                     java.util.Map pExtraParameters)
                              throws PricingException
Calculates the taxable amount of an item. If the item is not taxable (isTaxable is false) then 0.0 is returned. Otherwise the items order discount share is subtracted from its amount.

Parameters:
pItem - The CommerceItem whose taxable amount is returned
pOrder - The order containing the item
pLocale - The users locale
pProfile - The current users profile
pExtraParameters - any extra information that this method may need
Returns:
the taxable amount of the item
Throws:
PricingException

calculateTaxableAmount

public double calculateTaxableAmount(ShippingGroupCommerceItemRelationship pRelationship,
                                     Order pOrder,
                                     java.util.Locale pLocale,
                                     RepositoryItem pProfile,
                                     java.util.Map pExtraParameters)
                              throws PricingException
Calculates the taxable amount of an relationship. If the relationship's item is not taxable (isTaxable is false) then 0.0 is returned. Otherwise the relationships order discount share is subtracted from its amount. These two numbers are calculated by adding the relevant properties for each of the details withing the same range as the relationship.

Parameters:
pItem - The CommerceItem whose taxable amount is returned
pOrder - The order containing the item
pLocale - The users locale
pProfile - The current users profile
pExtraParameters - any extra information that this method may need
Returns:
The taxable amount of the relationship
Throws:
PricingException
See Also:
getShipItemRelPriceTotal(atg.commerce.order.ShippingGroupCommerceItemRelationship, java.lang.String)

calculateItemsOrderManualAdjustmentShare

public double calculateItemsOrderManualAdjustmentShare(CommerceItem pCommerceItem)
Adds up the manual adjustment share from the item's detailedItemPriceInfos

Parameters:
pCommerceItem -
Returns:
the manual adjustment share for the item

calculateTaxableAmountByAverage

public double calculateTaxableAmountByAverage(ShippingGroupCommerceItemRelationship pRelationship,
                                              Order pOrder,
                                              java.util.Locale pLocale,
                                              RepositoryItem pProfile,
                                              java.util.Map pExtraParameters)
                                       throws PricingException
This method does the same thing as calcualteTaxableAmount except the an average amount is used for the items rather than the actual amount. This is only relevant if shippingSubtotalUsesAverageItemPrice is true.

Parameters:
pItem - The CommerceItem whose taxable amount is returned
pOrder - The order containing the item
pLocale - The users locale
pProfile - The current users profile
pExtraParameters - any extra information that this method may need
Returns:
The taxable amount of the relationship
Throws:
PricingException
See Also:
getShipItemRelPriceTotal(atg.commerce.order.ShippingGroupCommerceItemRelationship, java.lang.String)

calculateTaxableAmountByAverage

public double calculateTaxableAmountByAverage(CommerceItemRelationship pRelationship,
                                              Order pOrder,
                                              java.util.Locale pLocale,
                                              RepositoryItem pProfile,
                                              java.util.Map pExtraParameters)
                                       throws PricingException
This method does the same thing as calcualteTaxableAmount except the an average amount is used for the items rather than the actual amount. This is only relevant if shippingSubtotalUsesAverageItemPrice is true.

Parameters:
pRealationship - The relationship whose taxable amount is returned
pOrder - The order containing the item
pLocale - The users locale
pProfile - The current users profile
pExtraParameters - any extra information that this method may need
Returns:
The taxable amount of the relationship
Throws:
PricingException

getAverageItemPrice

public double getAverageItemPrice(CommerceItem pCommerceItem)
This method will return the average price for a given commerce item. This is used when calculating the subtotal of a shipping group if shippingSubtotalUsesAverageItemPrice

Parameters:
pCommerceItem - The item whose average price is returned
Returns:
The average price

needsRounding

public boolean needsRounding(double pNumber)
This method determines whether the input number needs to be rounded based on the value of the roundingDecimalPlaces property. That is to say, if the input number has more decimal places than N, where N is the value of roundingDecimalPlaces, then the input number needs to be rounded.

Parameters:
pNumber - the number that may need to be rounded
Returns:
true if the number needs to be rounded, false if it does not.

round

public double round(double pNumber)
Rounds the input number to the number of decimal places specified by the roundingDecimalPlaces property. Rounds 1 through 4 down, and 5 through 9 up.

Parameters:
pNumber - the number to be rounded
Returns:
pNumber, rounded to the nearest [roundingDecimalPlaces] decimal points

round

public double round(double pNumber,
                    int pRoundingDecimalPlaces)
Rounds the input number to the number of decimal places specified by the pRoundingDecimalPlaces argument. Rounds 1 through 4 down, and 5 through 9 up.

Parameters:
pNumber - the number to be rounded
pRoundingDecimalPlaces - the number of decimal places to round to
Returns:
pNumber, rounded to the nearest [roundingDecimalPlaces] decimal points

roundDown

public double roundDown(double pNumber)
Rounds the input number to the number of decimal places specified by the roundingDecimalPlaces property. Rounds all numbers beyond the desired number of decimal places to zero.

Parameters:
pNumber - the number to be rounded
Returns:
pNumber, rounded to the nearest [roundingDecimalPlaces] decimal points

getShipItemRelPriceTotal

public double getShipItemRelPriceTotal(ShippingGroupCommerceItemRelationship pRelationship,
                                       java.lang.String pDetailProperty)
                                throws PricingException
Sum the amount for all the details that refer to a specific relationship If the range of the relationship is null, 0.0 is returned. This method assumes the relationship has a range

Parameters:
pRelationship - The relationship to return the subtotal for, using the details within the same range
pDetailProperty -
Returns:
The relationships subtotal, or 0.0 if the relationship, or it's range is null
Throws:
PricingException

getRelationshipsSubtotal

public double getRelationshipsSubtotal(java.util.List pRelationships,
                                       java.lang.String pDetailProperty)
                                throws PricingException
This method will return the sum of the amounts of all the DetailedItemPriceInfos that refer to an item in any of these relationship. The details are identified by comparing the range of the detail to the range of the relationship

Parameters:
pRelationships - The list of relationships to get the amounts for
pDetailProperty - The name of the property in the relationships DetailedItemPriceInfos to sum
Returns:
the sum of the amounts of all the Details for all the relationships
Throws:
PricingException

getItemsOrderDiscountShare

public double getItemsOrderDiscountShare(Order pOrder,
                                         CommerceItem pItem,
                                         double pDiscount)
Get a particular items order discount share. A particular items share of an order discount is proportional to the items share of the entire order cost.

Parameters:
pOrder - The order containing the item
pItem - The commerce item
pDiscount - The size of the discount

calculatePrice

public ItemPriceInfo calculatePrice(RepositoryItem pProduct,
                                    RepositoryItem pSku,
                                    long pQuantity)
                             throws PricingException
Return a price for the given quantity of the product and sku. It will not take any promotions into consideration. The current session scoped profile is used as well as the default locale.

Parameters:
pProduct - The product being priced
pSku - The sku being priced
pQuantity - The quantity of the sku being priced
Returns:
An ItemPriceInfo
Throws:
PricingException

calculatePrice

public ItemPriceInfo calculatePrice(RepositoryItem pProduct,
                                    RepositoryItem pSku,
                                    long pQuantity,
                                    boolean pIgnorePromotions,
                                    RepositoryItem pProfile,
                                    java.util.Locale pLocale,
                                    java.util.Map pExtraParameters)
                             throws PricingException
Return a price for the given quantity of the product and sku

Parameters:
pProduct - The product being priced
pSku - The sku being priced
pQuantity - The quantity of the sku being priced
pIgnorePromotions - If true, then no promotions will be considered. If false then promotions as calculated by priceItem will apply
pProfile - The profile used during the price calculation
pLocale - The locale used during the price calculation
pExtraParameters - Any extra parameters that should be considered
Returns:
An ItemPriceInfo
Throws:
PricingException

getShippingGroupCommerceItemRelationship

public ShippingGroupCommerceItemRelationship getShippingGroupCommerceItemRelationship(CommerceItem pItem,
                                                                                      DetailedItemPriceInfo pPriceInfo)
Return a ShippingGroupCommerceItemRelationship based on the commerceItem and a DetailedItemPriceInfo. It will look through all the ShippingGroupCommerceItemRelationships for that commerceItem and return the one that the range of the DetailedItemPriceInfo lies within the range of that ShippingGroupCommerceItemRelationship.

Parameters:
pItem - The commerceItem
pPriceInfo - The DetailedItemPriceInfo
Returns:
ShippingGroupCommerceItemRelationship

createOrderPriceInfo

public OrderPriceInfo createOrderPriceInfo()
                                    throws PricingException
Returns a new instance of the class defined through the OrderTools.defaultOrderPriceInfoClass property.

Throws:
PricingException - if there was a problem instantiating the object

createSubSkuPriceInfo

protected AmountInfo createSubSkuPriceInfo()
                                    throws PricingException
Returns a new instance of the class defined through the subSkuPriceInfoClass property.

Throws:
PricingException - if there was a problem instantiating the object

createDetailedItemPriceInfo

public DetailedItemPriceInfo createDetailedItemPriceInfo()
                                                  throws PricingException
Returns a new instance of the of the class defined through the detailedItemPriceInfoClass property.

Throws:
PricingException - if there was a problem instantiating the object

createDetailedItemPriceInfo

public DetailedItemPriceInfo createDetailedItemPriceInfo(DetailedItemPriceInfo pDetailedItemPriceInfo)
                                                  throws PricingException
Returns a new instance of the of the class defined through the detailedItemPriceInfoClass property. This method also calls detailedItemPriceInfo.copyDetailProperties with the given detail

Throws:
PricingException - if there was a problem instantiating the object

createInitialSubSkuDetailedPriceInfo

protected DetailedItemPriceInfo createInitialSubSkuDetailedPriceInfo(double pTotalPrice,
                                                                     ItemPriceInfo pPriceQuote,
                                                                     CommerceItem pItem,
                                                                     RepositoryItem pPricingModel,
                                                                     java.util.Locale pLocale,
                                                                     RepositoryItem pProfile,
                                                                     java.util.Map pExtraParameters,
                                                                     java.lang.String pAdjustmentDescription,
                                                                     atg.core.util.Range pRange)
                                                              throws PricingException
Create the initial DetailedItemPriceInfos with the given price for the given range

Parameters:
pTotalPrice - The total price that the new DetailedItemPriceInfos must account for
pPriceQuote - The current working price of pItem.
pItem - The item that is currently being priced.
pPricingModel - the discount that will be set in the PricingAdjustment (usually null)
pProfile - the person for whom the items are to be discounted (currently ignored)
pLocale - the locale in which the items are to be discounted (currently ignored)
pExtraParameters - any extra information that this method might need to set the prices of a number of the qualifying item (currently ignored)
pAdjustmentDescription - This is the adjustment description used when creating all new PricingAdjustments
Returns:
The newly created detail item price info
Throws:
PricingException

setSubSkuPrice

public void setSubSkuPrice(CommerceItem pSubItem,
                           double pUnitPrice,
                           PricingAdjustment pAdjustment,
                           RepositoryItem pPricingModel,
                           java.util.Locale pLocale,
                           RepositoryItem pProfile,
                           java.util.Map pExtraParameters,
                           java.lang.String pMsg,
                           RepositoryItem pPriceList)
                    throws PricingException
Create and set the priceinfo object for a subsku. It will set the list price, amount, raw price, detailed price and adjustments for the subsku

Parameters:
pSubItem - The commerce item corresponding to the sku that need to be priced
pUnitPrice - The working price of the single subsku
pAdjustment - The adjustment associated with this price computation.
pPricingModel - A RepositoryItem representing a PricingModel
pLocale - The user's locale
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null You may override the price list in the profile by providing a price list (or price list id) in this map. Use profilePriceListPropertyName as the key
pMsg - This is the adjustment description used when creating new PricingAdjustments
pPriceList - The priceInfo's pricelist is set to this object.
Throws:
PricingException

setSubSkuSalePrice

public void setSubSkuSalePrice(CommerceItem pSubItem,
                               double pSalePrice,
                               PricingAdjustment pAdjustment,
                               RepositoryItem pPricingModel,
                               java.util.Locale pLocale,
                               RepositoryItem pProfile,
                               java.util.Map pExtraParameters,
                               java.lang.String pMsg,
                               RepositoryItem pPriceList)
                        throws PricingException
Update the priceinfo object for a subsku with a sale price. This assumes the setSubSkuPrice method has already been called.

Parameters:
pSubItem - The commerce item corresponding to the sku that need to be priced
pSalePrice - The working price of the single subsku
pAdjustment - The adjustment associated with this price computation.
pPricingModel - A RepositoryItem representing a PricingModel
pLocale - The user's locale
pProfile - The user's profile
pExtraParameters - A Map of extra parameters to be used in the pricing, may be null You may override the price list in the profile by providing a price list (or price list id) in this map. Use profilePriceListPropertyName as the key
pMsg - This is the adjustment description used when creating new PricingAdjustments
pPriceList - The priceInfo's pricelist is set to this object.
Throws:
PricingException

compareClosenessQualifiers

public void compareClosenessQualifiers(java.util.List pClosenessQualifiers1,
                                       java.util.List pClosenessQualifiers2,
                                       java.lang.String pJMSType,
                                       Order pOrder,
                                       RepositoryItem pProfile)
Checks to see if the closenessQualifiers in the pClosenessQualifiers1 parameter are contained in pClosenessQualifiers2. If not, then a message of type pJMS type is sent. This method is called twice per pricing operation - once with the new closenessQualifiers as pClosenessQualifiers1 and the old closenessQualifiers as pClosenessQualifiers2, and once vice-versa. The former call sends PromotionClosenessQualification messages, the latter sends PromotionClosenessDisqualification messages.

Parameters:
pClosenessQualifiers1 - the Map of closenessQualifiers that are to be compared against pClosenessQualifiers2
pClosenessQualifiers2 - the Map of closenessQualifiers that pClosenessQualifiers1 is to be compared against.
pJMSType - the JMS type of the message to send if a closenessQualifier found in pClosenessQualifiers1 is not contained in pClosenessQualifiers2
pOrder - the order that the closenessQualifiers pertain to
pProfile - the owner of the order

compareQualifiers

protected void compareQualifiers(AmountInfo pOldPriceInfo,
                                 AmountInfo pNewPriceInfo,
                                 Order pOrder,
                                 RepositoryItem pProfile)

firePromotionClosenessMessage

public void firePromotionClosenessMessage(java.lang.String pJMSType,
                                          Order pOrder,
                                          RepositoryItem pProfile,
                                          RepositoryItem pClosenessQualifier)
Constructs and sends a PromotionClosenessMessage of the given JMS type (PromotionClosenessQualification or PromotionClosenessDisqualification)

Parameters:
pJMSType - The JMS type of the message
pOrder - The order that the closenessQualifier is associated with
pProfile - The owner of the order
pPromotion - The promotion that is close to being qualified for
pClosenessQualifier - The closenessQualifier that the order satisfies

sendPromotionClosenessQualificationMessage

protected void sendPromotionClosenessQualificationMessage(PromotionClosenessMessage pMessage)
Sends the given PromotionClosenessMessage.

Parameters:
pMessage - the message to send

doesOrderContainPriceLists

public boolean doesOrderContainPriceLists(Order pOrder)
Returns true if the order contains any price lists on the commerce item price info objects

Parameters:
pOrder -
Returns:
true if there is at least one price list found in the commerce item pricing information.

getListPriceListFromOrder

public RepositoryItem getListPriceListFromOrder(Order pOrder)
Returns the list price list from the order.

The price list is found by looking for a commerce item that is not on sale with a price list associated.

Parameters:
pOrder -
Returns:
price list item

getSalePriceListFromOrder

public RepositoryItem getSalePriceListFromOrder(Order pOrder)
Returns the sale price list from the order.

The price list from the first on sale commerce item in the order is returned. with a price list associated.

Parameters:
pOrder -
Returns:
price list item

getPricingLocale

public java.util.Locale getPricingLocale(RepositoryItem pProfile,
                                         java.lang.String pPriceListPropertyName,
                                         boolean pUseDefaultPriceList,
                                         java.util.Map pExtraParameters,
                                         java.util.Locale pLocale)
Gets the locale for pricing. If usePriceListLocale is true then it first obtains the price list to use and tries to use it's locale. If price lists aren't in use, can't be obtained or has no locale then it will use the default locale If the default locale isn't configured then the locale passed in is returned.

Parameters:
pProfile - RepositoryItem profile
pProfilePriceListPropertyName - String name of the price list property in the profile
pUseDefaultPriceList - boolean, true to use the default price list if needed
pExtraParameters - Optional map of extra parameters which may include the price list
pLocale - Locale to use if no price list or default locale is found
Returns:
Locale to use for this pricing

getPriceList

public RepositoryItem getPriceList(RepositoryItem pProfile,
                                   java.lang.String pPriceListPropertyName,
                                   boolean pUseDefaultPriceList,
                                   java.util.Map pExtraParameters)
                            throws PriceListException
Gets the price list. First checks the extra parameters and then checks the profile. If the profile doesn't have a price list then it will optionally use the default price list. This method requires the priceListManager property to be configured for this component otherwise it will assume that price lists are not being used and return null.

Parameters:
pProfile - RepositoryItem profile
pPriceListPropertyName - String name of the price list property in the profile
pUseDefaultPriceList - boolean, true to use the default if one isn't found in the profile
pExtraParameters - Optional map of extra parameters which may include the price list
Returns:
RepositoryItem price list
Throws:
PriceListException

getPriceListFromParameters

public RepositoryItem getPriceListFromParameters(java.util.Map pExtraParameters,
                                                 java.lang.String pPriceListPropertyName)
                                          throws PriceListException
Get the price list from the extra parameters. This should return null if you would rather use the price list out of the profile. This method looks up pExtraParameters map using the key either passed in if specified or by using the PriceListManager.priceListPropertyName property. If it is present, then the price list mapped to by that key is returned. If the value in the map is a String, then it is assumed that this is a price list id, and the PriceListManager is used to look up the price. This method requires the priceListManager to be configured for this component otherwise it will assume that price lists are not being used and return null. Note: This method is called from ItemPriceCalculator.getDifferentPriceList()

Parameters:
pExtraParameters - Map of extra parameters to look up
pPriceListPropertyName - String name of the price list in the extra parameters map, if null then PriceListManager.priceListPropertyName is used.
Returns:
a priceList repositoryItem, or null if not found
Throws:
PriceListException

generatePriceBeans

public java.util.List generatePriceBeans(CommerceItem pItem)
Given a commerce item, loop through its detailed item price infos and create the price beans.

Parameters:
pItem - The commerce item to generate beans for
Returns:
list of beans with price infos

generatePriceBeans

public java.util.List generatePriceBeans(java.util.List<DetailedItemPriceInfo> pInfos)
Given a list of detailed item price infos, loop through each one and create the price beans.

Parameters:
pInfos - The list of DetailedItemPriceInfo
Returns:
list of beans with price infos

addPriceBeanForInfo

protected void addPriceBeanForInfo(DetailedItemPriceInfo pInfo,
                                   java.util.List pBeans)
Given a DetailedItemPrice info, check the list of beans to see if one has the same unit price and pricing model adjusters. If it does then just increment the quantity of that bean. Otherwise create a new bean just for it and add to the list

Parameters:
pInfo - The detailed item price info to get data from
pBeans - List of UnitPriceBeans

createItemPriceSource

public ItemPriceSource createItemPriceSource(java.lang.String pProductId,
                                             java.lang.String pSkuId,
                                             java.lang.String pParentSkuId,
                                             java.lang.String pCommerceItemType,
                                             java.lang.String pCurrencyCode)
Instantiates a new ItemPriceSource object with the given parameters.

Parameters:
pProductId - the productid to which the source applies
pSkuId - the skuid to which the source applies
pParentSkuId - the parent sku id to which the source applies
pCommerceItemType - the commerce item type to which the source applies
pCurrencyCode - the currency to which the source applies.
Returns:

createItemPriceSource

public ItemPriceSource createItemPriceSource(CommerceItem pCommerceItem,
                                             CommerceItem pParentCommerceItem,
                                             java.lang.String pCurrencyCode)
Creates a new ItemPriceSource object based on the given item and parent item. The product, sku, parent sku and commerce item type properties will be set.

Parameters:
pCommerceItem -
pParentCommerceItem -
pCurrencyCode - the currency for which the source object can apply
Returns:
a new ItemPriceSource
See Also:
createItemPriceSource(String, String, String, String, String)

generateItemPriceSources

public java.util.List generateItemPriceSources(Order pOrder,
                                               java.util.Map pExtraParameters)
Generates a List of ItemPriceSource objects based on the pricing information contained in the given Order.

One ItemPriceSource is generated for each item in the order. Each configured ItemPriceSource is called once for each ItemPriceSource to populate it values.

Parameters:
pExtraParameters - Map of extra parameters that will passed through to the handlers that generate the source objects.

generateItemPriceSources

protected void generateItemPriceSources(java.util.List pItemPriceSources,
                                        Order pOrder,
                                        CommerceItem pCommerceItem,
                                        CommerceItem pParentCommerceItem,
                                        java.lang.String pCurrencyCode,
                                        java.util.Map pExtraParameters)
Creates a new ItemPriceSource object and calls each handler to populate its values.

Parameters:
pItemPriceSources - the current list of source objects. the new source object will be appended to this List
pOrder - the order that contains the commerce item
pCommerceItem - the commerce item from which the source object will be created
pParentCommerceItem - the parent commerce item of pCommerceItem. this can be null
pCurrencyCode -
pExtraParameters -

generateItemPricingSourceMap

public java.util.Map generateItemPricingSourceMap(java.util.List pItemPriceSources,
                                                  java.util.List pCommerceItems,
                                                  CommerceItem pParentCommerceItem,
                                                  java.lang.String pCurrencyCode)
Maps the CommerceItems to the ItemPriceSource objects

This method is called by the ItemPricingEngine to map a List of source objects to the items being priced in the current pricing operation.

If a CommerceItem is a CommerceItemContainer this method is recursive in order to match the contained items as well.

Parameters:
pItemPriceSources - the ItemPriceSource objects to match with the items.
pCommerceItems - the CommerceItems to match
pParentCommerceItem - optional parent commerce item that contains the list of commerce items. If not null, the parent sku must match the parent sku in the override.
pCurrencyCode - the currency code of the current pricing operation. This currency must match the currency code in the ItemPriceSource for it to be mapped to an item.
Returns:
Map of commerce item id to ItemPriceSource

findMatchingSource

public ItemPriceSource findMatchingSource(java.util.Collection pItemPriceSource,
                                          CommerceItem pCommerceItem,
                                          CommerceItem pParentCommerceItem,
                                          java.lang.String pCurrencyCode)
Iterates over the collection of ItemPriceSource objects and returns the first one that matches the given item and parent item combination

Parameters:
pItemPriceSource -
pCommerceItem -
pParentCommerceItem -
pCurrencyCode - if provided the currency code must be the same for a successful match
Returns:
the ItemPriceSource object that matches
See Also:
ItemPriceSource.isItemMatch(CommerceItem, CommerceItem)

getItemPriceSource

public ItemPriceSource getItemPriceSource(ItemPriceInfo pPriceQuote,
                                          CommerceItem pItem,
                                          RepositoryItem pPricingModel,
                                          java.util.Locale pLocale,
                                          RepositoryItem pProfile,
                                          java.util.Map pExtraParameters)
This method returns the ItemPriceSource mapped to the commerce item id in the pricing overide Map stored in the extra parameters.

Calculators use this method to determine if an ItemPriceSource was passed into the pricing operation through the extra parameters.

Parameters:
pItem - the CommerceItem for which a ItemPriceSource should be returned
pExtraParams - the pricing operations extra parameters Map
Returns:
ItemPriceSource that matches the CommerceItem
See Also:
PricingConstants.ITEM_PRICE_SOURCE_MAP_PARAM

findAdjustmentsByDescription

public java.util.List findAdjustmentsByDescription(ItemPriceInfo pItemPriceInfo,
                                                   java.lang.String pDescription)
Returns all the PricingAdjustments found in the price info's adjustments property whose description matches the given description

Parameters:
pItemPriceInfo - the price info containing the adjustments.
pDescription - the description to match
Returns:
a list of adjustments that match

getTotalQuantityForBulkPricing

public long getTotalQuantityForBulkPricing(java.util.List pItems,
                                           CommerceItem pItem)
Returns the total quantity of the items in the List that match the given pItem.

This method is used by the bulk pricing calculators to aggregate quantity for matching items so the correct level is used across the items.

Parameters:
pItems -
pItem -
Returns:
the total quantity
See Also:
isMatchForBulkPricing(CommerceItem, CommerceItem)

isMatchForBulkPricing

protected boolean isMatchForBulkPricing(CommerceItem pItem1,
                                        CommerceItem pItem2)
determines if the two items should be considered a match for aggregating quantity

Parameters:
pItem1 -
pItem2 -
Returns:
true if considered a match
See Also:

By default, the product id and sku id must be equal to be considered a match.


generateKeyForTieredProcessedItem

public java.lang.Object generateKeyForTieredProcessedItem(CommerceItem pItem)
Called by the tiered pricing calculators to generate the key used to store the quantity info about an Item processed during the pricing operation.

This quantity info is used to maintain tier levels across multiple items that reference the same product/sku combination. By default the key returned is a String concat of the product id and sku id.

Parameters:
pItem -
Returns:
Object key