Class DefaultOmsReturnFacade
java.lang.Object
de.hybris.platform.ordermanagementfacades.OmsBaseFacade
de.hybris.platform.ordermanagementfacades.returns.impl.DefaultOmsReturnFacade
- All Implemented Interfaces:
OmsReturnFacade
Order management default Return Facade implementation for the
OmsReturnFacade-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapproveReturnRequest(String code) API to approve theReturnRequestModelby its codeprotected BigDecimalcalculateRefundEntryAmount(AbstractOrderEntryModel orderEntryModel, Long expectedQuantity, boolean completeReturn) Evaluates refundAmount for theRefundEntryModelto be created.voidcancelReturnRequest(CancelReturnRequestData cancelReturnRequestData) API to cancel aReturnRequestModelprotected BooleancanRefundDeliveryCost(String orderCode, Boolean isDeliveryCostRequested) Evaluates if deliveryCost should be refunded for the requestedReturnRequestModelto be createdcreateReturnRequest(ReturnRequestData returnRequestData) API to create aReturnRequestModelprotected ReturnRequestModelcreateReturnRequestInContext(OrderModel order, ReturnRequestData returnRequestData) CreatesReturnRequestModelin theImpersonationContextprotected voidevaluateResultList(ReturnEntryModificationData entry, List<ReturnEntryModel> resultList) Verifies that the list is neither missing or duplicated and sets theRefundEntryModel.AMOUNTwith theReturnEntryModificationData.refundAmountprotected BaseStoreServiceAPI to get all return cancel reasonsprotected CustomerAccountServiceprotected EnumerationServiceprotected EventServiceprotected ImpersonationServiceprotected Set<ReturnStatus>protected OrderServicegetPagedReturnRequestsByCurrentUser(PageableData pageableData, ReturnStatus... returnStatuses) Returns the pagedReturnRequestDatafor the current user.API to get all return refund reasonsprotected RefundServiceAPI to get all return actionsprotected ReturnCallbackServiceprotected Converter<ReturnRequestModel,ReturnRequestData> getReturnEntriesForReturnCode(String code, PageableData pageableData) API to get returnEntries for the givenReturnRequestModel.CODEprotected Converter<ReturnEntryModel,ReturnEntryData> protected PagedGenericDao<ReturnEntryModel>getReturnForReturnCode(String code) API to get aReturnRequestDataby its codeprotected GenericDao<ReturnRequestModel>protected Converter<ReturnRequestModel,ReturnRequestData> protected PagedGenericDao<ReturnRequestModel>protected ReturnRequestModelFindsReturnRequestModelfor the given "code"getReturns(PageableData pageableData) API to get all returns in the systemgetReturnsByStatuses(PageableData pageableData, Set<ReturnStatus> returnStatusSet) API to get all returns in the system that have certain status(s)protected ReturnServiceAPI to get all return statusesprotected BigDecimalgetTotalReturnEntriesAmount(ReturnRequestModel returnRequest) Sums the amount ofRefundEntryModel.getAmount()in theReturnRequestModelprotected UserServiceisCompleteReturn(OrderModel orderModel, ReturnRequestData returnRequestData) API to check if theReturnRequestDatacontains a complete order return.booleanisDeliveryCostRefundable(String orderCode, String returnRequestRMA) Verifies if the delivery cost is refundable for the given order and return request.protected booleanisReturnCancellable(ReturnStatus status) Checks whether the return can be cancelledprotected BigDecimalrecalculateSubtotal(ReturnRequestModel returnRequest, boolean completeReturn) Recalculate the sub total after updating a refund amountvoidAPI to reverse payment manually for the returnRequest by its codevoidAPI to reverse tax manually for the returnRequest by its codevoidsetBaseStoreService(BaseStoreService baseStoreService) voidsetCustomerAccountService(CustomerAccountService customerAccountService) voidsetEnumerationService(EnumerationService enumerationService) voidsetEventService(EventService eventService) voidsetImpersonationService(ImpersonationService impersonationService) voidsetInvalidReturnStatusForRefundDeliveryCost(Set<ReturnStatus> invalidReturnStatusForRefundDeliveryCost) voidsetOrderService(OrderService orderService) voidsetRefundService(RefundService refundService) voidsetReturnCallbackService(ReturnCallbackService returnCallbackService) voidsetReturnConverter(Converter<ReturnRequestModel, ReturnRequestData> returnConverter) voidsetReturnEntryConverter(Converter<ReturnEntryModel, ReturnEntryData> returnEntryConverter) voidsetReturnEntryPagedGenericDao(PagedGenericDao<ReturnEntryModel> returnEntryPagedGenericDao) voidsetReturnGenericDao(GenericDao<ReturnRequestModel> returnGenericDao) voidsetReturnHistoryConverter(Converter<ReturnRequestModel, ReturnRequestData> returnHistoryConverter) voidsetReturnPagedGenericDao(PagedGenericDao<ReturnRequestModel> returnPagedGenericDao) voidsetReturnService(ReturnService returnService) voidsetUserService(UserService userService) protected voidupdateRefundDeliveryCost(ReturnRequestModificationData returnRequestModificationData, ReturnRequestModel returnRequest) Update refundDeliveryCost if possibleprotected voidupdateReturnEntries(ReturnRequestModificationData returnRequestModificationData, ReturnRequestModel returnRequest) Update return entries if possibleupdateReturnRequest(String code, ReturnRequestModificationData returnRequestModificationData) API to update theReturnRequestModelprotected voidvalidateOrderEntryForReturnEntry(OrderEntryData orderEntry) Validates for null check and mandatory fields in returnEntryDataprotected voidvalidateReturnEntryData(ReturnEntryData returnEntryData) Validates for null check and mandatory fields in returnEntryDataprotected booleanvalidateReturnEntryModificationData(ReturnRequestModificationData returnRequestModificationData) Validate duplicated entries forReturnEntryModificationDataprotected voidvalidateReturnRequestData(ReturnRequestData returnRequestData) Validates for null check and mandatory fields in returnRequestDataprotected voidvalidateReturnStatus(ReturnRequestModel returnRequest, ReturnStatus expectedReturnStatus) IfReturnRequestModelis not in the expected status for an update, a IllegalStateException will be thrownMethods inherited from class de.hybris.platform.ordermanagementfacades.OmsBaseFacade
convertSearchPageData, createPaginationData, discardOrderSnapshot, getModelService, getOrderGenericDao, getOrderModelForCode, setModelService, setOrderGenericDao
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER
-
-
Constructor Details
-
DefaultOmsReturnFacade
public DefaultOmsReturnFacade()
-
-
Method Details
-
getReturns
Description copied from interface:OmsReturnFacadeAPI to get all returns in the system- Specified by:
getReturnsin interfaceOmsReturnFacade- Parameters:
pageableData- pageable object that contains info on the number or pages and how many items in each page in addition the sorting info- Returns:
- SearchPageData that contains a list of returns
-
getPagedReturnRequestsByCurrentUser
public SearchPageData<ReturnRequestData> getPagedReturnRequestsByCurrentUser(PageableData pageableData, ReturnStatus... returnStatuses) Description copied from interface:OmsReturnFacadeReturns the pagedReturnRequestDatafor the current user.- Specified by:
getPagedReturnRequestsByCurrentUserin interfaceOmsReturnFacade- Parameters:
pageableData- paging informationreturnStatuses- the list ofReturnStatus. If null or empty, all statuses are included.- Returns:
- The
ReturnRequestDatafor the current user.
-
getReturnsByStatuses
public SearchPageData<ReturnRequestData> getReturnsByStatuses(PageableData pageableData, Set<ReturnStatus> returnStatusSet) Description copied from interface:OmsReturnFacadeAPI to get all returns in the system that have certain status(s)- Specified by:
getReturnsByStatusesin interfaceOmsReturnFacade- Parameters:
pageableData- pageable object that contains info on the number or pages and how many items in each page in addition the sorting inforeturnStatusSet- set of return status(s) in which we want to get list of returns for.- Returns:
- SearchPageData that contains a list of returns that complies with passed return status(es)
-
getReturnForReturnCode
Description copied from interface:OmsReturnFacadeAPI to get aReturnRequestDataby its code- Specified by:
getReturnForReturnCodein interfaceOmsReturnFacade- Parameters:
code- the returnRequest's code- Returns:
- the returnRequest
-
getCancelReasons
Description copied from interface:OmsReturnFacadeAPI to get all return cancel reasons- Specified by:
getCancelReasonsin interfaceOmsReturnFacade- Returns:
- a list of
CancelReason
-
getReturnStatuses
Description copied from interface:OmsReturnFacadeAPI to get all return statuses- Specified by:
getReturnStatusesin interfaceOmsReturnFacade- Returns:
- a list of
ReturnStatus
-
getRefundReasons
Description copied from interface:OmsReturnFacadeAPI to get all return refund reasons- Specified by:
getRefundReasonsin interfaceOmsReturnFacade- Returns:
- a list of
RefundReason
-
getReturnActions
Description copied from interface:OmsReturnFacadeAPI to get all return actions- Specified by:
getReturnActionsin interfaceOmsReturnFacade- Returns:
- a list of
ReturnAction
-
getReturnEntriesForReturnCode
public SearchPageData<ReturnEntryData> getReturnEntriesForReturnCode(String code, PageableData pageableData) Description copied from interface:OmsReturnFacadeAPI to get returnEntries for the givenReturnRequestModel.CODE- Specified by:
getReturnEntriesForReturnCodein interfaceOmsReturnFacade- Parameters:
code- the return's codepageableData- pageable object that contains info on the number or pages and how many items in each page in addition the sorting info- Returns:
- SearchPageData that contains a list of the returnEntries for the given order
-
approveReturnRequest
Description copied from interface:OmsReturnFacadeAPI to approve theReturnRequestModelby its code- Specified by:
approveReturnRequestin interfaceOmsReturnFacade- Parameters:
code- the code for theReturnRequestModelto be approved
-
updateReturnRequest
public ReturnRequestData updateReturnRequest(String code, ReturnRequestModificationData returnRequestModificationData) Description copied from interface:OmsReturnFacadeAPI to update theReturnRequestModel- Specified by:
updateReturnRequestin interfaceOmsReturnFacade- Parameters:
code- the return request's codereturnRequestModificationData-ReturnRequestModificationData- Returns:
ReturnRequestData
-
cancelReturnRequest
Description copied from interface:OmsReturnFacadeAPI to cancel aReturnRequestModel- Specified by:
cancelReturnRequestin interfaceOmsReturnFacade- Parameters:
cancelReturnRequestData- contains information about the cancellation of the return request.
-
requestManualPaymentReversalForReturnRequest
Description copied from interface:OmsReturnFacadeAPI to reverse payment manually for the returnRequest by its code- Specified by:
requestManualPaymentReversalForReturnRequestin interfaceOmsReturnFacade- Parameters:
code- the code for the returnRequest
-
requestManualTaxReversalForReturnRequest
Description copied from interface:OmsReturnFacadeAPI to reverse tax manually for the returnRequest by its code- Specified by:
requestManualTaxReversalForReturnRequestin interfaceOmsReturnFacade- Parameters:
code- the code for the returnRequest
-
createReturnRequest
Description copied from interface:OmsReturnFacadeAPI to create aReturnRequestModel- Specified by:
createReturnRequestin interfaceOmsReturnFacade- Parameters:
returnRequestData- theReturnRequestDatato createReturnRequestModel- Returns:
- the
ReturnRequestDataconverted from the newly createdReturnRequestModel
-
isDeliveryCostRefundable
Description copied from interface:OmsReturnFacadeVerifies if the delivery cost is refundable for the given order and return request.- Specified by:
isDeliveryCostRefundablein interfaceOmsReturnFacade- Parameters:
orderCode- order codereturnRequestRMA- the return request RMA- Returns:
- true if the delivery cost can be refunded
-
isCompleteReturn
Description copied from interface:OmsReturnFacadeAPI to check if theReturnRequestDatacontains a complete order return.- Specified by:
isCompleteReturnin interfaceOmsReturnFacade- Parameters:
orderModel- theOrderModelrelated to the return requestreturnRequestData- the return form resultReturnRequestData- Returns:
- true if it's a complete return.
-
recalculateSubtotal
Recalculate the sub total after updating a refund amount- Parameters:
returnRequest-ReturnRequestModel
-
getTotalReturnEntriesAmount
Sums the amount ofRefundEntryModel.getAmount()in theReturnRequestModel- Parameters:
returnRequest-ReturnRequestModel
-
createReturnRequestInContext
protected ReturnRequestModel createReturnRequestInContext(OrderModel order, ReturnRequestData returnRequestData) CreatesReturnRequestModelin theImpersonationContext- Parameters:
order- theOrderModelfor which returnRequest needs to be createdreturnRequestData- theReturnRequestDatacontaining required data to createReturnRequestModel- Returns:
- the newly created
ReturnRequestModel
-
isReturnCancellable
Checks whether the return can be cancelled- Parameters:
status- current status of the return request- Returns:
- whether the return request is cancellable
-
validateReturnRequestData
Validates for null check and mandatory fields in returnRequestData- Parameters:
returnRequestData- returnRequest to be validated
-
validateReturnEntryData
Validates for null check and mandatory fields in returnEntryData- Parameters:
returnEntryData- returnEntry to be validated
-
validateOrderEntryForReturnEntry
Validates for null check and mandatory fields in returnEntryData- Parameters:
orderEntry- orderEntry to be validated
-
calculateRefundEntryAmount
protected BigDecimal calculateRefundEntryAmount(AbstractOrderEntryModel orderEntryModel, Long expectedQuantity, boolean completeReturn) Evaluates refundAmount for theRefundEntryModelto be created. If the order is not discounted, base price is used. Else: - For a complete order return: Discounted value is applied. - For a partial order return: A value of zero is applied.- Parameters:
orderEntryModel- the basePrice for the product to be refundedexpectedQuantity- expectedQuantity for the product to be refundedcompleteReturn- if the return is a complete order return- Returns:
- the amount in BigDecimal to be refunded for the
RefundEntryModel
-
canRefundDeliveryCost
Evaluates if deliveryCost should be refunded for the requestedReturnRequestModelto be created- Parameters:
orderCode- the orderCode's code for the requested returnRequest to be createdisDeliveryCostRequested- is deliveryCost requested in the request- Returns:
- the boolean to indicate if deliveryCost should be refunded
-
getReturnRequestModelForCode
FindsReturnRequestModelfor the given "code"- Parameters:
code- the returnRequest's code- Returns:
- the requested return for the given code
-
updateReturnEntries
protected void updateReturnEntries(ReturnRequestModificationData returnRequestModificationData, ReturnRequestModel returnRequest) Update return entries if possible- Parameters:
returnRequestModificationData-ReturnRequestModificationDatareturnRequest-ReturnRequestModel
-
evaluateResultList
protected void evaluateResultList(ReturnEntryModificationData entry, List<ReturnEntryModel> resultList) Verifies that the list is neither missing or duplicated and sets theRefundEntryModel.AMOUNTwith theReturnEntryModificationData.refundAmount- Parameters:
entry- theReturnEntryModificationDataresultList- the result list to evaluate
-
updateRefundDeliveryCost
protected void updateRefundDeliveryCost(ReturnRequestModificationData returnRequestModificationData, ReturnRequestModel returnRequest) Update refundDeliveryCost if possible- Parameters:
returnRequestModificationData-ReturnRequestModificationDatareturnRequest-ReturnRequestModel
-
validateReturnStatus
protected void validateReturnStatus(ReturnRequestModel returnRequest, ReturnStatus expectedReturnStatus) IfReturnRequestModelis not in the expected status for an update, a IllegalStateException will be thrown- Parameters:
returnRequest-ReturnRequestModelexpectedReturnStatus-ReturnStatus
-
validateReturnEntryModificationData
protected boolean validateReturnEntryModificationData(ReturnRequestModificationData returnRequestModificationData) Validate duplicated entries forReturnEntryModificationData- Parameters:
returnRequestModificationData-ReturnRequestModificationData- Returns:
- true
ReturnEntryModificationDatathe entry valid
-
getReturnPagedGenericDao
-
setReturnPagedGenericDao
-
getReturnConverter
-
setReturnConverter
-
getReturnHistoryConverter
-
setReturnHistoryConverter
public void setReturnHistoryConverter(Converter<ReturnRequestModel, ReturnRequestData> returnHistoryConverter) -
getEnumerationService
-
setEnumerationService
-
getReturnGenericDao
-
setReturnGenericDao
-
getReturnEntryPagedGenericDao
-
setReturnEntryPagedGenericDao
public void setReturnEntryPagedGenericDao(PagedGenericDao<ReturnEntryModel> returnEntryPagedGenericDao) -
getReturnEntryConverter
-
setReturnEntryConverter
public void setReturnEntryConverter(Converter<ReturnEntryModel, ReturnEntryData> returnEntryConverter) -
getReturnService
-
setReturnService
-
getReturnCallbackService
-
setReturnCallbackService
-
getOrderService
-
setOrderService
-
getEventService
-
setEventService
-
getRefundService
-
setRefundService
-
getImpersonationService
-
setImpersonationService
-
getUserService
-
setUserService
-
getBaseStoreService
-
setBaseStoreService
-
getCustomerAccountService
-
setCustomerAccountService
-
getInvalidReturnStatusForRefundDeliveryCost
-
setInvalidReturnStatusForRefundDeliveryCost
public void setInvalidReturnStatusForRefundDeliveryCost(Set<ReturnStatus> invalidReturnStatusForRefundDeliveryCost)
-