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, atg.nucleus.logging.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
           
 
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
 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(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
 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 firePromotionClosenessMessage(java.lang.String pJMSType, Order pOrder, RepositoryItem pProfile, RepositoryItem pClosenessQualifier)
          Constructs and sends a PromotionClosenessMessage of the given JMS type (PromotionClosenessQualification or PromotionClosenessDisqualification)
 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
 ItemPricingEngine getItemPricingEngine()
          Returns property ItemPricingEngine
 double getItemsOrderDiscountShare(Order pOrder, CommerceItem pItem, double pDiscount)
          Get a particular items order discount share.
 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 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
 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
 boolean isGeneratePriceChangedEvents()
          If this is true, whenever an order gets repriced and the price is different, a PriceChanged event will be sent
 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 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 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 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)
           
 
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, doStartService, 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, 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
Constructor Detail

PricingTools

public PricingTools()
Constructs an instanceof PricingTools

Method Detail

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.

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)

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)

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)

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

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