Class DefaultOmsReturnFacade
- java.lang.Object
-
- de.hybris.platform.ordermanagementfacades.OmsBaseFacade
-
- de.hybris.platform.ordermanagementfacades.returns.impl.DefaultOmsReturnFacade
-
- All Implemented Interfaces:
OmsReturnFacade
public class DefaultOmsReturnFacade extends OmsBaseFacade implements OmsReturnFacade
Order management default Return Facade implementation for theOmsReturnFacade
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOGGER
-
Constructor Summary
Constructors Constructor Description DefaultOmsReturnFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapproveReturnRequest(java.lang.String code)API to approve theReturnRequestModelby its codeprotected java.math.BigDecimalcalculateRefundEntryAmount(AbstractOrderEntryModel orderEntryModel, java.lang.Long expectedQuantity, boolean completeReturn)Evaluates refundAmount for theRefundEntryModelto be created.voidcancelReturnRequest(CancelReturnRequestData cancelReturnRequestData)API to cancel aReturnRequestModelprotected java.lang.BooleancanRefundDeliveryCost(java.lang.String orderCode, java.lang.Boolean isDeliveryCostRequested)Evaluates if deliveryCost should be refunded for the requestedReturnRequestModelto be createdReturnRequestDatacreateReturnRequest(ReturnRequestData returnRequestData)API to create aReturnRequestModelprotected ReturnRequestModelcreateReturnRequestInContext(OrderModel order, ReturnRequestData returnRequestData)CreatesReturnRequestModelin theImpersonationContextprotected voidevaluateResultList(ReturnEntryModificationData entry, java.util.List<ReturnEntryModel> resultList)Verifies that the list is neither missing or duplicated and sets theRefundEntryModel.AMOUNTwith theReturnEntryModificationData.refundAmountprotected BaseStoreServicegetBaseStoreService()java.util.List<CancelReason>getCancelReasons()API to get all return cancel reasonsprotected CustomerAccountServicegetCustomerAccountService()protected EnumerationServicegetEnumerationService()protected EventServicegetEventService()protected ImpersonationServicegetImpersonationService()protected java.util.Set<ReturnStatus>getInvalidReturnStatusForRefundDeliveryCost()protected OrderServicegetOrderService()SearchPageData<ReturnRequestData>getPagedReturnRequestsByCurrentUser(PageableData pageableData, ReturnStatus... returnStatuses)Returns the pagedReturnRequestDatafor the current user.java.util.List<RefundReason>getRefundReasons()API to get all return refund reasonsprotected RefundServicegetRefundService()java.util.List<ReturnAction>getReturnActions()API to get all return actionsprotected ReturnCallbackServicegetReturnCallbackService()protected Converter<ReturnRequestModel,ReturnRequestData>getReturnConverter()SearchPageData<ReturnEntryData>getReturnEntriesForReturnCode(java.lang.String code, PageableData pageableData)API to get returnEntries for the givenReturnRequestModel.CODEprotected Converter<ReturnEntryModel,ReturnEntryData>getReturnEntryConverter()protected PagedGenericDao<ReturnEntryModel>getReturnEntryPagedGenericDao()ReturnRequestDatagetReturnForReturnCode(java.lang.String code)API to get aReturnRequestDataby its codeprotected GenericDao<ReturnRequestModel>getReturnGenericDao()protected Converter<ReturnRequestModel,ReturnRequestData>getReturnHistoryConverter()protected PagedGenericDao<ReturnRequestModel>getReturnPagedGenericDao()protected ReturnRequestModelgetReturnRequestModelForCode(java.lang.String code)FindsReturnRequestModelfor the given "code"SearchPageData<ReturnRequestData>getReturns(PageableData pageableData)API to get all returns in the systemSearchPageData<ReturnRequestData>getReturnsByStatuses(PageableData pageableData, java.util.Set<ReturnStatus> returnStatusSet)API to get all returns in the system that have certain status(s)protected ReturnServicegetReturnService()java.util.List<ReturnStatus>getReturnStatuses()API to get all return statusesprotected java.math.BigDecimalgetTotalReturnEntriesAmount(ReturnRequestModel returnRequest)Sums the amount ofRefundEntryModel.getAmount()in theReturnRequestModelprotected UserServicegetUserService()java.lang.BooleanisCompleteReturn(OrderModel orderModel, ReturnRequestData returnRequestData)API to check if theReturnRequestDatacontains a complete order return.booleanisDeliveryCostRefundable(java.lang.String orderCode, java.lang.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 java.math.BigDecimalrecalculateSubtotal(ReturnRequestModel returnRequest, boolean completeReturn)Recalculate the sub total after updating a refund amountvoidrequestManualPaymentReversalForReturnRequest(java.lang.String code)API to reverse payment manually for the returnRequest by its codevoidrequestManualTaxReversalForReturnRequest(java.lang.String code)API 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(java.util.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 possibleReturnRequestDataupdateReturnRequest(java.lang.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 thrown-
Methods inherited from class de.hybris.platform.ordermanagementfacades.OmsBaseFacade
convertSearchPageData, createPaginationData, discardOrderSnapshot, getModelService, getOrderGenericDao, getOrderModelForCode, setModelService, setOrderGenericDao
-
-
-
-
Method Detail
-
getReturns
public SearchPageData<ReturnRequestData> getReturns(PageableData pageableData)
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, java.util.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
public ReturnRequestData getReturnForReturnCode(java.lang.String code)
Description copied from interface:OmsReturnFacadeAPI to get aReturnRequestDataby its code- Specified by:
getReturnForReturnCodein interfaceOmsReturnFacade- Parameters:
code- the returnRequest's code- Returns:
- the returnRequest
-
getCancelReasons
public java.util.List<CancelReason> getCancelReasons()
Description copied from interface:OmsReturnFacadeAPI to get all return cancel reasons- Specified by:
getCancelReasonsin interfaceOmsReturnFacade- Returns:
- a list of
CancelReason
-
getReturnStatuses
public java.util.List<ReturnStatus> getReturnStatuses()
Description copied from interface:OmsReturnFacadeAPI to get all return statuses- Specified by:
getReturnStatusesin interfaceOmsReturnFacade- Returns:
- a list of
ReturnStatus
-
getRefundReasons
public java.util.List<RefundReason> getRefundReasons()
Description copied from interface:OmsReturnFacadeAPI to get all return refund reasons- Specified by:
getRefundReasonsin interfaceOmsReturnFacade- Returns:
- a list of
RefundReason
-
getReturnActions
public java.util.List<ReturnAction> 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(java.lang.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
public void approveReturnRequest(java.lang.String code)
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(java.lang.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
public void cancelReturnRequest(CancelReturnRequestData cancelReturnRequestData)
Description copied from interface:OmsReturnFacadeAPI to cancel aReturnRequestModel- Specified by:
cancelReturnRequestin interfaceOmsReturnFacade- Parameters:
cancelReturnRequestData- contains information about the cancellation of the return request.
-
requestManualPaymentReversalForReturnRequest
public void requestManualPaymentReversalForReturnRequest(java.lang.String code)
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
public void requestManualTaxReversalForReturnRequest(java.lang.String code)
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
public ReturnRequestData createReturnRequest(ReturnRequestData returnRequestData)
Description copied from interface:OmsReturnFacadeAPI to create aReturnRequestModel- Specified by:
createReturnRequestin interfaceOmsReturnFacade- Parameters:
returnRequestData- theReturnRequestDatato createReturnRequestModel- Returns:
- the
ReturnRequestDataconverted from the newly createdReturnRequestModel
-
isDeliveryCostRefundable
public boolean isDeliveryCostRefundable(java.lang.String orderCode, java.lang.String returnRequestRMA)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
public java.lang.Boolean isCompleteReturn(OrderModel orderModel, ReturnRequestData returnRequestData)
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
protected java.math.BigDecimal recalculateSubtotal(ReturnRequestModel returnRequest, boolean completeReturn)
Recalculate the sub total after updating a refund amount- Parameters:
returnRequest-ReturnRequestModel
-
getTotalReturnEntriesAmount
protected java.math.BigDecimal getTotalReturnEntriesAmount(ReturnRequestModel returnRequest)
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
protected boolean isReturnCancellable(ReturnStatus status)
Checks whether the return can be cancelled- Parameters:
status- current status of the return request- Returns:
- whether the return request is cancellable
-
validateReturnRequestData
protected void validateReturnRequestData(ReturnRequestData returnRequestData)
Validates for null check and mandatory fields in returnRequestData- Parameters:
returnRequestData- returnRequest to be validated
-
validateReturnEntryData
protected void validateReturnEntryData(ReturnEntryData returnEntryData)
Validates for null check and mandatory fields in returnEntryData- Parameters:
returnEntryData- returnEntry to be validated
-
validateOrderEntryForReturnEntry
protected void validateOrderEntryForReturnEntry(OrderEntryData orderEntry)
Validates for null check and mandatory fields in returnEntryData- Parameters:
orderEntry- orderEntry to be validated
-
calculateRefundEntryAmount
protected java.math.BigDecimal calculateRefundEntryAmount(AbstractOrderEntryModel orderEntryModel, java.lang.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
protected java.lang.Boolean canRefundDeliveryCost(java.lang.String orderCode, java.lang.Boolean isDeliveryCostRequested)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
protected ReturnRequestModel getReturnRequestModelForCode(java.lang.String code)
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, java.util.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
protected PagedGenericDao<ReturnRequestModel> getReturnPagedGenericDao()
-
setReturnPagedGenericDao
public void setReturnPagedGenericDao(PagedGenericDao<ReturnRequestModel> returnPagedGenericDao)
-
getReturnConverter
protected Converter<ReturnRequestModel,ReturnRequestData> getReturnConverter()
-
setReturnConverter
public void setReturnConverter(Converter<ReturnRequestModel,ReturnRequestData> returnConverter)
-
getReturnHistoryConverter
protected Converter<ReturnRequestModel,ReturnRequestData> getReturnHistoryConverter()
-
setReturnHistoryConverter
public void setReturnHistoryConverter(Converter<ReturnRequestModel,ReturnRequestData> returnHistoryConverter)
-
getEnumerationService
protected EnumerationService getEnumerationService()
-
setEnumerationService
public void setEnumerationService(EnumerationService enumerationService)
-
getReturnGenericDao
protected GenericDao<ReturnRequestModel> getReturnGenericDao()
-
setReturnGenericDao
public void setReturnGenericDao(GenericDao<ReturnRequestModel> returnGenericDao)
-
getReturnEntryPagedGenericDao
protected PagedGenericDao<ReturnEntryModel> getReturnEntryPagedGenericDao()
-
setReturnEntryPagedGenericDao
public void setReturnEntryPagedGenericDao(PagedGenericDao<ReturnEntryModel> returnEntryPagedGenericDao)
-
getReturnEntryConverter
protected Converter<ReturnEntryModel,ReturnEntryData> getReturnEntryConverter()
-
setReturnEntryConverter
public void setReturnEntryConverter(Converter<ReturnEntryModel,ReturnEntryData> returnEntryConverter)
-
getReturnService
protected ReturnService getReturnService()
-
setReturnService
public void setReturnService(ReturnService returnService)
-
getReturnCallbackService
protected ReturnCallbackService getReturnCallbackService()
-
setReturnCallbackService
public void setReturnCallbackService(ReturnCallbackService returnCallbackService)
-
getOrderService
protected OrderService getOrderService()
-
setOrderService
public void setOrderService(OrderService orderService)
-
getEventService
protected EventService getEventService()
-
setEventService
public void setEventService(EventService eventService)
-
getRefundService
protected RefundService getRefundService()
-
setRefundService
public void setRefundService(RefundService refundService)
-
getImpersonationService
protected ImpersonationService getImpersonationService()
-
setImpersonationService
public void setImpersonationService(ImpersonationService impersonationService)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getBaseStoreService
protected BaseStoreService getBaseStoreService()
-
setBaseStoreService
public void setBaseStoreService(BaseStoreService baseStoreService)
-
getCustomerAccountService
protected CustomerAccountService getCustomerAccountService()
-
setCustomerAccountService
public void setCustomerAccountService(CustomerAccountService customerAccountService)
-
getInvalidReturnStatusForRefundDeliveryCost
protected java.util.Set<ReturnStatus> getInvalidReturnStatusForRefundDeliveryCost()
-
setInvalidReturnStatusForRefundDeliveryCost
public void setInvalidReturnStatusForRefundDeliveryCost(java.util.Set<ReturnStatus> invalidReturnStatusForRefundDeliveryCost)
-
-