Package de.hybris.platform.returns.impl
Class DefaultReturnService
java.lang.Object
de.hybris.platform.returns.impl.DefaultReturnService
- All Implemented Interfaces:
ReturnCallbackService,ReturnService
- Direct Known Subclasses:
WarehousingReturnService
Default implementation of "Returns handling". It offers ...
- Configurable "Return Merchandise Authorization" aka "Return Material Authorization" (RMA) handling
- Replacement Order handling
- Refund handling incl. configurable calculation
- Configurable 'is returnable' check
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReplacementOrderEntries(ReplacementOrderModel order, List<ReplacementEntryModel> replacements) AddsReplacementOrderEntryModelentries from the specifiedReplacementEntryModel.createRefund(ReturnRequestModel request, AbstractOrderEntryModel entry, String notes, Long expectedQuantity, ReturnAction action, RefundReason reason) Creates a ReplRefundacement based on the assigned OrderEntry instancecreateReplacement(ReturnRequestModel request, AbstractOrderEntryModel entry, String notes, Long expectedQuantity, ReturnAction action, ReplacementReason reason) Creates a Replacement based on the assigned OrderEntry instancecreateReplacementOrder(ReturnRequestModel request) Creates aReplacementOrderModelcreateReturnRequest(OrderModel order) Creates an "authorization" object (@link ReturnRequest} for the order to be returned, if there doesn't exists one for that order so farcreateRMA(ReturnRequestModel request) creates "Return Merchandise Authorization" aka "Return Material Authorization" (RMA) and assigns it to the assignedReturnRequestModelReturns all returnableOrderEntry's.protected FlexibleSearchServiceprotected RMAGeneratorprotected ModelServiceprotected OrderReturnRecordHandlergetOrderByCode(String code) Returns an order by its codeGets order return record for a given order.protected RefundOrderProcessorprotected RefundServiceReturns theReplacementOrderModelby the specified 'RMA value'protected ReplacementOrderDaoprotected ReplacementOrderProcessorgetReplacements(ReturnRequestModel request) Returns all Replacements for the specified returns requestprotected List<ReturnableCheck>protected ReturnActionRequestExecutorgetReturnEntries(ProductModel product) Returns the ReturnsEntries for the specified productReturns the ReturnsEntries for the specified order entryprotected ReturnRequestDaogetReturnRequests(String code) Returns the "return request" for the specified orderprotected ReturnEntryProcessorgetRMA(ReturnRequestModel request) returns a "Return Merchandise Authorization" aka "Return Material Authorization" (RMA).booleanisReturnable(OrderModel order, AbstractOrderEntryModel entry, long returnQuantity) Determines if the product is 'returnable' by using the injectedReturnableCheckimplementations.longmaxReturnQuantity(OrderModel order, AbstractOrderEntryModel entry) the max returnable quantity of the product by using the injectedReturnableCheckimplementations.voidonReturnApprovalResponse(ReturnActionResponse approvalResponse) Callback method used by the adapter to pass approval operation result.voidonReturnCancelResponse(ReturnActionResponse cancelResponse) Callback method used by the adapter to pass cancellation operation result.voidonReturnReceptionResponse(ReturnActionResponse receptionResponse) Callback method used by the adapter to pass reception operation result.voidprocessRefundOrder(OrderModel order) Here you have the chance to 'inject' your final Refund order processing.voidHere you have the chance to 'inject' your final Replacement order processing.voidprocessReturnEntries(List<ReturnEntryModel> entries) Here you have the chance to 'inject' your final Returns Entry processing.voidrequestManualPaymentReversalForReturnRequest(ReturnRequestModel returnRequest) Request manual payment reversal for the (@link ReturnRequest}.voidrequestManualTaxReversalForReturnRequest(ReturnRequestModel returnRequest) Request manual tax reversal for the (@link ReturnRequest}.voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService) voidsetGenerator(RMAGenerator generator) voidsetModelService(ModelService modelService) voidsetModificationHandler(OrderReturnRecordHandler modificationHandler) voidsetRefundOrderProcessor(RefundOrderProcessor refundOrderProcessor) voidsetRefundService(RefundService refundService) voidsetReplacementOrderDao(ReplacementOrderDao replacementOrderDao) voidsetReplacementOrderProcessor(ReplacementOrderProcessor replacementOrderProcessor) voidsetReturnableChecks(List<ReturnableCheck> returnableChecks) voidsetReturnActionRequestExecutor(ReturnActionRequestExecutor returnActionRequestExecutor) voidsetReturnRequestDao(ReturnRequestDao returnRequestDao) voidsetReturnsEntryProcessor(ReturnEntryProcessor returnEntryProcessor)
-
Constructor Details
-
DefaultReturnService
public DefaultReturnService()
-
-
Method Details
-
getRefundService
- Returns:
- the configured refundService (calculation)
-
setRefundService
- Parameters:
refundService- the service to set
-
setReturnsEntryProcessor
-
getReturnsEntryProcessor
-
setReplacementOrderProcessor
-
getReplacementOrderProcessor
-
setRefundOrderProcessor
-
getRefundOrderProcessor
-
getReturnableChecks
- Returns:
- the returnableChecks
-
setReturnableChecks
- Parameters:
returnableChecks- the strategiesList to set
-
setGenerator
-
getGenerator
-
getRMA
returns a "Return Merchandise Authorization" aka "Return Material Authorization" (RMA).- Specified by:
getRMAin interfaceReturnService- Parameters:
request- reference of the related ReturnsRequest- Returns:
- RMA
-
createRMA
creates "Return Merchandise Authorization" aka "Return Material Authorization" (RMA) and assigns it to the assignedReturnRequestModel- Specified by:
createRMAin interfaceReturnService- Parameters:
request- reference of the related "ReturnRequest" for which this RMA will be created- Returns:
- RMA
-
createReturnRequest
Creates an "authorization" object (@link ReturnRequest} for the order to be returned, if there doesn't exists one for that order so far- Specified by:
createReturnRequestin interfaceReturnService- Parameters:
order- the order which should be returned- Returns:
- ReturnRequest instance, which will deliver among others the RMA code of every processed "return order".
-
getReturnRequests
Description copied from interface:ReturnServiceReturns the "return request" for the specified order- Specified by:
getReturnRequestsin interfaceReturnService- Parameters:
code- code of the order we ask for the "return request"- Returns:
- "return request" of the order
-
getOrderByCode
Returns an order by its code- Parameters:
code- the code of the order- Returns:
- the order
-
getReplacementOrder
Description copied from interface:ReturnServiceReturns theReplacementOrderModelby the specified 'RMA value'- Specified by:
getReplacementOrderin interfaceReturnService- Parameters:
rma- rma value- Returns:
- replacement order
-
createReplacementOrder
Creates aReplacementOrderModel- Specified by:
createReplacementOrderin interfaceReturnService- Parameters:
request- the returns request to which the order will be assigned- Returns:
- the Replacement Order'
-
createReplacement
public ReplacementEntryModel createReplacement(ReturnRequestModel request, AbstractOrderEntryModel entry, String notes, Long expectedQuantity, ReturnAction action, ReplacementReason reason) Creates a Replacement based on the assigned OrderEntry instance- Specified by:
createReplacementin interfaceReturnService- Parameters:
request- we use this for the verification process (order)entry- the original OrderEntrynotes- some notesexpectedQuantity- the amount of products which the customer wants to return.action- action which indicates if the 'returns process' will be executed immediately or is still on hold (waiting for the article to be send back)reason- reason for the replacement- Returns:
- Replacement Entry instance
-
createRefund
public RefundEntryModel createRefund(ReturnRequestModel request, AbstractOrderEntryModel entry, String notes, Long expectedQuantity, ReturnAction action, RefundReason reason) Creates a ReplRefundacement based on the assigned OrderEntry instance- Specified by:
createRefundin interfaceReturnService- Parameters:
request- we use this for the verification process (order)entry- the original OrderEntrynotes- some notesexpectedQuantity- the amount of products which the customer wants to got a refund.action- action which indicates if the 'returns process' will be executed immediately or is still on hold (waiting for the article to be send back)reason- reason for the refund- Returns:
- Refund entry instance
-
addReplacementOrderEntries
public void addReplacementOrderEntries(ReplacementOrderModel order, List<ReplacementEntryModel> replacements) AddsReplacementOrderEntryModelentries from the specifiedReplacementEntryModel. Caution: This impl. only acceptsReplacementEntryModelwhich are not on HOLDReturnAction.- Specified by:
addReplacementOrderEntriesin interfaceReturnService- Parameters:
order- the replacement orderreplacements- the 'replacement' entries (instances which are on HOLD will be ignored)
-
getReturnEntries
Returns the ReturnsEntries for the specified product- Specified by:
getReturnEntriesin interfaceReturnService- Parameters:
product- the product- Returns:
- the ReturnsEntry
-
getReturnEntry
Returns the ReturnsEntries for the specified order entry- Specified by:
getReturnEntryin interfaceReturnService- Parameters:
entry- the OrderEntry- Returns:
- the ReturnsEntry
-
getReplacements
Returns all Replacements for the specified returns request- Specified by:
getReplacementsin interfaceReturnService- Parameters:
request- the ReturnRequestModel- Returns:
- the replacements
-
isReturnable
Determines if the product is 'returnable' by using the injectedReturnableCheckimplementations. To be successful every strategy has to return 'true'. If no strategies were injected at all, 'true' will be returned as default.- Specified by:
isReturnablein interfaceReturnService- Parameters:
order- the related original orderentry- the ordered product which will be returnedreturnQuantity- the quantity of entries to be returned- Returns:
- true if product is 'returnable'
-
maxReturnQuantity
the max returnable quantity of the product by using the injectedReturnableCheckimplementations. Find the minimal 'max returnable quantity' of every strategy. If no strategies were injected at all, order entry quantity will be returned as default.- Specified by:
maxReturnQuantityin interfaceReturnService- Parameters:
order- the related original orderentry- the ordered product which will be returned- Returns:
- max returnable quantity of the product
-
getAllReturnableEntries
Returns all returnableOrderEntry's. The algorithm returns the max. returnable quantity for every single(!) order entry.- Specified by:
getAllReturnableEntriesin interfaceReturnService- Parameters:
order- the related order- Returns:
- all returnable
OrderEntryand their returnable quantity
-
getOrderReturnRecordForOrder
public OrderReturnRecordModel getOrderReturnRecordForOrder(OrderModel order) throws OrderReturnException Description copied from interface:ReturnServiceGets order return record for a given order.- Specified by:
getOrderReturnRecordForOrderin interfaceReturnService- Parameters:
order- instance ofOrderModelto get the return record for- Returns:
- order return record for the given order
- Throws:
OrderReturnException- in the case of error during service call
-
requestManualPaymentReversalForReturnRequest
public void requestManualPaymentReversalForReturnRequest(ReturnRequestModel returnRequest) throws OrderReturnException Description copied from interface:ReturnServiceRequest manual payment reversal for the (@link ReturnRequest}.- Specified by:
requestManualPaymentReversalForReturnRequestin interfaceReturnService- Parameters:
returnRequest- the return request for which payment should be manually reversed- Throws:
OrderReturnException- in the case of error during service call
-
requestManualTaxReversalForReturnRequest
public void requestManualTaxReversalForReturnRequest(ReturnRequestModel returnRequest) throws OrderReturnException Description copied from interface:ReturnServiceRequest manual tax reversal for the (@link ReturnRequest}.- Specified by:
requestManualTaxReversalForReturnRequestin interfaceReturnService- Parameters:
returnRequest- the return request for which tax should be manually reversed- Throws:
OrderReturnException- in the case of error during service call
-
processReturnEntries
Here you have the chance to 'inject' your final Returns Entry processing. For example for handling consignment creation- Specified by:
processReturnEntriesin interfaceReturnService- Parameters:
entries- the entries to be process
-
processReplacementOrder
Here you have the chance to 'inject' your final Replacement order processing. For example for handling consignment creation- Specified by:
processReplacementOrderin interfaceReturnService- Parameters:
order- the order to be process
-
processRefundOrder
Here you have the chance to 'inject' your final Refund order processing. For example for handling consignment creation or initiating the final payment transaction.- Specified by:
processRefundOrderin interfaceReturnService- Parameters:
order- the order to be process
-
onReturnApprovalResponse
public void onReturnApprovalResponse(ReturnActionResponse approvalResponse) throws OrderReturnException Description copied from interface:ReturnCallbackServiceCallback method used by the adapter to pass approval operation result. Adapter uses this method to provide feedback information how was the ReturnRequest approved (completely, partially, not at all).- Specified by:
onReturnApprovalResponsein interfaceReturnCallbackService- Parameters:
approvalResponse- - instance ofReturnActionResponse- Throws:
OrderReturnException- in case of error
-
onReturnCancelResponse
Description copied from interface:ReturnCallbackServiceCallback method used by the adapter to pass cancellation operation result. Adapter uses this method to provide feedback information how was the ReturnRequest cancelled (completely, partially, not at all).- Specified by:
onReturnCancelResponsein interfaceReturnCallbackService- Parameters:
cancelResponse- - instance ofReturnActionResponse- Throws:
OrderReturnException- in case of error
-
onReturnReceptionResponse
public void onReturnReceptionResponse(ReturnActionResponse receptionResponse) throws OrderReturnException Description copied from interface:ReturnCallbackServiceCallback method used by the adapter to pass reception operation result. Adapter uses this method to provide feedback information how was the ReturnRequest received (completely, partially, not at all).- Specified by:
onReturnReceptionResponsein interfaceReturnCallbackService- Parameters:
receptionResponse- - instance ofReturnActionResponse- Throws:
OrderReturnException- in case of error
-
getFlexibleSearchService
-
setFlexibleSearchService
-
getReturnActionRequestExecutor
-
setReturnActionRequestExecutor
-
getModelService
-
setModelService
-
getReplacementOrderDao
-
setReplacementOrderDao
-
getReturnRequestDao
-
setReturnRequestDao
-
getModificationHandler
-
setModificationHandler
-