Package de.hybris.platform.order
Interface OrderService
-
- All Superinterfaces:
AbstractOrderService<OrderModel,OrderEntryModel>
- All Known Subinterfaces:
B2BOrderService
- All Known Implementing Classes:
DefaultAlipayOrderService
,DefaultB2BOrderService
,DefaultChineseOrderService
,DefaultOrderService
,DefaultWeChatPayOrderService
public interface OrderService extends AbstractOrderService<OrderModel,OrderEntryModel>
Business service for handling orders. Use this service to place new orders, recalculate orders. It allows adding new order entries, as well as finding entries by product or entry number.- Spring Bean ID:
- orderService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description OrderEntryModel
addNewEntry(OrderModel order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
Adds a new order entry to the given order on the required entry number.AbstractOrderEntryModel
addNewEntry(ComposedTypeModel entryType, OrderModel order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
Adds a new entry of the givenComposedTypeModel
to the given order.boolean
calculateOrder(AbstractOrderModel order)
Deprecated.since ages - UseCalculationService
to calculate orders.OrderModel
createOrderFromCart(CartModel cart)
Create the order for the givencart
.OrderModel
placeOrder(CartModel cart, AddressModel deliveryAddress, AddressModel paymentAddress, PaymentInfoModel paymentInfo)
Deprecated.since ages - Use lightweightcreateOrderFromCart(CartModel)
instead or your own implementation of order placement flow.void
submitOrder(OrderModel order)
Submits an order.-
Methods inherited from interface de.hybris.platform.order.AbstractOrderService
addAllGlobalDiscountValues, addAllTotalTaxValues, addGlobalDiscountValue, addNewEntry, addTotalTaxValue, clone, getEntriesForNumber, getEntriesForProduct, getEntryForNumber, getGlobalDiscountValue, removeGlobalDiscountValue, removeTotalTaxValue, saveOrder
-
-
-
-
Method Detail
-
createOrderFromCart
OrderModel createOrderFromCart(CartModel cart) throws InvalidCartException
Create the order for the givencart
. This method focuses on creating anOrderModel
instance from the givenCartModel
instance. 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
.- Parameters:
cart
- the targetCartModel
- Returns:
- a non persisted
OrderModel
- Throws:
InvalidCartException
- if the cart is invalid according to the usedCartValidator
.
-
submitOrder
void submitOrder(OrderModel order)
Submits an order. Fire list of submit order strategies. Default implementationEventPublishingSubmitOrderStrategy
firesSubmitOrderEvent
.- Parameters:
order
- Order to submit.
-
placeOrder
@Deprecated OrderModel placeOrder(CartModel cart, AddressModel deliveryAddress, AddressModel paymentAddress, PaymentInfoModel paymentInfo) throws InvalidCartException
Deprecated.since ages - Use lightweightcreateOrderFromCart(CartModel)
instead or your own implementation of order placement flow.Place the order for the givencart
. This means: first the cart is calculated (seecalculateOrder(AbstractOrderModel)
than (if notnull
) thedeliveryAddress
andpaymentAddress
andpaymentInfo
are stored for the current session user and also to the cart. After this from thecart
anOrderModel
is created and the cart is removed from the session.- Parameters:
cart
- theCartModel
deliveryAddress
- the deliveryAddressModel
for the current session user. Can benull
.paymentAddress
- the paymentAddressModel
for the current session user. Can benull
.paymentInfo
- thePaymentInfoModel
for the current session user. Can benull
.- Returns:
- the
OrderModel
- Throws:
InvalidCartException
-
calculateOrder
@Deprecated boolean calculateOrder(AbstractOrderModel order)
Deprecated.since ages - UseCalculationService
to calculate orders.Calculates the givenorder
and returnstrue
if each entry and after this theAbstractOrderModel
was 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.- Parameters:
order
- theAbstractOrderModel
- Returns:
false
if theorder
was already calculated.
-
addNewEntry
OrderEntryModel addNewEntry(OrderModel order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
Adds a new order entry to the given order on the required entry number. The new entry is neither saved nor calculated. If requested entryNumber collide with existing entry, anAmbiguousIdentifierException
will be thrown.- Specified by:
addNewEntry
in interfaceAbstractOrderService<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, that is not already occupied by existing order entry.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- Throws:
java.lang.IllegalArgumentException
- if either order or product is null or quantity is negative.AmbiguousIdentifierException
- if there is already entry with the requested number.- See Also:
AbstractOrderEntryTypeService.getAbstractOrderEntryType(AbstractOrderModel)
-
addNewEntry
AbstractOrderEntryModel addNewEntry(ComposedTypeModel entryType, OrderModel order, ProductModel product, long qty, UnitModel unit, int number, boolean addToPresent)
Adds a new entry of the givenComposedTypeModel
to the given order. The new entry is neither saved nor calculated. If requested entryNumber collide with existing entry, anAmbiguousIdentifierException
will be thrown.- Specified by:
addNewEntry
in interfaceAbstractOrderService<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, that is not already occupied by existing order entry.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- Throws:
java.lang.IllegalArgumentException
- if either entryType or order or product is null or quantity is negative.AmbiguousIdentifierException
- if there is already entry with the requested number.
-
-