Class PricingBackendPPS

java.lang.Object
com.sap.retail.sapppspricing.impl.PricingBackendPPS
All Implemented Interfaces:
PricingBackend

public class PricingBackendPPS extends Object implements 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 Details

    • PricingBackendPPS

      public PricingBackendPPS()
  • Method Details

    • readPricesForCart

      public void readPricesForCart(AbstractOrderModel order)
      Description copied from interface: PricingBackend
      Price calculation for a cart
      Specified by:
      readPricesForCart in interface PricingBackend
    • readPriceInformationForProducts

      public List<de.hybris.platform.jalo.order.price.PriceInformation> readPriceInformationForProducts(List<ProductModel> productModels, boolean isNet)
      Description copied from interface: PricingBackend
      Price calculation for a list of products
      Specified by:
      readPriceInformationForProducts in interface PricingBackend
      Returns:
      List
    • fetchProductPromotions

      public List<String> fetchProductPromotions(ProductModel product, boolean isNet)
      Retrieves the list of promotions for a given product from the OPPS .
      Specified by:
      fetchProductPromotions in interface PricingBackend
      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

      protected OPPSPriceAndPromotionsData processOPPSResponse(ProductModel product, boolean isNet)
      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:
      PriceInformation object containing the cached price details for the product. Returns null if no cached information is found.
    • generateCacheKey

      protected OPPSPriceAndPromotionsCacheKey generateCacheKey(ProductModel prod)
      Generates a cache key based on the provided product.
      Parameters:
      prod - The product for which the cache key is to be generated.
      Returns:
      OPPSPriceAndPromotionsCacheKey representing the cache key for the given product.
    • getPpsClient

      public PPSClient getPpsClient()
    • setPpsClient

      public void setPpsClient(PPSClient ppsClient)
    • getAccessor

      public PPSClientBeanAccessor getAccessor()
    • setAccessor

      public void setAccessor(PPSClientBeanAccessor accessor)
    • getResultToOrderMappers

      public List<PriceCalculateToOrderMapper> getResultToOrderMappers()
    • setResultToOrderMappers

      public void setResultToOrderMappers(List<PriceCalculateToOrderMapper> resultToOrderMappers)
    • getRequestCreator

      public PPSRequestCreator getRequestCreator()
    • setRequestCreator

      public void setRequestCreator(PPSRequestCreator creator)
    • 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

      public PPSConfigService getConfigService()
    • setConfigService

      public void setConfigService(PPSConfigService configService)
    • 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