Package de.hybris.platform.refund.impl
Class DefaultRefundService
java.lang.Object
de.hybris.platform.refund.impl.DefaultRefundService
- All Implemented Interfaces:
RefundService
- Direct Known Subclasses:
WarehousingRefundService
Default implementation of
Sample usage:
RefundServiceSample usage:
// order creation final OrderModel order = orderService.placeOrder(cart, deliveryAddress, null, paymentInfo); // create 'returns request' final ReturnRequestModel request = returnService.createReturnRequest(order); // assign RMA to 'return request' returnService.createRMA(request); // based on the original order a 'preview' will be created, so that we can apply the refunds without modifying the original order. final OrderModel refundOrderPreview = refundService.createRefundOrderPreview(request, order); // ... after that we will apply the refunds on the preview of our order AND DON'T create aOrderHistoryEntryModelentry refundService.apply(Arrays.asList(refundEntry), refundOrderPreview), false); // afterwards, if the customer agrees with the offered refund, we would apply the refund on the original order AND create aOrderHistoryEntryModelentry refundService.apply(Arrays.asList(refundEntry), order), true);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(OrderModel previewOrder, ReturnRequestModel request) Based on the assigned refund entries of the 'previewOrder'RefundService.createRefundOrderPreview(OrderModel), the 'finalOrder' will be recalculated and modification entries will be written.voidapply(List<RefundEntryModel> refunds, OrderModel order) Based on the assigned refund entries the order will be recalculatedprotected OrderHistoryEntryModelcreateOrderHistoryEntry(OrderModel processedOrder, OrderModel snapshot) Creates a history entry for the 'processedOrder'.protected StringGenerates a order history comment from the specified refunds by collecting the stored 'refund notes'createRefundOrderPreview(OrderModel original) Create a "refund order" based on the specified order instance.protected CalculationServiceprotected AbstractOrderEntryModelgetEntry(AbstractOrderModel order, Integer postion) Returns the order entry at a specified position.protected FlexibleSearchServiceprotected ModelServiceprotected AbstractOrderEntryModelgetOrderEntry(RefundEntryModel refund, AbstractOrderModel order) protected OrderHistoryServiceprotected OrderServiceprotected RefundDaogetRefunds(ReturnRequestModel request) Returns the refunds for the specified ordervoidsetCalculationService(CalculationService calculationService) voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService) voidsetModelService(ModelService modelService) voidsetModificationHandler(OrderReturnRecordHandler modificationHandler) voidsetOrderHistoryService(OrderHistoryService orderHistoryService) voidsetOrderService(OrderService orderService) voidsetRefundDao(RefundDao refundDao)
-
Constructor Details
-
DefaultRefundService
public DefaultRefundService()
-
-
Method Details
-
setRefundDao
- Parameters:
refundDao- the refundDao to set
-
setModificationHandler
- Parameters:
modificationHandler- the modificationHandler to set
-
getModificationHandler
-
getOrderEntry
-
createRefundOrderPreview
Create a "refund order" based on the specified order instance. The returned refund order, will be a clone of the original one (seeOrderHistoryService.createHistorySnapshot(OrderModel). This new instance should be used for applying the refund. (see: RefundService#calculate)
Note:theReturnRequestinstance of the specified order will not be 'cloned' or 'referenced'.- Specified by:
createRefundOrderPreviewin interfaceRefundService- Parameters:
original- the original order- Returns:
- the refund order
-
apply
Based on the assigned refund entries the order will be recalculated- Specified by:
applyin interfaceRefundService- Parameters:
refunds- the refunds for which the amount will be calculatedorder- the refund order for which the refund will be calculated
-
apply
public void apply(OrderModel previewOrder, ReturnRequestModel request) throws OrderReturnRecordsHandlerException Based on the assigned refund entries of the 'previewOrder'RefundService.createRefundOrderPreview(OrderModel), the 'finalOrder' will be recalculated and modification entries will be written.- Specified by:
applyin interfaceRefundService- Parameters:
previewOrder- the order which holds the preview of refundrequest- the request which holds the order for which the refunds will be calculated AND the "refund entries" which will be logged byOrderReturnRecordHandler- Throws:
OrderReturnRecordsHandlerException- in case of DAO error
-
createOrderHistoryEntryDescription
Generates a order history comment from the specified refunds by collecting the stored 'refund notes'- Parameters:
refunds- the refunds from which the nodes will be extracted- Returns:
- the generated order history comment
-
createOrderHistoryEntry
protected OrderHistoryEntryModel createOrderHistoryEntry(OrderModel processedOrder, OrderModel snapshot) Creates a history entry for the 'processedOrder'.- Parameters:
processedOrder- the 'modified' ordersnapshot- the original of the order- Returns:
- the created order history entry
-
getEntry
Returns the order entry at a specified position.- Parameters:
postion-- Returns:
- the related order entry (can be 'null')
- Throws:
JaloItemNotFoundException
-
getRefunds
Returns the refunds for the specified order- Specified by:
getRefundsin interfaceRefundService- Parameters:
request- the request- Returns:
- the refunds
-
getRefundDao
-
getOrderService
-
setOrderService
-
getCalculationService
-
setCalculationService
-
getFlexibleSearchService
-
setFlexibleSearchService
-
getOrderHistoryService
-
setOrderHistoryService
-
getModelService
-
setModelService
-