Class AbstractPriceFactory
- All Implemented Interfaces:
ItemLifecycleListener,PriceFactory,Serializable
- Direct Known Subclasses:
DummyPriceFactory,GeneratedEurope1PriceFactory
A PriceFactory is responsible for calculating product price quotes as well as order prices. This may include the calcuation of taxes and discounts.
The Hybris Platform core does not have any default price model implemented but usually ships one PriceFactory implementation (in form of an extension) within the installation package. So please refer to the available extension documentation about which features this price model provides.
To implement a PriceFactory at least the following methods have to be implemented:
getBasePrice(AbstractOrderEntry)- provides the base price for aorder entrygetProductPriceInformations(Product, Date, boolean)- provides all prices which apply to aProductgetProductTaxInformations(Product, Date)- provides all taxes which apply to aProductgetProductDiscountInformations(Product, Date, boolean)- provides all discounts which apply to aProduct
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.jalo.extension.Extension
Extension.RestrictedLanguagesProvider, Extension.RightsProviderNested classes/interfaces inherited from class de.hybris.platform.jalo.Manager
Manager.GenericManagerSingletonCreator, Manager.ManagerSingletonCreator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ProductPriceInformationsgetAllPriceInformations(Product product, Date date, boolean net) Deprecated.getAllPriceInformations(SessionContext ctx, Product product, Date date, boolean net) Calculates a product price quote containing all applicable prices, discounts and taxes for the given product and net/gross state.abstract PriceValuegetBasePrice(AbstractOrderEntry entry) override to define the base price of an order entrygetDiscountValues(AbstractOrder order) override to define (global) discounts for an order.override to define discount values for an order entry.static AbstractPriceFactoryfinal ListgetProductDiscountInformations(Product product, Date date, boolean net) Deprecated.since ages - please usegetProductDiscountInformations(SessionContext, Product, Date, boolean)insteadabstract ListgetProductDiscountInformations(SessionContext ctx, Product product, Date date, boolean net) override this to show all discounts which may apply to the given productfinal ListgetProductPriceInformations(Product product, Date date, boolean net) Deprecated.since ages - please usegetProductPriceInformations(SessionContext, Product, Date, boolean)insteadabstract ListgetProductPriceInformations(SessionContext ctx, Product product, Date date, boolean net) Override this to show all prices available for the given productfinal ListgetProductTaxInformations(Product product, Date date) Deprecated.since ages - please usegetProductTaxInformations(SessionContext, Product, Date)insteadabstract ListgetProductTaxInformations(SessionContext ctx, Product product, Date date) override this to show all taxes which apply to the given productgetTaxValues(AbstractOrderEntry entry) override to define tax values for an order entry.booleanoverride to define whether a user should be treated as net or gross customer.Methods inherited from class de.hybris.platform.jalo.extension.Extension
checkBeforeInitialization, checkBeforeItemRemoval, createEssentialData, createProjectData, createSampleData, getCreatorDescription, getCreatorName, getCreatorParameterDefault, getCreatorParameterNames, getCreatorParameterPossibleValues, getDefaultAttributeModes, getName, getRemote, isCreatorDisabled, notifyInitializationEnd, notifyInitializationStart, notifyItemRemoval, onFirstSessionCreation, writeReplaceMethods inherited from class de.hybris.platform.jalo.Manager
afterItemCreation, beforeItemCreation, destroy, extractNonRequiredRemoteFromItem, extractRequiredRemoteFromItem, getAllValuesSessionContext, getAttribute, getAttributeMap, getFirstItemByAttribute, getFirstItemByAttribute, getRemoteManagerClass, getSession, getSingletonManagerInstance, getTenant, getTransientObject, getTransientObjectMap, init, setAttribute, setTenant, setTransientObject, wrap
-
Constructor Details
-
AbstractPriceFactory
public AbstractPriceFactory()
-
-
Method Details
-
getInstance
-
getAllPriceInformations
@Deprecated(since="ages", forRemoval=false) public final ProductPriceInformations getAllPriceInformations(Product product, Date date, boolean net) throws JaloPriceFactoryException Deprecated.since ages - please usegetAllPriceInformations(SessionContext, Product, Date, boolean)instead- Throws:
JaloPriceFactoryException- if a calculation error occured
-
getAllPriceInformations
public ProductPriceInformations getAllPriceInformations(SessionContext ctx, Product product, Date date, boolean net) throws JaloPriceFactoryException Calculates a product price quote containing all applicable prices, discounts and taxes for the given product and net/gross state.This default implementation just calls
getProductPriceInformations(Product, Date, boolean),getProductTaxInformations(Product, Date)andgetProductDiscountInformations(Product, Date, boolean)and wraps the results inside aProductPriceInformationsobject.Override to define the prices, taxes and discounts for all occasions when no order or order entry is available, e.g. for product lists. Please take care also to override
getProductPriceInformations(Product, Date, boolean),getProductTaxInformations(Product, Date)andgetProductDiscountInformations(Product, Date, boolean)since these methods are called byProductdirectly.- Specified by:
getAllPriceInformationsin interfacePriceFactory- Throws:
JaloPriceFactoryException- if a calculation error occured- Since:
- 2.10
-
getProductPriceInformations
@Deprecated(since="ages", forRemoval=false) public final List getProductPriceInformations(Product product, Date date, boolean net) throws JaloPriceFactoryException Deprecated.since ages - please usegetProductPriceInformations(SessionContext, Product, Date, boolean)instead- Parameters:
product- the productnet- the net/gross state of the requested prices- Returns:
- a list of
PriceInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured
-
getProductPriceInformations
public abstract List getProductPriceInformations(SessionContext ctx, Product product, Date date, boolean net) throws JaloPriceFactoryException Override this to show all prices available for the given product- Specified by:
getProductPriceInformationsin interfacePriceFactory- Parameters:
product- the productnet- the net/gross state of the requested prices- Returns:
- a list of
PriceInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured- Since:
- 2.10
-
getProductTaxInformations
@Deprecated(since="ages", forRemoval=false) public final List getProductTaxInformations(Product product, Date date) throws JaloPriceFactoryException Deprecated.since ages - please usegetProductTaxInformations(SessionContext, Product, Date)instead- Parameters:
product- the product- Returns:
- a list of
TaxInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured
-
getProductTaxInformations
public abstract List getProductTaxInformations(SessionContext ctx, Product product, Date date) throws JaloPriceFactoryException override this to show all taxes which apply to the given product- Specified by:
getProductTaxInformationsin interfacePriceFactory- Parameters:
product- the product- Returns:
- a list of
TaxInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured- Since:
- 2.10
-
getProductDiscountInformations
@Deprecated(since="ages", forRemoval=false) public final List getProductDiscountInformations(Product product, Date date, boolean net) throws JaloPriceFactoryException Deprecated.since ages - please usegetProductDiscountInformations(SessionContext, Product, Date, boolean)instead- Parameters:
product- the product- Returns:
- a list of
DiscountInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured
-
getProductDiscountInformations
public abstract List getProductDiscountInformations(SessionContext ctx, Product product, Date date, boolean net) throws JaloPriceFactoryException override this to show all discounts which may apply to the given product- Specified by:
getProductDiscountInformationsin interfacePriceFactory- Parameters:
product- the product- Returns:
- a list of
DiscountInformationobjects - Throws:
JaloPriceFactoryException- if price calculation error occured- Since:
- 2.10
-
isNetUser
override to define whether a user should be treated as net or gross customer.- Specified by:
isNetUserin interfacePriceFactory- Returns:
- false as default
-
getTaxValues
override to define tax values for an order entry.- Specified by:
getTaxValuesin interfacePriceFactory- Returns:
- empty list as default
- Throws:
JaloPriceFactoryException
-
getBasePrice
override to define the base price of an order entry- Specified by:
getBasePricein interfacePriceFactory- Returns:
- a price with the order's currency iso code, 0.0 as value and the order's net status
- Throws:
JaloPriceFactoryException
-
getDiscountValues
override to define discount values for an order entry.- Specified by:
getDiscountValuesin interfacePriceFactory- Returns:
- empty list as default
- Throws:
JaloPriceFactoryException
-
getDiscountValues
override to define (global) discounts for an order. these discounts are applied to the whole order, not just to one entry likegetDiscountValues(AbstractOrderEntry)- Specified by:
getDiscountValuesin interfacePriceFactory- Returns:
- empty list as default
- Throws:
JaloPriceFactoryException
-
getAllPriceInformations(SessionContext, Product, Date, boolean)instead