Package de.hybris.platform.order.impl
Class DefaultOrderService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.order.impl.DefaultAbstractOrderService<OrderModel,OrderEntryModel>
-
- de.hybris.platform.order.impl.DefaultOrderService
-
- All Implemented Interfaces:
AbstractOrderService<OrderModel,OrderEntryModel>,OrderService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
DefaultAlipayOrderService,DefaultB2BOrderService,DefaultChineseOrderService,DefaultWeChatPayOrderService
public class DefaultOrderService extends DefaultAbstractOrderService<OrderModel,OrderEntryModel> implements OrderService
Default implementation of theOrderService.- 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 DefaultOrderService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description OrderEntryModeladdNewEntry(OrderModel order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)Adds a new entry to the given order on the required entry number.AbstractOrderEntryModeladdNewEntry(ComposedTypeModel entryType, OrderModel order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)Adds a new entry of the givenComposedTypeModelto the given order.booleancalculateOrder(AbstractOrderModel order)Deprecated.since agesOrderModelclone(ComposedTypeModel orderType, ComposedTypeModel entryType, AbstractOrderModel original, java.lang.String code)Creates new order from given original and change its type and type for entry.OrderModelcreateOrderFromCart(CartModel cart)Create the order for the givencart.OrderModelplaceOrder(CartModel cart, AddressModel deliveryAddress, AddressModel paymentAddress, PaymentInfoModel paymentInfo)Deprecated.since agesvoidsetCreateOrderFromCartStrategy(CreateOrderFromCartStrategy submitOrderStrategy)voidsetOrderCalculation(OrderCalculation orderCalculation)Deprecated.since agesvoidsetPlaceOrderStrategy(PlaceOrderStrategy placeOrderStrategy)Deprecated.since agesvoidsetSubmitOrderStrategies(java.util.List<SubmitOrderStrategy> submitOrderStrategies)voidsubmitOrder(OrderModel order)Submits an order.-
Methods inherited from class de.hybris.platform.order.impl.DefaultAbstractOrderService
addAllGlobalDiscountValues, addAllTotalTaxValues, addEntryAtPosition, addGlobalDiscountValue, addNewEntry, addTotalTaxValue, getAbstractOrderEntryService, getAbstractOrderEntryTypeService, getCloneAbstractOrderStrategy, getCollidingEntry, getEntriesForNumber, getEntriesForProduct, getEntryForNumber, getEntryTypeCode, getGlobalDiscountValue, getOrderDao, getSaveAbstractOrderStrategy, removeGlobalDiscountValue, removeTotalTaxValue, saveOrder, setAbstractOrderEntryService, setAbstractOrderEntryTypeService, setCloneAbstractOrderStrategy, setOrderDao, setSaveAbstractOrderStrategy
-
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
afterPropertiesSet, 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.AbstractOrderService
addAllGlobalDiscountValues, addAllTotalTaxValues, addGlobalDiscountValue, addNewEntry, addTotalTaxValue, getEntriesForNumber, getEntriesForProduct, getEntryForNumber, getGlobalDiscountValue, removeGlobalDiscountValue, removeTotalTaxValue, saveOrder
-
-
-
-
Method Detail
-
createOrderFromCart
public OrderModel createOrderFromCart(CartModel cart) throws InvalidCartException
Description copied from interface:OrderServiceCreate the order for the givencart. This method focuses on creating anOrderModelinstance from the givenCartModelinstance. The order instance remains unsaved and not calculated. This method does nothing with the cart member attributes (addresses, paymentInfo). It also leaves the target cart untouched.If you want to calculate cart or order, use
CalculationService.- Specified by:
createOrderFromCartin interfaceOrderService- Parameters:
cart- the targetCartModel- Returns:
- a non persisted
OrderModel - Throws:
InvalidCartException- if the cart is invalid according to the usedCartValidator.
-
submitOrder
public void submitOrder(OrderModel order)
Description copied from interface:OrderServiceSubmits an order. Fire list of submit order strategies. Default implementationEventPublishingSubmitOrderStrategyfiresSubmitOrderEvent.- Specified by:
submitOrderin interfaceOrderService- Parameters:
order- Order to submit.
-
placeOrder
@Deprecated public OrderModel placeOrder(CartModel cart, AddressModel deliveryAddress, AddressModel paymentAddress, PaymentInfoModel paymentInfo) throws InvalidCartException
Deprecated.since agesDescription copied from interface:OrderServicePlace the order for the givencart. This means: first the cart is calculated (seeOrderService.calculateOrder(AbstractOrderModel)than (if notnull) thedeliveryAddressandpaymentAddressandpaymentInfoare stored for the current session user and also to the cart. After this from thecartanOrderModelis created and the cart is removed from the session.- Specified by:
placeOrderin interfaceOrderService- Parameters:
cart- theCartModeldeliveryAddress- the deliveryAddressModelfor the current session user. Can benull.paymentAddress- the paymentAddressModelfor the current session user. Can benull.paymentInfo- thePaymentInfoModelfor the current session user. Can benull.- Returns:
- the
OrderModel - Throws:
InvalidCartException
-
calculateOrder
@Deprecated public boolean calculateOrder(AbstractOrderModel order)
Deprecated.since agesDescription copied from interface:OrderServiceCalculates the givenorderand returnstrueif each entry and after this theAbstractOrderModelwas calculated. Thereby any invalid entry will be automatically removed.The default implementation delegates to the
OrderCalculation.calculate(AbstractOrderModel)strategy. Please check the API doc of your current calculation strategy.- Specified by:
calculateOrderin interfaceOrderService- Parameters:
order- theAbstractOrderModel- Returns:
falseif theorderwas already calculated.
-
setPlaceOrderStrategy
@Deprecated public void setPlaceOrderStrategy(PlaceOrderStrategy placeOrderStrategy)
Deprecated.since ages
-
setOrderCalculation
@Deprecated public void setOrderCalculation(OrderCalculation orderCalculation)
Deprecated.since ages
-
setCreateOrderFromCartStrategy
public void setCreateOrderFromCartStrategy(CreateOrderFromCartStrategy submitOrderStrategy)
-
setSubmitOrderStrategies
public void setSubmitOrderStrategies(java.util.List<SubmitOrderStrategy> submitOrderStrategies)
-
clone
public OrderModel clone(ComposedTypeModel orderType, ComposedTypeModel entryType, AbstractOrderModel original, java.lang.String code)
Description copied from interface:AbstractOrderServiceCreates new order from given original and change its type and type for entry. Delegates to the specificCloneAbstractOrderStrategyinjected strategy. Resulting order remains not persisted.- Specified by:
clonein interfaceAbstractOrderService<OrderModel,OrderEntryModel>- Parameters:
orderType- type of result order (OrderModel will be chosen if null is passed)entryType- type of entry (if null will use service to get proper type)original- original ordercode- code for new order- Returns:
- not persisted order model instance.
-
addNewEntry
public OrderEntryModel addNewEntry(OrderModel order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
Description copied from interface:AbstractOrderServiceAdds a new entry to the given order on the required entry number. The entry type is recognized basing onAbstractOrderEntryTypeServiceand the spring configuration behind it. The new entry is neither saved nor calculated. If your new entry has caused entries shuffling you may need to callAbstractOrderService.saveOrder(AbstractOrderModel)method in order to persist the changes.- Specified by:
addNewEntryin interfaceAbstractOrderService<OrderModel,OrderEntryModel>- Specified by:
addNewEntryin interfaceOrderService- Overrides:
addNewEntryin classDefaultAbstractOrderService<OrderModel,OrderEntryModel>- Parameters:
order- - target orderproduct- -product to add, must not be nullqty- - quantityunit- - must not be nullnumber- - entry number of the new entry in the order. Entries are indexed starting from 0. Set number to -1 if you want to append the entry as the last one. You can request any non-negative position.addToPresent- - if true an existing entry with matching product and unit will get its quantity increased; otherwise a new entry is created- Returns:
AbstractOrderEntryModel- newly created order entry- See Also:
AbstractOrderEntryTypeService.getAbstractOrderEntryType(AbstractOrderModel)
-
addNewEntry
public AbstractOrderEntryModel addNewEntry(ComposedTypeModel entryType, OrderModel order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
Description copied from interface:AbstractOrderServiceAdds a new entry of the givenComposedTypeModelto the given order. The new entry is neither saved nor calculated. If your new entry has caused entries shuffling you may need to callAbstractOrderService.saveOrder(AbstractOrderModel)method in order to persist the changes.- Specified by:
addNewEntryin interfaceAbstractOrderService<OrderModel,OrderEntryModel>- Specified by:
addNewEntryin interfaceOrderService- Overrides:
addNewEntryin classDefaultAbstractOrderService<OrderModel,OrderEntryModel>- Parameters:
entryType- - the requested sub-type AbstractOrderEntryorder- - target orderproduct- -product to add, must not be nullqty- - quantityunit- - must not be nullnumber- - entry number of the new entry in the order. Entries are indexed starting from 0. Set number to -1 if you want to append the entry as the last one. You can request any non-negative position.addToPresent- - if true an existing entry with matching product and unit will get its quantity increased; otherwise a new entry is created- Returns:
AbstractOrderEntryModel- newly created order entry
-
-