public class DefaultRefundService extends AbstractBusinessService 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);
AbstractService.SerializableDTOmodelService, sessionService, txManagertenant| Constructor and Description |
|---|
DefaultRefundService() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(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 String |
createOrderHistoryEntryDescription(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 AbstractOrderEntryModel |
getEntry(AbstractOrderModel order,
Integer postion)
Returns the order entry at a specified position.
|
protected FlexibleSearchService |
getFlexibleSearchService() |
OrderReturnRecordHandler |
getModificationHandler() |
protected AbstractOrderEntryModel |
getOrderEntry(RefundEntryModel refund,
AbstractOrderModel order) |
protected OrderHistoryService |
getOrderHistoryService() |
protected OrderService |
getOrderService() |
protected RefundDao |
getRefundDao() |
List<RefundEntryModel> |
getRefunds(ReturnRequestModel request)
Returns the refunds for the specified order
|
void |
setFlexibleSearchService(FlexibleSearchService flexibleSearchService) |
void |
setModificationHandler(OrderReturnRecordHandler modificationHandler) |
void |
setOrderHistoryService(OrderHistoryService orderHistoryService) |
void |
setOrderService(OrderService orderService) |
void |
setRefundDao(RefundDao refundDao) |
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerafterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, setTenantScope, writeReplacepublic 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(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 OrderReturnRecordHandlerOrderReturnRecordsHandlerExceptionprotected String createOrderHistoryEntryDescription(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, Integer postion) throws JaloItemNotFoundException
postion - JaloItemNotFoundExceptionpublic List<RefundEntryModel> getRefunds(ReturnRequestModel request)
getRefunds in interface RefundServicerequest - the requestprotected RefundDao getRefundDao()
protected OrderService getOrderService()
public void setOrderService(OrderService orderService)
protected FlexibleSearchService getFlexibleSearchService()
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
protected OrderHistoryService getOrderHistoryService()
public void setOrderHistoryService(OrderHistoryService orderHistoryService)
Copyright © 2017 SAP SE. All Rights Reserved.