com.ibm.commerce.price.utils

Class PriceUtil

  • java.lang.Object
    • com.ibm.commerce.price.utils.PriceUtil


  • public class PriceUtil
    extends java.lang.Object
    This utility class hides pricing details. Its purpose is for various DataBeans to get price information easily.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      PriceUtil() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static PriceDataBean getStandardPrice(java.lang.String catEntryID, com.ibm.commerce.command.CommandContext cmdCtx)
      Gets a PriceDataBean that represents the standard contract price for the item.
      static PriceDataBean getStandardPrice(java.lang.String orderItemId, com.ibm.commerce.command.CommandContext cmdCtx, boolean forSingleUnit)
      Gets the standard offer price for order item.
      static PriceDataBean getStandardPrice(java.lang.String catEntryID, com.ibm.commerce.command.CommandContext cmdCtx, java.lang.String currency)
      Gets a PriceDataBean that represents the standard contract price for the item.
      static PriceDataBean getStandardPrice(java.lang.String catEntryID, java.lang.String quantityToUse, com.ibm.commerce.command.CommandContext cmdCtx, java.lang.String currency, boolean forSingleUnit)
      Gets a PriceDataBean that represents the standard contract price for the order item, the return result could be the sum of all the order item unit price or single unit price.
      static PriceDataBean[] getStandardPrices(java.lang.Long[] orderItemIds, com.ibm.commerce.command.CommandContext cmdCtx, boolean forSingleUnit)
      Gets the standard offer prices for order items.
      static PriceDataBean[] getStandardPrices(java.lang.Long[] catEntryIDs, QuantityAmount[] quantities, com.ibm.commerce.command.CommandContext cmdCtx)
      Gets a PriceDataBean[] that represent the standard contract prices for the list of items.
      static PriceDataBean[] getStandardPrices(java.lang.Long[] catEntryIDs, QuantityAmount[] quantities, com.ibm.commerce.command.CommandContext cmdCtx, java.lang.String currency)
      Gets a PriceDataBean[] that represent the standard contract prices for the list of items.
      static PriceDataBean[] getStandardPrices(java.lang.Long[] catEntryIDs, QuantityAmount[] quantities, com.ibm.commerce.command.CommandContext cmdCtx, java.lang.String currency, boolean forSingleUnit)
      Gets a PriceDataBean[] that represent the standard contract prices for the list of items.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PriceUtil

        public PriceUtil()
    • Method Detail

      • getStandardPrice

        public static PriceDataBean getStandardPrice(java.lang.String catEntryID,
                                                     com.ibm.commerce.command.CommandContext cmdCtx)
        Gets a PriceDataBean that represents the standard contract price for the item.
        Parameters:
        catEntryID - A catalog entry ID string
        cmdCtx - A CommandContext object
        Returns:
        The PriceDataBean. Return null if exception encountered.
      • getStandardPrice

        public static PriceDataBean getStandardPrice(java.lang.String orderItemId,
                                                     com.ibm.commerce.command.CommandContext cmdCtx,
                                                     boolean forSingleUnit)
        Gets the standard offer price for order item.
        Parameters:
        orderItemId - Order Item Identifier
        cmdCtx - Command context instance
        forSingleUnit - Set true if want to return a standard price for a single unit within this offer, doesn't matter how many in the order. set false if want to return a sum of standard price for the number of units.
        Returns:
        A PriceDataBean represents the standard offer price.
      • getStandardPrice

        public static PriceDataBean getStandardPrice(java.lang.String catEntryID,
                                                     com.ibm.commerce.command.CommandContext cmdCtx,
                                                     java.lang.String currency)
        Gets a PriceDataBean that represents the standard contract price for the item. This method doesn't specify quantity for price search, so the assumption is to buy 1 single unit item.
        Parameters:
        catEntryID - A catalog entry ID string
        cmdCtx - A CommandContext object
        currency - The currency under which to price the catalog entry. If null, the currency in the command context will be used.
        Returns:
        The PriceDataBean. Return null if exception encountered.
      • getStandardPrice

        public static PriceDataBean getStandardPrice(java.lang.String catEntryID,
                                                     java.lang.String quantityToUse,
                                                     com.ibm.commerce.command.CommandContext cmdCtx,
                                                     java.lang.String currency,
                                                     boolean forSingleUnit)
        Gets a PriceDataBean that represents the standard contract price for the order item, the return result could be the sum of all the order item unit price or single unit price. For exmaple, if the price range is:
      • quantity 1-2 get $5.00 per item
      • quantity 3-more get $4.00 per item then the result of call getStandardPrice(yourCatEntryID, 3, commandContext, USD, false) will be $12.00, which is $4 x 3. The result of call getStandardPrice(yourCatEntryID, 3, commandContext, USD, true) will be $4.00. The result of call getStandardPrice(yourCatEntryID, 2, commandContext, USD, false) will be $10.00, which is $5 x 2. The result of call getStandardPrice(yourCatEntryID, 2, commandContext, USD, true) will be $5.00.
Parameters:
catEntryID - A catalog entry ID string
quantityToUse - the quantity of the unit this order item potentially contains.
cmdCtx - A CommandContext object
currency - The currency under which to price the catalog entry. If null, the currency in the command context will be used.
boolean - set true if want to return a standard price for a single unit within this offer, doesn't matter how many in the order. set false if want to return a sum of standard price for the number of units. (Number is defined by QuantityAmount.)
Returns:
The PriceDataBean. Return null if exception encountered.
  • getStandardPrices

    public static PriceDataBean[] getStandardPrices(java.lang.Long[] orderItemIds,
                                                    com.ibm.commerce.command.CommandContext cmdCtx,
                                                    boolean forSingleUnit)
                                             throws com.ibm.commerce.exception.ECException
    Gets the standard offer prices for order items.
    Parameters:
    orderItemIds - An array of order item identifiers
    cmdCtx - Command context instance
    forSingleUnit - Set true if want to return a standard price for a single unit within this offer, doesn't matter how many in the order. set false if want to return a sum of standard price for the number of units.
    Returns:
    An array of PriceDataBean represents the standard offer prices
    Throws:
    com.ibm.commerce.exception.ECException
  • getStandardPrices

    public static PriceDataBean[] getStandardPrices(java.lang.Long[] catEntryIDs,
                                                    QuantityAmount[] quantities,
                                                    com.ibm.commerce.command.CommandContext cmdCtx)
                                             throws com.ibm.commerce.exception.ECException
    Gets a PriceDataBean[] that represent the standard contract prices for the list of items.
    Parameters:
    catEntryIDs - An array of catalog entry ID strings
    quantities - An array of QuantityAmount objects
    cmdCtx - A CommandContext object
    Returns:
    The PriceDataBean[].
    Throws:
    com.ibm.commerce.exception.ECException - An exception occurs during the execution of the method.
  • getStandardPrices

    public static PriceDataBean[] getStandardPrices(java.lang.Long[] catEntryIDs,
                                                    QuantityAmount[] quantities,
                                                    com.ibm.commerce.command.CommandContext cmdCtx,
                                                    java.lang.String currency)
                                             throws com.ibm.commerce.exception.ECException
    Gets a PriceDataBean[] that represent the standard contract prices for the list of items. Each price is based on total quantity of each item set. For example, if buy 3 item A together, the returned standard price is the 3 x A's standard price.
    Parameters:
    catEntryIDs - An array of catalog entry ID strings
    quantities - An array of QuantityAmount objects
    cmdCtx - A CommandContext object
    currency - the currency under which to price. If null, the currency stored in the command context will be used.
    Returns:
    The PriceDataBean[].
    Throws:
    com.ibm.commerce.exception.ECException - An exception occurs during the execution of the method.
  • getStandardPrices

    public static PriceDataBean[] getStandardPrices(java.lang.Long[] catEntryIDs,
                                                    QuantityAmount[] quantities,
                                                    com.ibm.commerce.command.CommandContext cmdCtx,
                                                    java.lang.String currency,
                                                    boolean forSingleUnit)
                                             throws com.ibm.commerce.exception.ECException
    Gets a PriceDataBean[] that represent the standard contract prices for the list of items.
    Parameters:
    catEntryIDs - An array of catalog entry ID strings
    quantities - An array of QuantityAmount objects
    cmdCtx - A CommandContext object
    currency - the currency under which to price. If null, the currency stored in the command context will be used.
    boolean - set true if want to return a standard price for a single unit within this offer, doesn't matter how many in the order. set false if want to return a sum of standard price for the number of units. (Number is defined by QuantityAmount.)
    Returns:
    The PriceDataBean[].
    Throws:
    com.ibm.commerce.exception.ECException - An exception occurs during the execution of the method.