Class DefaultMultiAddressDeliveryCostsStrategy
- java.lang.Object
-
- de.hybris.platform.basecommerce.jalo.DefaultMultiAddressDeliveryCostsStrategy
-
- All Implemented Interfaces:
DeliveryCostsStrategy
public class DefaultMultiAddressDeliveryCostsStrategy extends java.lang.Object implements DeliveryCostsStrategy
Calculates the delivery costs of the specifiedAbstractOrderby grouping itsAbstractOrderEntrybased on their assignedDeliveryModeand 'DeliveryAddress'. For each of these "groups" a new ordercreateTempCart(java.util.List<de.hybris.platform.jalo.order.AbstractOrderEntry>, de.hybris.platform.jalo.user.Address, de.hybris.platform.jalo.order.delivery.DeliveryMode, de.hybris.platform.jalo.user.User, de.hybris.platform.jalo.c2l.Currency, boolean)and the total of their delivery costs will be returned bygetCost(de.hybris.platform.jalo.SessionContext, de.hybris.platform.jalo.order.AbstractOrder).
-
-
Constructor Summary
Constructors Constructor Description DefaultMultiAddressDeliveryCostsStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AbstractOrdercreateTempCart(java.util.List<AbstractOrderEntry> entries, Address deliveryAddress, DeliveryMode mode, User user, Currency curr, boolean net)Creates a temporary order, which will be used for calculating the delivery costs of the assignedAbstractOrderEntry.PriceValuefindDeliveryCosts(SessionContext ctx, AbstractOrder order)Called duringAbstractOrder.calculate(),AbstractOrder.calculate(java.util.Date),AbstractOrder.recalculate()andAbstractOrder.recalculate(java.util.Date)to fetch and set the delivery cost for the assigned order.CartFactorygetCartFactory()protected PriceValuegetCost(SessionContext ctx, AbstractOrder order)Calculates the delivery costs of the specifiedAbstractOrderby grouping itsAbstractOrderEntrybased on their assignedDeliveryModeand 'DeliveryAddress'.voidsetCartFactory(CartFactory cartFactory)
-
-
-
Method Detail
-
getCartFactory
public CartFactory getCartFactory()
-
setCartFactory
public void setCartFactory(CartFactory cartFactory)
-
findDeliveryCosts
public PriceValue findDeliveryCosts(SessionContext ctx, AbstractOrder order)
Called duringAbstractOrder.calculate(),AbstractOrder.calculate(java.util.Date),AbstractOrder.recalculate()andAbstractOrder.recalculate(java.util.Date)to fetch and set the delivery cost for the assigned order.- Specified by:
findDeliveryCostsin interfaceDeliveryCostsStrategy- Returns:
- the delivery costs of this abstract order
-
getCost
protected PriceValue getCost(SessionContext ctx, AbstractOrder order) throws JaloDeliveryModeException
Calculates the delivery costs of the specifiedAbstractOrderby grouping itsAbstractOrderEntrybased on their assignedDeliveryModeand 'DeliveryAddress'. For each of these "groups" a new ordercreateTempCart(java.util.List<de.hybris.platform.jalo.order.AbstractOrderEntry>, de.hybris.platform.jalo.user.Address, de.hybris.platform.jalo.order.delivery.DeliveryMode, de.hybris.platform.jalo.user.User, de.hybris.platform.jalo.c2l.Currency, boolean)will be created and its delivery cost calculated.- Parameters:
ctx- the session contextorder- the original order (containingAbstractOrderEntry, which can have their own 'DeliveryAddress'- Returns:
- the sum of all delivery costs
- Throws:
JaloDeliveryModeException
-
createTempCart
protected AbstractOrder createTempCart(java.util.List<AbstractOrderEntry> entries, Address deliveryAddress, DeliveryMode mode, User user, Currency curr, boolean net) throws JaloGenericCreationException, JaloAbstractTypeException
Creates a temporary order, which will be used for calculating the delivery costs of the assignedAbstractOrderEntry. The configuredCartFactorywill be used for the internal cart/order creation- Parameters:
entries- the order entries, which will be added to the returned orderdeliveryAddress- the delivery address of the ordermode- the DeliveryMode of the orderuser- the order usercurr- the currencynet- the pricing of the order- Returns:
- the 'new' order
- Throws:
JaloGenericCreationExceptionJaloAbstractTypeException
-
-