Class AncillaryResponseDataAncillariesPopulator
java.lang.Object
de.hybris.platform.shoppingfacades.converters.populator.AncillaryResponseDataAncillariesPopulator
- All Implemented Interfaces:
de.hybris.platform.converters.Populator<OfferResponseData,AncillaryResponseData>
public class AncillaryResponseDataAncillariesPopulator
extends Object
implements de.hybris.platform.converters.Populator<OfferResponseData,AncillaryResponseData>
The Shopping populator to populate the ancillaries from
OfferResponseData to AncillaryResponseData.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected AddToCartInfoDatacreateAddToCartInfo(ProductModel productModel, TravelRestrictionData travelRestrictionData) Return the Add to Cart info object for the given travelRestrictionData and product codeprotected List<OfferGroupData>createCategories(OfferGroupData offerGroupData) Creates the categories list.protected List<AncillaryPricingInfoData>createCommerceAncillaryPricingInfo(List<TravellerData> travellers, List<TransportOfferingData> transportOfferings, ProductModel commerceAncillaryProduct) Creates the list of commerce ancillary pricing infos.protected AddToCartInfoDataCreates the default add to cart info data.protected PriceDatacreatePriceData(de.hybris.platform.jalo.order.price.PriceInformation priceInfo) Method takes a PriceInformation object and performs a null check.createTaxData(PriceData priceData, List<de.hybris.platform.jalo.order.price.TaxInformation> taxInfos) Method to convert the Tax Information to Tax Data objects.protected AncillaryDatagetAncillaryData(OfferPricingInfoData offerPricingInfoData, List<TravellerData> travellerDataList, List<TransportOfferingData> transportOfferings, List<OfferGroupData> categories) Gets ancillary data.protected StringgetCategoryCode(ProductModel productModel) Get category code for productprotected de.hybris.platform.jalo.order.price.PriceInformationgetCommercePricingInformation(TransportOfferingData transportOfferingData, ProductModel commerceAncillaryProduct) Gets offer pricing information.protected de.hybris.platform.servicelayer.i18n.CommonI18NServiceGets common i 18 n service.getPassengerIds(List<TravellerData> allowedTravellers) Return traveller uids if present otherwise shopping traveller ids.protected de.hybris.platform.jalo.order.price.PriceInformationgetPriceInformationFromTransportOfferingOrSector(TransportOfferingData transportOfferingData, ProductModel commerceAncillaryProduct) If the Product category (offerGroupCode) is configured at TransportOfferingLevel, check if there is a priceRow at TransportOffering and offer.protected de.hybris.platform.product.ProductServiceGets product service.protected List<TransportOfferingData>getTransportOfferingsForProduct(ProductModel commerceAncillaryProduct, List<TransportOfferingData> transportOfferings) Gets transport offerings for product.protected TravelCommercePriceFacadeGets travel commerce price facade.protected TravelCommercePriceServiceGets travel commerce price service.protected TravelRestrictionFacadeGets travel restriction facade.protected booleanisRestrictedTraveller(TravellerData travellerData, TravelRestrictionData travelRestrictionData) checks if the traveller can add a commerce ancillary product to the cart.voidpopulate(OfferResponseData offerResponseData, AncillaryResponseData ancillaryResponseData) voidsetCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService) Sets common i 18 n service.voidsetProductService(de.hybris.platform.product.ProductService productService) Sets product service.voidsetTravelCommercePriceFacade(TravelCommercePriceFacade travelCommercePriceFacade) Sets travel commerce price facade.voidsetTravelCommercePriceService(TravelCommercePriceService travelCommercePriceService) Sets travel commerce price service.voidsetTravelRestrictionFacade(TravelRestrictionFacade travelRestrictionFacade) Sets travel restriction facade.
-
Constructor Details
-
AncillaryResponseDataAncillariesPopulator
public AncillaryResponseDataAncillariesPopulator()
-
-
Method Details
-
populate
public void populate(OfferResponseData offerResponseData, AncillaryResponseData ancillaryResponseData) throws de.hybris.platform.servicelayer.dto.converter.ConversionException - Specified by:
populatein interfacede.hybris.platform.converters.Populator<OfferResponseData,AncillaryResponseData> - Throws:
de.hybris.platform.servicelayer.dto.converter.ConversionException
-
getAncillaryData
protected AncillaryData getAncillaryData(OfferPricingInfoData offerPricingInfoData, List<TravellerData> travellerDataList, List<TransportOfferingData> transportOfferings, List<OfferGroupData> categories) Gets ancillary data.- Parameters:
offerPricingInfoData- the offer pricing info datatravellerDataList- the traveller data listtransportOfferings- the transport offeringscategories-- Returns:
- the ancillary data
-
createDefaultAddToCartInfo
Creates the default add to cart info data.- Returns:
- the add to cart info
-
getPassengerIds
Return traveller uids if present otherwise shopping traveller ids.- Parameters:
allowedTravellers- the allowed travellers- Returns:
- the passenger ids
-
createCategories
Creates the categories list.- Parameters:
offerGroupData- the offer group data- Returns:
- the list
-
isRestrictedTraveller
protected boolean isRestrictedTraveller(TravellerData travellerData, TravelRestrictionData travelRestrictionData) checks if the traveller can add a commerce ancillary product to the cart.- Parameters:
travellerData- the traveller datatravelRestrictionData- the travel restriction data- Returns:
- true if the traveller is allowed to purchase the ancillary.
-
createAddToCartInfo
protected AddToCartInfoData createAddToCartInfo(ProductModel productModel, TravelRestrictionData travelRestrictionData) Return the Add to Cart info object for the given travelRestrictionData and product code- Parameters:
productModel- the product modeltravelRestrictionData- the travel restriction data- Returns:
- add to cart info
-
getCategoryCode
Get category code for product- Parameters:
productModel- the product model- Returns:
- the category code
-
createCommerceAncillaryPricingInfo
protected List<AncillaryPricingInfoData> createCommerceAncillaryPricingInfo(List<TravellerData> travellers, List<TransportOfferingData> transportOfferings, ProductModel commerceAncillaryProduct) Creates the list of commerce ancillary pricing infos.- Parameters:
travellers- the travellerstransportOfferings- the transport offeringscommerceAncillaryProduct- the commerce ancillary product- Returns:
- the list
-
getTransportOfferingsForProduct
protected List<TransportOfferingData> getTransportOfferingsForProduct(ProductModel commerceAncillaryProduct, List<TransportOfferingData> transportOfferings) Gets transport offerings for product.- Parameters:
commerceAncillaryProduct- the commerce ancillary producttransportOfferings- the transport offerings- Returns:
- the transport offerings for product
-
getCommercePricingInformation
protected de.hybris.platform.jalo.order.price.PriceInformation getCommercePricingInformation(TransportOfferingData transportOfferingData, ProductModel commerceAncillaryProduct) Gets offer pricing information.- Parameters:
transportOfferingData- the transport offering codecommerceAncillaryProduct- the commerce ancillary product- Returns:
- offer pricing information
-
getPriceInformationFromTransportOfferingOrSector
protected de.hybris.platform.jalo.order.price.PriceInformation getPriceInformationFromTransportOfferingOrSector(TransportOfferingData transportOfferingData, ProductModel commerceAncillaryProduct) If the Product category (offerGroupCode) is configured at TransportOfferingLevel, check if there is a priceRow at TransportOffering and offer. if not, check if there is a priceRow for travelSector and offer.- Parameters:
transportOfferingData- the transport offering codecommerceAncillaryProduct- the commerce ancillary product- Returns:
- price information from transport offering or sector
-
createPriceData
Method takes a PriceInformation object and performs a null check. If the object a is null then null will be returned otherwise a new PriceData object is created and returned using the PriceValue on the PriceInformation object- Parameters:
priceInfo- the price info- Returns:
- PriceData price data
-
createTaxData
protected List<TaxData> createTaxData(PriceData priceData, List<de.hybris.platform.jalo.order.price.TaxInformation> taxInfos) Method to convert the Tax Information to Tax Data objects. Tax amount is calculated based on the absolute/relative value.- Parameters:
priceData- the price datataxInfos- the tax infos- Returns:
- list of TaxData objects.
-
getProductService
protected de.hybris.platform.product.ProductService getProductService()Gets product service.- Returns:
- the product service
-
setProductService
public void setProductService(de.hybris.platform.product.ProductService productService) Sets product service.- Parameters:
productService- the product service
-
getTravelRestrictionFacade
Gets travel restriction facade.- Returns:
- the travel restriction facade
-
setTravelRestrictionFacade
Sets travel restriction facade.- Parameters:
travelRestrictionFacade- the travel restriction facade
-
getTravelCommercePriceService
Gets travel commerce price service.- Returns:
- the travel commerce price service
-
setTravelCommercePriceService
Sets travel commerce price service.- Parameters:
travelCommercePriceService- the travel commerce price service
-
getCommonI18NService
protected de.hybris.platform.servicelayer.i18n.CommonI18NService getCommonI18NService()Gets common i 18 n service.- Returns:
- the common i 18 n service
-
setCommonI18NService
public void setCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService) Sets common i 18 n service.- Parameters:
commonI18NService- the common i 18 n service
-
getTravelCommercePriceFacade
Gets travel commerce price facade.- Returns:
- the travel commerce price facade
-
setTravelCommercePriceFacade
Sets travel commerce price facade.- Parameters:
travelCommercePriceFacade- the travel commerce price facade
-