public class DefaultRefundService extends java.lang.Object implements RefundService
RefundService// 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 and Description |
|---|
DefaultRefundService() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(java.util.List<RefundEntryModel> refunds,
OrderModel order)
Based on the assigned refund entries the order will be recalculated
|
void |
apply(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. |
protected OrderHistoryEntryModel |
createOrderHistoryEntry(OrderModel processedOrder,
OrderModel snapshot)
Creates a history entry for the 'processedOrder'.
|
protected java.lang.String |
createOrderHistoryEntryDescription(java.util.List<RefundEntryModel> refunds)
Generates a order history comment from the specified refunds by collecting the stored 'refund notes'
|
OrderModel |
createRefundOrderPreview(OrderModel original)
Create a "refund order" based on the specified order instance.
|
protected CalculationService |
getCalculationService() |
protected AbstractOrderEntryModel |
getEntry(AbstractOrderModel order,
java.lang.Integer postion)
Returns the order entry at a specified position.
|
protected FlexibleSearchService |
getFlexibleSearchService() |
protected ModelService |
getModelService() |
OrderReturnRecordHandler |
getModificationHandler() |
protected AbstractOrderEntryModel |
getOrderEntry(RefundEntryModel refund,
AbstractOrderModel order) |
protected OrderHistoryService |
getOrderHistoryService() |
protected OrderService |
getOrderService() |
protected RefundDao |
getRefundDao() |
java.util.List<RefundEntryModel> |
getRefunds(ReturnRequestModel request)
Returns the refunds for the specified order
|
void |
setCalculationService(CalculationService calculationService) |
void |
setFlexibleSearchService(FlexibleSearchService flexibleSearchService) |
void |
setModelService(ModelService modelService) |
void |
setModificationHandler(OrderReturnRecordHandler modificationHandler) |
void |
setOrderHistoryService(OrderHistoryService orderHistoryService) |
void |
setOrderService(OrderService orderService) |
void |
setRefundDao(RefundDao refundDao) |
public void setRefundDao(RefundDao refundDao)
refundDao - the refundDao to setpublic void setModificationHandler(OrderReturnRecordHandler modificationHandler)
modificationHandler - the modificationHandler to setpublic OrderReturnRecordHandler getModificationHandler()
protected AbstractOrderEntryModel getOrderEntry(RefundEntryModel refund, AbstractOrderModel order)
public OrderModel createRefundOrderPreview(OrderModel original)
OrderHistoryService.createHistorySnapshot(OrderModel). This new instance should be used
for applying the refund. (see: RefundService#calculate)ReturnRequest instance of the specified order will not be 'cloned' or 'referenced'.createRefundOrderPreview in interface RefundServiceoriginal - the original orderpublic void apply(java.util.List<RefundEntryModel> refunds, OrderModel order)
apply in interface RefundServicerefunds - the refunds for which the amount will be calculatedorder - the refund order for which the refund will be calculatedpublic void apply(OrderModel previewOrder, ReturnRequestModel request) throws OrderReturnRecordsHandlerException
RefundService.createRefundOrderPreview(OrderModel) , the 'finalOrder' will be recalculated and
modification entries will be written.apply in interface RefundServicepreviewOrder - 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 by OrderReturnRecordHandlerOrderReturnRecordsHandlerException - in case of DAO errorprotected java.lang.String createOrderHistoryEntryDescription(java.util.List<RefundEntryModel> refunds)
refunds - the refunds from which the nodes will be extractedprotected OrderHistoryEntryModel createOrderHistoryEntry(OrderModel processedOrder, OrderModel snapshot)
processedOrder - the 'modified' ordersnapshot - the original of the orderprotected AbstractOrderEntryModel getEntry(AbstractOrderModel order, java.lang.Integer postion)
postion - JaloItemNotFoundExceptionpublic java.util.List<RefundEntryModel> getRefunds(ReturnRequestModel request)
getRefunds in interface RefundServicerequest - the requestprotected RefundDao getRefundDao()
protected OrderService getOrderService()
public void setOrderService(OrderService orderService)
protected CalculationService getCalculationService()
public void setCalculationService(CalculationService calculationService)
protected FlexibleSearchService getFlexibleSearchService()
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
protected OrderHistoryService getOrderHistoryService()
public void setOrderHistoryService(OrderHistoryService orderHistoryService)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
Copyright © 2018 SAP SE. All Rights Reserved.