Class FindBundlePricingWithCurrentPriceFactoryStrategy
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.order.strategies.calculation.impl.FindPricingWithCurrentPriceFactoryStrategy
-
- de.hybris.platform.subscriptionservices.subscription.impl.FindSubscriptionPricingWithCurrentPriceFactoryStrategy
-
- de.hybris.platform.configurablebundleservices.bundle.impl.FindBundlePricingWithCurrentPriceFactoryStrategy
-
- All Implemented Interfaces:
FindDiscountValuesStrategy,FindPriceStrategy,FindTaxValuesStrategy,ServiceLayerOnlyCalculationVerifier,UserNetCheckingStrategy,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
public class FindBundlePricingWithCurrentPriceFactoryStrategy extends FindSubscriptionPricingWithCurrentPriceFactoryStrategy
This strategy should replace the FindPricingWithCurrentPriceFactoryStrategy and will change the discount calculation for bundle entries based on the bundle rules. So based on the products that exist in the cart in the same bundle, the price rules are evaluated and the a matching reduced price is found. Once the final price has been identified, the same logic applies as for DiscountValues and they are persisted in exactly the same way in the database as well as the calculation is don in exactly the same way.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description FindBundlePricingWithCurrentPriceFactoryStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DiscountValuecreateDiscountValue(double discountPrice, double basePrice, java.lang.String id, CurrencyModel currency)Creates a DiscountValue with an absolute reduction based on the givenbasePriceand the givendiscountPricejava.util.List<DiscountValue>findDiscountValues(AbstractOrderEntryModel entry)For non Bundle products it should work as is, so the DiscountValues should result from the DiscountRows defined at the product.protected BundleRuleServicegetBundleRuleService()protected BundleTemplateServicegetBundleTemplateService()protected java.util.List<DiscountValue>getDiscountValues(AbstractOrderEntryModel entry, AbstractOrderEntryModel masterEntry)protected SubscriptionCommercePriceServicegetSubscriptionCommercePriceService()protected voidreduceOneTimePrice(SubscriptionPricePlanModel pricePlan, ChangeProductPriceBundleRuleModel priceRule, java.util.List<DiscountValue> discountValues, CurrencyModel currency, AbstractOrderEntryModel entry)The price logic for subscription product: discount are applied to one time charge.protected voidreduceRecurringPrice(ProductModel subscriptionProduct, ChangeProductPriceBundleRuleModel priceRule, java.util.List<DiscountValue> discountValues, AbstractOrderEntryModel entry, SubscriptionPricePlanModel pricePlan)hard coded price logic for subscription products: discounts are only applied to recurring pricesvoidsetBundleRuleService(BundleRuleService bundleRuleService)voidsetBundleTemplateService(BundleTemplateService bundleTemplateService)voidsetSubscriptionCommercePriceService(SubscriptionCommercePriceService subscriptionCommercePriceService)-
Methods inherited from class de.hybris.platform.subscriptionservices.subscription.impl.FindSubscriptionPricingWithCurrentPriceFactoryStrategy
createPriceValueForLastRecurringPrice, findBasePrice, getCommercePriceService, getDiscountValuesWhenBillingFrequency, getSubscriptionProductService, setCommercePriceService, setSubscriptionProductService
-
Methods inherited from class de.hybris.platform.order.strategies.calculation.impl.FindPricingWithCurrentPriceFactoryStrategy
afterPropertiesSet, findDiscountValues, findTaxValues, getCurrentPriceFactory, getDiscountInformation, getPriceInformation, getTaxInformation, isNetUser, setApplicationContext
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.order.strategies.calculation.ServiceLayerOnlyCalculationVerifier
isSLOnly
-
-
-
-
Method Detail
-
findDiscountValues
@Nonnull public java.util.List<DiscountValue> findDiscountValues(@Nonnull AbstractOrderEntryModel entry) throws CalculationException
For non Bundle products it should work as is, so the DiscountValues should result from the DiscountRows defined at the product. For Bundle products it should work in a different way: All other products where the AbstractOrderEntries have the same entry group number should be added to a list for comparison. The Product of the current AbstractOrderEntry will be used to identify PriceRules from the current BundleTemplate where that product is set as a target. All conditional products of the rules have to be in the comparison list and that is how we find the matching rules. If there are still multiple matching rules, because, then the one with the lowest price in the current currency will be used as discount. That absolute discount will be converted into a relative DiscountValue for the AbstractOrderEntry only. All calculations of totals later will work as is. For subscription products the discount is applied to the 1st tier of recurring charge entries in the price plan. In case there is a price rule that can be applied to the subscription product and there is also a discount that comes from the tiered recurring charge entries, the better (= cheaper) price is used as discount. For subscription product, if the there is price rule with the billing event, the specific one time charge price reduce logic will be applied.- Specified by:
findDiscountValuesin interfaceFindDiscountValuesStrategy- Overrides:
findDiscountValuesin classFindSubscriptionPricingWithCurrentPriceFactoryStrategy- Returns:
- List of
DiscountValues - Throws:
CalculationException
-
getDiscountValues
@Nonnull protected java.util.List<DiscountValue> getDiscountValues(@Nonnull AbstractOrderEntryModel entry, @Nonnull AbstractOrderEntryModel masterEntry)
-
reduceOneTimePrice
protected void reduceOneTimePrice(@Nonnull SubscriptionPricePlanModel pricePlan, @Nonnull ChangeProductPriceBundleRuleModel priceRule, @Nonnull java.util.List<DiscountValue> discountValues, @Nonnull CurrencyModel currency, @Nonnull AbstractOrderEntryModel entry)The price logic for subscription product: discount are applied to one time charge.- Parameters:
pricePlan- the subscription price planpriceRule- the change product price bundle rulediscountValues- the discount values listcurrency- the currencyentry- the order entry
-
reduceRecurringPrice
protected void reduceRecurringPrice(ProductModel subscriptionProduct, ChangeProductPriceBundleRuleModel priceRule, java.util.List<DiscountValue> discountValues, AbstractOrderEntryModel entry, SubscriptionPricePlanModel pricePlan)
hard coded price logic for subscription products: discounts are only applied to recurring prices- Parameters:
subscriptionProduct- the subscription productpriceRule- the change product price bundle rulediscountValues- the discount values listentry- the order entrypricePlan- the subscription price plan
-
createDiscountValue
protected DiscountValue createDiscountValue(double discountPrice, double basePrice, java.lang.String id, CurrencyModel currency)
Creates a DiscountValue with an absolute reduction based on the givenbasePriceand the givendiscountPrice- Returns:
DiscountValue
-
getBundleRuleService
protected BundleRuleService getBundleRuleService()
-
setBundleRuleService
public void setBundleRuleService(BundleRuleService bundleRuleService)
-
getSubscriptionCommercePriceService
protected SubscriptionCommercePriceService getSubscriptionCommercePriceService()
-
setSubscriptionCommercePriceService
public void setSubscriptionCommercePriceService(SubscriptionCommercePriceService subscriptionCommercePriceService)
-
getBundleTemplateService
protected BundleTemplateService getBundleTemplateService()
-
setBundleTemplateService
public void setBundleTemplateService(BundleTemplateService bundleTemplateService)
-
-