Class PricingBackendPPS
java.lang.Object
com.sap.retail.sapppspricing.impl.PricingBackendPPS
- All Implemented Interfaces:
PricingBackend
Implementation of
PricingBackend performing the calls for catalog or
basket pricing against an embedded or remote PPS. Takes care for request
creation as well as mapping the response to the corresponding hybris objects-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected de.hybris.platform.jalo.order.price.PriceInformationRetrieves price information from the cache for a given product.protected de.hybris.platform.jalo.order.price.PriceInformationfetchPriceInformationFromOPPS(ProductModel product, boolean isNet) Retrieves the price information of a product from the OPPSfetchProductPromotions(ProductModel product, boolean isNet) Retrieves the list of promotions for a given product from the OPPS .protected OPPSPriceAndPromotionsCacheKeygenerateCacheKey(ProductModel prod) Generates a cache key based on the provided product.de.hybris.platform.store.services.BaseStoreServicede.hybris.platform.servicelayer.i18n.CommonI18NServicedoublede.hybris.platform.integrationservices.cache.IntegrationCache<OPPSPriceAndPromotionsCacheKey,OPPSPriceAndPromotionsData> de.hybris.platform.servicelayer.user.UserServicebooleanprotected OPPSPriceAndPromotionsDataprocessOPPSResponse(ProductModel product, boolean isNet) Processes the OPPS response for a given product and calculates the final price along with applicable promotions.List<de.hybris.platform.jalo.order.price.PriceInformation>readPriceInformationForProducts(List<ProductModel> productModels, boolean isNet) Price calculation for a list of productsprotected Map<ProductModel,de.hybris.platform.jalo.order.price.PriceInformation> readPriceInfosFromPps(List<ProductModel> prods, boolean isNet) Retrieves the price information for a list of products from the OPPS.voidPrice calculation for a cartvoidsetAccessor(PPSClientBeanAccessor accessor) voidsetBaseStoreService(de.hybris.platform.store.services.BaseStoreService baseStoreService) voidsetCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService) voidsetConfigService(PPSConfigService configService) voidsetHighPrice(double highPrice) voidsetOppsPriceAndPromotionsCache(de.hybris.platform.integrationservices.cache.IntegrationCache<OPPSPriceAndPromotionsCacheKey, OPPSPriceAndPromotionsData> oppsPriceAndPromotionsCache) voidsetPpsClient(PPSClient ppsClient) voidsetRequestCreator(PPSRequestCreator creator) voidsetResultToOrderMappers(List<PriceCalculateToOrderMapper> resultToOrderMappers) voidsetUseHighPrice(boolean useHighPrice) voidsetUserService(de.hybris.platform.servicelayer.user.UserService userService) protected voidupdateOPPSPriceAndPromotionsInCache(ProductModel prod, double calculatedPrice, String currencyCode, List<String> promotions) Updates the cache with OPPS price and promotions for a product.
-
Constructor Details
-
PricingBackendPPS
public PricingBackendPPS()
-
-
Method Details
-
readPricesForCart
Description copied from interface:PricingBackendPrice calculation for a cart- Specified by:
readPricesForCartin interfacePricingBackend
-
readPriceInformationForProducts
public List<de.hybris.platform.jalo.order.price.PriceInformation> readPriceInformationForProducts(List<ProductModel> productModels, boolean isNet) Description copied from interface:PricingBackendPrice calculation for a list of products- Specified by:
readPriceInformationForProductsin interfacePricingBackend- Returns:
- List
-
fetchProductPromotions
Retrieves the list of promotions for a given product from the OPPS .- Specified by:
fetchProductPromotionsin interfacePricingBackend- Parameters:
product- The product for which promotions are to be fetched.- Returns:
- A list of promotions associated with the product. If no promotions are found, an empty list is returned.
-
processOPPSResponse
Processes the OPPS response for a given product and calculates the final price along with applicable promotions.- Parameters:
product- The product for which the OPPS response is processed.isNet- A boolean indicating whether the pricing should be calculated net or gross.- Returns:
- An OPPSPriceAndPromotionsData object containing the calculated price, currency code, and promotions.
- Throws:
SapPPSPricingRuntimeException- If an error occurs while processing the OPPS response.
-
fetchPriceInformationFromOPPS
protected de.hybris.platform.jalo.order.price.PriceInformation fetchPriceInformationFromOPPS(ProductModel product, boolean isNet) Retrieves the price information of a product from the OPPS- Parameters:
product- The product for which the OPPS price is processed.isNet- A boolean indicating whether the pricing should be calculated net or gross.sapConfig-- Returns:
- A PriceInformation
-
updateOPPSPriceAndPromotionsInCache
protected void updateOPPSPriceAndPromotionsInCache(ProductModel prod, double calculatedPrice, String currencyCode, List<String> promotions) Updates the cache with OPPS price and promotions for a product.- Parameters:
prod- The product for which the cache is to be updated.calculatedPrice- The calculated price to be stored in the cache.currencyCode- The currency code associated with the calculated price.promotions- A list of promotions associated with the product.
-
readPriceInfosFromPps
protected Map<ProductModel,de.hybris.platform.jalo.order.price.PriceInformation> readPriceInfosFromPps(List<ProductModel> prods, boolean isNet) Retrieves the price information for a list of products from the OPPS.- Parameters:
prods- The list of products for which price information is to be fetched.isNet- A boolean indicating whether net price information is requested.- Returns:
- A map containing products as keys and their corresponding price information as values.
-
fetchPriceInformationFromCache
protected de.hybris.platform.jalo.order.price.PriceInformation fetchPriceInformationFromCache(ProductModel prod) Retrieves price information from the cache for a given product.- Parameters:
prod- The product for which price information is to be fetched from the cache.- Returns:
PriceInformationobject containing the cached price details for the product. Returnsnullif no cached information is found.
-
generateCacheKey
Generates a cache key based on the provided product.- Parameters:
prod- The product for which the cache key is to be generated.- Returns:
OPPSPriceAndPromotionsCacheKeyrepresenting the cache key for the given product.
-
getPpsClient
-
setPpsClient
-
getAccessor
-
setAccessor
-
getResultToOrderMappers
-
setResultToOrderMappers
-
getRequestCreator
-
setRequestCreator
-
getCommonI18NService
public de.hybris.platform.servicelayer.i18n.CommonI18NService getCommonI18NService() -
setCommonI18NService
public void setCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService) -
getHighPrice
public double getHighPrice() -
setHighPrice
public void setHighPrice(double highPrice) -
getConfigService
-
setConfigService
-
isUseHighPrice
public boolean isUseHighPrice() -
setUseHighPrice
public void setUseHighPrice(boolean useHighPrice) -
getOppsPriceAndPromotionsCache
public de.hybris.platform.integrationservices.cache.IntegrationCache<OPPSPriceAndPromotionsCacheKey,OPPSPriceAndPromotionsData> getOppsPriceAndPromotionsCache()- Returns:
- the oppsPriceAndPromotionsCache
-
setOppsPriceAndPromotionsCache
public void setOppsPriceAndPromotionsCache(de.hybris.platform.integrationservices.cache.IntegrationCache<OPPSPriceAndPromotionsCacheKey, OPPSPriceAndPromotionsData> oppsPriceAndPromotionsCache) - Parameters:
oppsPriceAndPromotionsCache- the oppsPriceAndPromotionsCache to set
-
getUserService
public de.hybris.platform.servicelayer.user.UserService getUserService()- Returns:
- the userService
-
setUserService
public void setUserService(de.hybris.platform.servicelayer.user.UserService userService) - Parameters:
userService- the userService to set
-
getBaseStoreService
public de.hybris.platform.store.services.BaseStoreService getBaseStoreService()- Returns:
- the baseStoreService
-
setBaseStoreService
public void setBaseStoreService(de.hybris.platform.store.services.BaseStoreService baseStoreService) - Parameters:
baseStoreService- the baseStoreService to set
-