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.Logger
LOGGER
-
Constructor Summary
Constructors Constructor Description DefaultOmsReturnFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
approveReturnRequest(java.lang.String code)
API to approve theReturnRequestModel
by its codeprotected java.math.BigDecimal
calculateRefundEntryAmount(AbstractOrderEntryModel orderEntryModel, java.lang.Long expectedQuantity, boolean completeReturn)
Evaluates refundAmount for theRefundEntryModel
to be created.void
cancelReturnRequest(CancelReturnRequestData cancelReturnRequestData)
API to cancel aReturnRequestModel
protected java.lang.Boolean
canRefundDeliveryCost(java.lang.String orderCode, java.lang.Boolean isDeliveryCostRequested)
Evaluates if deliveryCost should be refunded for the requestedReturnRequestModel
to be createdReturnRequestData
createReturnRequest(ReturnRequestData returnRequestData)
API to create aReturnRequestModel
protected ReturnRequestModel
createReturnRequestInContext(OrderModel order, ReturnRequestData returnRequestData)
CreatesReturnRequestModel
in theImpersonationContext
protected void
evaluateResultList(ReturnEntryModificationData entry, java.util.List<ReturnEntryModel> resultList)
Verifies that the list is neither missing or duplicated and sets theRefundEntryModel.AMOUNT
with theReturnEntryModificationData.refundAmount
protected BaseStoreService
getBaseStoreService()
java.util.List<CancelReason>
getCancelReasons()
API to get all return cancel reasonsprotected CustomerAccountService
getCustomerAccountService()
protected EnumerationService
getEnumerationService()
protected EventService
getEventService()
protected ImpersonationService
getImpersonationService()
protected java.util.Set<ReturnStatus>
getInvalidReturnStatusForRefundDeliveryCost()
protected OrderService
getOrderService()
SearchPageData<ReturnRequestData>
getPagedReturnRequestsByCurrentUser(PageableData pageableData, ReturnStatus... returnStatuses)
Returns the pagedReturnRequestData
for the current user.java.util.List<RefundReason>
getRefundReasons()
API to get all return refund reasonsprotected RefundService
getRefundService()
java.util.List<ReturnAction>
getReturnActions()
API to get all return actionsprotected ReturnCallbackService
getReturnCallbackService()
protected Converter<ReturnRequestModel,ReturnRequestData>
getReturnConverter()
SearchPageData<ReturnEntryData>
getReturnEntriesForReturnCode(java.lang.String code, PageableData pageableData)
API to get returnEntries for the givenReturnRequestModel.CODE
protected Converter<ReturnEntryModel,ReturnEntryData>
getReturnEntryConverter()
protected PagedGenericDao<ReturnEntryModel>
getReturnEntryPagedGenericDao()
ReturnRequestData
getReturnForReturnCode(java.lang.String code)
API to get aReturnRequestData
by its codeprotected GenericDao<ReturnRequestModel>
getReturnGenericDao()
protected Converter<ReturnRequestModel,ReturnRequestData>
getReturnHistoryConverter()
protected PagedGenericDao<ReturnRequestModel>
getReturnPagedGenericDao()
protected ReturnRequestModel
getReturnRequestModelForCode(java.lang.String code)
FindsReturnRequestModel
for 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 ReturnService
getReturnService()
java.util.List<ReturnStatus>
getReturnStatuses()
API to get all return statusesprotected java.math.BigDecimal
getTotalReturnEntriesAmount(ReturnRequestModel returnRequest)
Sums the amount ofRefundEntryModel.getAmount()
in theReturnRequestModel
protected UserService
getUserService()
java.lang.Boolean
isCompleteReturn(OrderModel orderModel, ReturnRequestData returnRequestData)
API to check if theReturnRequestData
contains a complete order return.boolean
isDeliveryCostRefundable(java.lang.String orderCode, java.lang.String returnRequestRMA)
Verifies if the delivery cost is refundable for the given order and return request.protected boolean
isReturnCancellable(ReturnStatus status)
Checks whether the return can be cancelledprotected java.math.BigDecimal
recalculateSubtotal(ReturnRequestModel returnRequest, boolean completeReturn)
Recalculate the sub total after updating a refund amountvoid
requestManualPaymentReversalForReturnRequest(java.lang.String code)
API to reverse payment manually for the returnRequest by its codevoid
requestManualTaxReversalForReturnRequest(java.lang.String code)
API to reverse tax manually for the returnRequest by its codevoid
setBaseStoreService(BaseStoreService baseStoreService)
void
setCustomerAccountService(CustomerAccountService customerAccountService)
void
setEnumerationService(EnumerationService enumerationService)
void
setEventService(EventService eventService)
void
setImpersonationService(ImpersonationService impersonationService)
void
setInvalidReturnStatusForRefundDeliveryCost(java.util.Set<ReturnStatus> invalidReturnStatusForRefundDeliveryCost)
void
setOrderService(OrderService orderService)
void
setRefundService(RefundService refundService)
void
setReturnCallbackService(ReturnCallbackService returnCallbackService)
void
setReturnConverter(Converter<ReturnRequestModel,ReturnRequestData> returnConverter)
void
setReturnEntryConverter(Converter<ReturnEntryModel,ReturnEntryData> returnEntryConverter)
void
setReturnEntryPagedGenericDao(PagedGenericDao<ReturnEntryModel> returnEntryPagedGenericDao)
void
setReturnGenericDao(GenericDao<ReturnRequestModel> returnGenericDao)
void
setReturnHistoryConverter(Converter<ReturnRequestModel,ReturnRequestData> returnHistoryConverter)
void
setReturnPagedGenericDao(PagedGenericDao<ReturnRequestModel> returnPagedGenericDao)
void
setReturnService(ReturnService returnService)
void
setUserService(UserService userService)
protected void
updateRefundDeliveryCost(ReturnRequestModificationData returnRequestModificationData, ReturnRequestModel returnRequest)
Update refundDeliveryCost if possibleprotected void
updateReturnEntries(ReturnRequestModificationData returnRequestModificationData, ReturnRequestModel returnRequest)
Update return entries if possibleReturnRequestData
updateReturnRequest(java.lang.String code, ReturnRequestModificationData returnRequestModificationData)
API to update theReturnRequestModel
protected void
validateOrderEntryForReturnEntry(OrderEntryData orderEntry)
Validates for null check and mandatory fields in returnEntryDataprotected void
validateReturnEntryData(ReturnEntryData returnEntryData)
Validates for null check and mandatory fields in returnEntryDataprotected boolean
validateReturnEntryModificationData(ReturnRequestModificationData returnRequestModificationData)
Validate duplicated entries forReturnEntryModificationData
protected void
validateReturnRequestData(ReturnRequestData returnRequestData)
Validates for null check and mandatory fields in returnRequestDataprotected void
validateReturnStatus(ReturnRequestModel returnRequest, ReturnStatus expectedReturnStatus)
IfReturnRequestModel
is 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:OmsReturnFacade
API to get all returns in the system- Specified by:
getReturns
in 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:OmsReturnFacade
Returns the pagedReturnRequestData
for the current user.- Specified by:
getPagedReturnRequestsByCurrentUser
in interfaceOmsReturnFacade
- Parameters:
pageableData
- paging informationreturnStatuses
- the list ofReturnStatus
. If null or empty, all statuses are included.- Returns:
- The
ReturnRequestData
for the current user.
-
getReturnsByStatuses
public SearchPageData<ReturnRequestData> getReturnsByStatuses(PageableData pageableData, java.util.Set<ReturnStatus> returnStatusSet)
Description copied from interface:OmsReturnFacade
API to get all returns in the system that have certain status(s)- Specified by:
getReturnsByStatuses
in 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:OmsReturnFacade
API to get aReturnRequestData
by its code- Specified by:
getReturnForReturnCode
in interfaceOmsReturnFacade
- Parameters:
code
- the returnRequest's code- Returns:
- the returnRequest
-
getCancelReasons
public java.util.List<CancelReason> getCancelReasons()
Description copied from interface:OmsReturnFacade
API to get all return cancel reasons- Specified by:
getCancelReasons
in interfaceOmsReturnFacade
- Returns:
- a list of
CancelReason
-
getReturnStatuses
public java.util.List<ReturnStatus> getReturnStatuses()
Description copied from interface:OmsReturnFacade
API to get all return statuses- Specified by:
getReturnStatuses
in interfaceOmsReturnFacade
- Returns:
- a list of
ReturnStatus
-
getRefundReasons
public java.util.List<RefundReason> getRefundReasons()
Description copied from interface:OmsReturnFacade
API to get all return refund reasons- Specified by:
getRefundReasons
in interfaceOmsReturnFacade
- Returns:
- a list of
RefundReason
-
getReturnActions
public java.util.List<ReturnAction> getReturnActions()
Description copied from interface:OmsReturnFacade
API to get all return actions- Specified by:
getReturnActions
in interfaceOmsReturnFacade
- Returns:
- a list of
ReturnAction
-
getReturnEntriesForReturnCode
public SearchPageData<ReturnEntryData> getReturnEntriesForReturnCode(java.lang.String code, PageableData pageableData)
Description copied from interface:OmsReturnFacade
API to get returnEntries for the givenReturnRequestModel.CODE
- Specified by:
getReturnEntriesForReturnCode
in 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:OmsReturnFacade
API to approve theReturnRequestModel
by its code- Specified by:
approveReturnRequest
in interfaceOmsReturnFacade
- Parameters:
code
- the code for theReturnRequestModel
to be approved
-
updateReturnRequest
public ReturnRequestData updateReturnRequest(java.lang.String code, ReturnRequestModificationData returnRequestModificationData)
Description copied from interface:OmsReturnFacade
API to update theReturnRequestModel
- Specified by:
updateReturnRequest
in interfaceOmsReturnFacade
- Parameters:
code
- the return request's codereturnRequestModificationData
-ReturnRequestModificationData
- Returns:
ReturnRequestData
-
cancelReturnRequest
public void cancelReturnRequest(CancelReturnRequestData cancelReturnRequestData)
Description copied from interface:OmsReturnFacade
API to cancel aReturnRequestModel
- Specified by:
cancelReturnRequest
in interfaceOmsReturnFacade
- Parameters:
cancelReturnRequestData
- contains information about the cancellation of the return request.
-
requestManualPaymentReversalForReturnRequest
public void requestManualPaymentReversalForReturnRequest(java.lang.String code)
Description copied from interface:OmsReturnFacade
API to reverse payment manually for the returnRequest by its code- Specified by:
requestManualPaymentReversalForReturnRequest
in interfaceOmsReturnFacade
- Parameters:
code
- the code for the returnRequest
-
requestManualTaxReversalForReturnRequest
public void requestManualTaxReversalForReturnRequest(java.lang.String code)
Description copied from interface:OmsReturnFacade
API to reverse tax manually for the returnRequest by its code- Specified by:
requestManualTaxReversalForReturnRequest
in interfaceOmsReturnFacade
- Parameters:
code
- the code for the returnRequest
-
createReturnRequest
public ReturnRequestData createReturnRequest(ReturnRequestData returnRequestData)
Description copied from interface:OmsReturnFacade
API to create aReturnRequestModel
- Specified by:
createReturnRequest
in interfaceOmsReturnFacade
- Parameters:
returnRequestData
- theReturnRequestData
to createReturnRequestModel
- Returns:
- the
ReturnRequestData
converted from the newly createdReturnRequestModel
-
isDeliveryCostRefundable
public boolean isDeliveryCostRefundable(java.lang.String orderCode, java.lang.String returnRequestRMA)
Description copied from interface:OmsReturnFacade
Verifies if the delivery cost is refundable for the given order and return request.- Specified by:
isDeliveryCostRefundable
in 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:OmsReturnFacade
API to check if theReturnRequestData
contains a complete order return.- Specified by:
isCompleteReturn
in interfaceOmsReturnFacade
- Parameters:
orderModel
- theOrderModel
related 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)
CreatesReturnRequestModel
in theImpersonationContext
- Parameters:
order
- theOrderModel
for which returnRequest needs to be createdreturnRequestData
- theReturnRequestData
containing 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 theRefundEntryModel
to 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 requestedReturnRequestModel
to 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)
FindsReturnRequestModel
for 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
-ReturnRequestModificationData
returnRequest
-ReturnRequestModel
-
evaluateResultList
protected void evaluateResultList(ReturnEntryModificationData entry, java.util.List<ReturnEntryModel> resultList)
Verifies that the list is neither missing or duplicated and sets theRefundEntryModel.AMOUNT
with theReturnEntryModificationData.refundAmount
- Parameters:
entry
- theReturnEntryModificationData
resultList
- the result list to evaluate
-
updateRefundDeliveryCost
protected void updateRefundDeliveryCost(ReturnRequestModificationData returnRequestModificationData, ReturnRequestModel returnRequest)
Update refundDeliveryCost if possible- Parameters:
returnRequestModificationData
-ReturnRequestModificationData
returnRequest
-ReturnRequestModel
-
validateReturnStatus
protected void validateReturnStatus(ReturnRequestModel returnRequest, ReturnStatus expectedReturnStatus)
IfReturnRequestModel
is not in the expected status for an update, a IllegalStateException will be thrown- Parameters:
returnRequest
-ReturnRequestModel
expectedReturnStatus
-ReturnStatus
-
validateReturnEntryModificationData
protected boolean validateReturnEntryModificationData(ReturnRequestModificationData returnRequestModificationData)
Validate duplicated entries forReturnEntryModificationData
- Parameters:
returnRequestModificationData
-ReturnRequestModificationData
- Returns:
- true
ReturnEntryModificationData
the 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)
-
-