Class DefaultAccommodationCommerceCartService
java.lang.Object
de.hybris.platform.commerceservices.order.impl.DefaultCommerceCartService
de.hybris.platform.travelservices.order.impl.DefaultAccommodationCommerceCartService
- All Implemented Interfaces:
de.hybris.platform.commerceservices.order.CommerceCartService,AccommodationCommerceCartService
public class DefaultAccommodationCommerceCartService
extends de.hybris.platform.commerceservices.order.impl.DefaultCommerceCartService
implements AccommodationCommerceCartService
Default implementation of
AccommodationCommerceCartService-
Field Summary
Fields inherited from class de.hybris.platform.commerceservices.order.impl.DefaultCommerceCartService
ESTIMATED_TAXES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanamendOrderEntryGroup(AccommodationOrderEntryGroupModel accommodationOrderEntryGroup, List<Integer> entryNumbers, String paymentType) Link accommodationOrderEntryGroup to new Entries of the amended Order based on the paymentType and the paymentMethod used during original methodvoidcleanupCartBeforeAddition(String accommodationOfferingCode, String checkInDateTime, String checkOutDateTime) Checks if the accommodationOfferingCode matches the one that is currently in the cart.protected CommerceCartModificationcreateAddToCartResp(long quantityToAdd, String status, AbstractOrderEntryModel entry, long quantityAdded) Create add to cart resp commerce cart modification.voidcreateOrderEntryGroup(List<Integer> entryNumbers, Date checkInDate, Date checkOutDate, String accOffCode, String accCode, String ratePlanCode, int refNumber) Creates order entry group which will hold a set of data related to one of the roomStays.voidRemoves all the entries in the cart.protected AccommodationOfferingServiceprotected BookingServiceprotected de.hybris.platform.order.CartServiceprotected de.hybris.platform.category.CategoryServiceprotected Map<String,ChangeDatesPaymentActionStrategy> Retrieves AccommodationOffering that is currently in the cartgetEntriesForProductAndAccommodation(CartModel cartModel, ProductModel product, CartEntryModel cartEntryModel) Retrieves a list ofCartEntryModelthat matches the providedProductModelandAccommodationModelin theCartModelintIdentifies the maximum roomStayRefNumber based on the AccommodationOrderEntryGroups that are currently in the cart.getNewAccommodationOrderEntryGroups(String accommodationOfferingCode, String accommodationCode, String ratePlanCode) Retrieves a list of AccommodationOrderEntryGroup from current session cart which match given accommodationOfferingCode, accommodationCode and ratePlan set.intReturns a number of AccommodationOrderEntryGroups that are currently in the cart.getPaymentTypeForChangeDates(AccommodationOrderEntryGroupModel accommodationOrderEntryGroup, List<Integer> entryNumbers) Identifies which payment type will occur on changing datesprotected de.hybris.platform.product.ProductServiceprotected TravelCartServicebooleanisAccommodationExistInCart(String accommodationOfferingCode, Date checkInDate, Date checkOutDate, List<AccommodationOrderEntryGroupModel> entryGroups) Check whether accommodation exist in the cart.booleanCheck whether new room is added into the cart.protected voidnormalizeRoomStayRefNumbers(AbstractOrderModel abstractOrderModel) voidpopulateAccommodationDetailsOnRoomRateEntry(int entryNumber, List<Date> dates) Populates entry type, dates and amend status on a accommodationOrderEntryInfo attribute of a given entryremoveAccommodationOrderEntryGroup(int roomStayReference) Removes accommodation order entry group and entries associated to it from the cartvoidremoveAccommodationOrderEntryGroups(List<AccommodationOrderEntryGroupModel> accommodationOrderEntryGroups, int numberToRemove) Removes a number of given AccommodationOrderEntryGroups from cart and all entries associated to them.removeAccommodations(List<AccommodationOrderEntryGroupModel> accommodationOrderEntryGroups, int numberToRemove) Removes a number of given AccommodationOrderEntryGroups from cart and all entries associated to them.protected voidremoveEntryGroupsFromCart(List<AccommodationOrderEntryGroupModel> entryGroupsToRemove) voidremoveRoomStay(Integer roomStayRefNumber) Removes accommodation order entry and related entries from the cart without room stay ref normalisationvoidrollbackAccommodationEntries(String accommodationCode, String accommodationOfferingCode, String ratePlanCode) Removes the accommodationOfferingEntries that were associated with the option which was affected during add to cart.voidsetAccommodationOfferingService(AccommodationOfferingService accommodationOfferingService) voidsetBookingService(BookingService bookingService) voidsetCartService(de.hybris.platform.order.CartService cartService) voidsetCategoryService(de.hybris.platform.category.CategoryService categoryService) voidsetChangeDatesPaymentActionStrategyMap(Map<String, ChangeDatesPaymentActionStrategy> changeDatesPaymentActionStrategyMap) voidsetOrderTotalPaidForEntryGroupCalculationStrategy(OrderTotalPaidForEntryGroupCalculationStrategy orderTotalPaidForEntryGroupCalculationStrategy) voidsetProductService(de.hybris.platform.product.ProductService productService) voidsetTravelCartService(TravelCartService travelCartService) booleanvalidateCart(String accommodationOfferingCode, String checkInDateTime, String checkOutDateTime, List<AccommodationOrderEntryGroupModel> entryGroups) Methods inherited from class de.hybris.platform.commerceservices.order.impl.DefaultCommerceCartService
addToCart, addToCart, addToCart, afterCalculate, beforeCalculate, calculateCart, calculateCart, configureCartEntry, estimateTaxes, estimateTaxes, getBaseSiteService, getCartForCodeAndUser, getCartForGuidAndSite, getCartForGuidAndSiteAndUser, getCartsForSiteAndUser, getCartValidationStrategy, getCommerceAddToCartStrategy, getCommerceCartCalculationStrategy, getCommerceCartDao, getCommerceCartEstimateTaxesStrategy, getCommerceCartHashCalculationStrategy, getCommerceCartMergingStrategy, getCommerceCartMetadataUpdateStrategy, getCommerceCartRestorationStrategy, getCommerceCartSplitStrategy, getCommerceRemoveEntriesStrategy, getCommerceUpdateCartEntryStrategy, getModelService, getProductConfigurationStrategy, getRemoveEntryGroupStrategy, getSessionService, getStaleCartRemovalStrategy, mergeCarts, recalculateCart, recalculateCart, removeAllEntries, removeAllEntries, removeEntryGroup, removeStaleCarts, removeStaleCarts, restoreCart, restoreCart, setBaseSiteService, setCartValidationStrategy, setCommerceAddToCartStrategy, setCommerceCartCalculationStrategy, setCommerceCartDao, setCommerceCartEstimateTaxesStrategy, setCommerceCartHashCalculationStrategy, setCommerceCartMergingStrategy, setCommerceCartMetadataUpdateStrategy, setCommerceCartRestorationStrategy, setCommerceCartSplitStrategy, setCommerceRemoveEntriesStrategy, setCommerceUpdateCartEntryStrategy, setModelService, setProductConfigurationStrategy, setRemoveEntryGroupStrategy, setSessionService, setStaleCartRemovalStrategy, split, split, updateCartMetadata, updatePointOfServiceForCartEntry, updatePointOfServiceForCartEntry, updateQuantityForCartEntry, updateQuantityForCartEntry, updateToShippingModeForCartEntry, updateToShippingModeForCartEntry, validateCart, validateCart
-
Constructor Details
-
DefaultAccommodationCommerceCartService
public DefaultAccommodationCommerceCartService()
-
-
Method Details
-
populateAccommodationDetailsOnRoomRateEntry
Description copied from interface:AccommodationCommerceCartServicePopulates entry type, dates and amend status on a accommodationOrderEntryInfo attribute of a given entry- Specified by:
populateAccommodationDetailsOnRoomRateEntryin interfaceAccommodationCommerceCartService- Parameters:
entryNumber- the entry numberdates- the dates
-
createOrderEntryGroup
public void createOrderEntryGroup(List<Integer> entryNumbers, Date checkInDate, Date checkOutDate, String accOffCode, String accCode, String ratePlanCode, int refNumber) Description copied from interface:AccommodationCommerceCartServiceCreates order entry group which will hold a set of data related to one of the roomStays. It will also be linked to all order entries related to this roomStay.- Specified by:
createOrderEntryGroupin interfaceAccommodationCommerceCartService- Parameters:
entryNumbers- the entry numberscheckInDate- the check in datecheckOutDate- the check out dateaccOffCode- the acc off codeaccCode- the acc coderatePlanCode- the rate plan coderefNumber- the ref number
-
amendOrderEntryGroup
public boolean amendOrderEntryGroup(AccommodationOrderEntryGroupModel accommodationOrderEntryGroup, List<Integer> entryNumbers, String paymentType) Description copied from interface:AccommodationCommerceCartServiceLink accommodationOrderEntryGroup to new Entries of the amended Order based on the paymentType and the paymentMethod used during original method- Specified by:
amendOrderEntryGroupin interfaceAccommodationCommerceCartService- Parameters:
accommodationOrderEntryGroup- the accommodation order entry groupentryNumbers- the entry numberspaymentType- then type of transaction to create- Returns:
- true/false
-
rollbackAccommodationEntries
public void rollbackAccommodationEntries(String accommodationCode, String accommodationOfferingCode, String ratePlanCode) Description copied from interface:AccommodationCommerceCartServiceRemoves the accommodationOfferingEntries that were associated with the option which was affected during add to cart.- Specified by:
rollbackAccommodationEntriesin interfaceAccommodationCommerceCartService- Parameters:
accommodationCode- the accommodation codeaccommodationOfferingCode- the accommodation offering coderatePlanCode- the rate plan code
-
cleanupCartBeforeAddition
public void cleanupCartBeforeAddition(String accommodationOfferingCode, String checkInDateTime, String checkOutDateTime) Description copied from interface:AccommodationCommerceCartServiceChecks if the accommodationOfferingCode matches the one that is currently in the cart. If not, all AccommodationOrderEntryGroups should be removed from cart because multi accommodation offering booking is not supported- Specified by:
cleanupCartBeforeAdditionin interfaceAccommodationCommerceCartService- Parameters:
accommodationOfferingCode- the accommodation offering codecheckInDateTime- the check in date timecheckOutDateTime- the check out date time
-
validateCart
public boolean validateCart(String accommodationOfferingCode, String checkInDateTime, String checkOutDateTime, List<AccommodationOrderEntryGroupModel> entryGroups) - Specified by:
validateCartin interfaceAccommodationCommerceCartService- Parameters:
accommodationOfferingCode- accommodation offering codecheckInDateTime- check in datecheckOutDateTime- check out dateentryGroups- accommodation order entry groups- Returns:
- true if cart is valid
-
isAccommodationExistInCart
public boolean isAccommodationExistInCart(String accommodationOfferingCode, Date checkInDate, Date checkOutDate, List<AccommodationOrderEntryGroupModel> entryGroups) Description copied from interface:AccommodationCommerceCartServiceCheck whether accommodation exist in the cart.- Specified by:
isAccommodationExistInCartin interfaceAccommodationCommerceCartService- Parameters:
accommodationOfferingCode- accommodation offering codecheckInDate- check in datecheckOutDate- check out dateentryGroups- accommodation order entry groups- Returns:
- true if accommodation exist in cart
-
emptyCart
public void emptyCart()Description copied from interface:AccommodationCommerceCartServiceRemoves all the entries in the cart.- Specified by:
emptyCartin interfaceAccommodationCommerceCartService
-
getNumberOfEntryGroupsInCart
public int getNumberOfEntryGroupsInCart()Description copied from interface:AccommodationCommerceCartServiceReturns a number of AccommodationOrderEntryGroups that are currently in the cart.- Specified by:
getNumberOfEntryGroupsInCartin interfaceAccommodationCommerceCartService- Returns:
- number of entry groups in cart
-
getNewAccommodationOrderEntryGroups
public List<AccommodationOrderEntryGroupModel> getNewAccommodationOrderEntryGroups(String accommodationOfferingCode, String accommodationCode, String ratePlanCode) Description copied from interface:AccommodationCommerceCartServiceRetrieves a list of AccommodationOrderEntryGroup from current session cart which match given accommodationOfferingCode, accommodationCode and ratePlan set.- Specified by:
getNewAccommodationOrderEntryGroupsin interfaceAccommodationCommerceCartService- Parameters:
accommodationOfferingCode- the accommodation offering codeaccommodationCode- the accommodation coderatePlanCode- the rate plan code- Returns:
- list of AccommodationOrderEntryGroup
-
getEntriesForProductAndAccommodation
public List<CartEntryModel> getEntriesForProductAndAccommodation(CartModel cartModel, ProductModel product, CartEntryModel cartEntryModel) Description copied from interface:AccommodationCommerceCartServiceRetrieves a list ofCartEntryModelthat matches the providedProductModelandAccommodationModelin theCartModel- Specified by:
getEntriesForProductAndAccommodationin interfaceAccommodationCommerceCartService- Returns:
- current accommodation offering
-
getMaxRoomStayRefNumber
public int getMaxRoomStayRefNumber()Description copied from interface:AccommodationCommerceCartServiceIdentifies the maximum roomStayRefNumber based on the AccommodationOrderEntryGroups that are currently in the cart.- Specified by:
getMaxRoomStayRefNumberin interfaceAccommodationCommerceCartService- Returns:
- maxRoomStayRefNumber max room stay ref number
-
removeAccommodationOrderEntryGroups
public void removeAccommodationOrderEntryGroups(List<AccommodationOrderEntryGroupModel> accommodationOrderEntryGroups, int numberToRemove) Description copied from interface:AccommodationCommerceCartServiceRemoves a number of given AccommodationOrderEntryGroups from cart and all entries associated to them. It then normalises the roomStayRefNumbers not to lose track of them.- Specified by:
removeAccommodationOrderEntryGroupsin interfaceAccommodationCommerceCartService- Parameters:
accommodationOrderEntryGroups- - accommodationOrderEntryGroups currently in cartnumberToRemove- - specifies how many AccommodationOrderEntryGroups should be removed.
-
removeAccommodations
public CommerceCartModification removeAccommodations(List<AccommodationOrderEntryGroupModel> accommodationOrderEntryGroups, int numberToRemove) Description copied from interface:AccommodationCommerceCartServiceRemoves a number of given AccommodationOrderEntryGroups from cart and all entries associated to them. It then normalises the roomStayRefNumbers not to lose track of them.- Specified by:
removeAccommodationsin interfaceAccommodationCommerceCartService- Parameters:
accommodationOrderEntryGroups- - accommodationOrderEntryGroups currently in cart- Returns:
CommerceCartModification
-
removeEntryGroupsFromCart
protected void removeEntryGroupsFromCart(List<AccommodationOrderEntryGroupModel> entryGroupsToRemove) -
removeAccommodationOrderEntryGroup
Description copied from interface:AccommodationCommerceCartServiceRemoves accommodation order entry group and entries associated to it from the cart- Specified by:
removeAccommodationOrderEntryGroupin interfaceAccommodationCommerceCartService- Parameters:
roomStayReference- the room stay reference- Returns:
- boolean
-
getCurrentAccommodationOffering
Description copied from interface:AccommodationCommerceCartServiceRetrieves AccommodationOffering that is currently in the cart- Specified by:
getCurrentAccommodationOfferingin interfaceAccommodationCommerceCartService- Returns:
- current accommodation offering
-
removeRoomStay
Description copied from interface:AccommodationCommerceCartServiceRemoves accommodation order entry and related entries from the cart without room stay ref normalisation- Specified by:
removeRoomStayin interfaceAccommodationCommerceCartService
-
normalizeRoomStayRefNumbers
-
isNewRoomInCart
public boolean isNewRoomInCart()Description copied from interface:AccommodationCommerceCartServiceCheck whether new room is added into the cart.- Specified by:
isNewRoomInCartin interfaceAccommodationCommerceCartService- Returns:
-
getPaymentTypeForChangeDates
public String getPaymentTypeForChangeDates(AccommodationOrderEntryGroupModel accommodationOrderEntryGroup, List<Integer> entryNumbers) Description copied from interface:AccommodationCommerceCartServiceIdentifies which payment type will occur on changing dates- Specified by:
getPaymentTypeForChangeDatesin interfaceAccommodationCommerceCartService- Returns:
-
createAddToCartResp
protected CommerceCartModification createAddToCartResp(long quantityToAdd, String status, AbstractOrderEntryModel entry, long quantityAdded) Create add to cart resp commerce cart modification.- Parameters:
quantityToAdd- the quantity to addstatus- the statusentry- the entryquantityAdded- the quantity added- Returns:
- the commerce cart modification
-
getCartService
protected de.hybris.platform.order.CartService getCartService()- Returns:
- the cartService
-
setCartService
public void setCartService(de.hybris.platform.order.CartService cartService) - Parameters:
cartService- the cartService to set
-
getBookingService
- Returns:
- the bookingService
-
setBookingService
- Parameters:
bookingService- the bookingService to set
-
getProductService
protected de.hybris.platform.product.ProductService getProductService()- Returns:
- the productService
-
setProductService
public void setProductService(de.hybris.platform.product.ProductService productService) - Parameters:
productService- the productService to set
-
getCategoryService
protected de.hybris.platform.category.CategoryService getCategoryService()- Returns:
- the categoryService
-
setCategoryService
public void setCategoryService(de.hybris.platform.category.CategoryService categoryService) - Parameters:
categoryService- the categoryService to set
-
getAccommodationOfferingService
- Returns:
- the accommodationOfferingService
-
setAccommodationOfferingService
public void setAccommodationOfferingService(AccommodationOfferingService accommodationOfferingService) - Parameters:
accommodationOfferingService- the accommodationOfferingService to set
-
getChangeDatesPaymentActionStrategyMap
- Returns:
- the changeDatesPaymentActionStrategyMap
-
setChangeDatesPaymentActionStrategyMap
public void setChangeDatesPaymentActionStrategyMap(Map<String, ChangeDatesPaymentActionStrategy> changeDatesPaymentActionStrategyMap) - Parameters:
changeDatesPaymentActionStrategyMap- the changeDatesPaymentActionStrategyMap to set
-
getOrderTotalPaidForEntryGroupCalculationStrategy
protected OrderTotalPaidForEntryGroupCalculationStrategy getOrderTotalPaidForEntryGroupCalculationStrategy()- Returns:
- the orderTotalPaidForEntryGroupCalculationStrategy
-
setOrderTotalPaidForEntryGroupCalculationStrategy
public void setOrderTotalPaidForEntryGroupCalculationStrategy(OrderTotalPaidForEntryGroupCalculationStrategy orderTotalPaidForEntryGroupCalculationStrategy) - Parameters:
orderTotalPaidForEntryGroupCalculationStrategy- the orderTotalPaidForEntryGroupCalculationStrategy to set
-
getTravelCartService
- Returns:
- the travelCartService
-
setTravelCartService
- Parameters:
travelCartService- the travelCartService to set
-