Admin initiated RMA creation process
The returns process is initiated in the Admin via the com.broadleafcommerce.oms.admin.web.controller.AdminOmsCustomerController
Endpoint to get all returnable orders for a customer:
@RequestMapping(value = "/{customerId}/orders-for-return", method = RequestMethod.GET)
public ModelAndView getOrdersForReturn(@PathVariable("customerId") Long customerId) throws ServiceException, Exception {...}
Note: A CSR has the ability to see all order details and by default does not do any filtering.
Endpoint to estimate RMA totals (useful to incrementally see real-time refund estimates before actually persisting an RMA):
@RequestMapping(value = "/estimate-rma-totals", method = RequestMethod.POST)
public ModelAndView getEstimateRMATotals(@ModelAttribute("returnAuthGroupForm") ReturnAuthGroupForm returnAuthGroupForm) throws ReturnsException {...}
Endpoint to create a pending RMA:
@RequestMapping(value = "/create-rma", method = RequestMethod.POST)
@ResponseBody
public String createReturnAuthorization(HttpServletRequest request,@ModelAttribute("returnAuthGroupForm") ReturnAuthGroupForm returnAuthGroupForm) throws ReturnsException {...}
Endpoint to cancel a pending RMA:
@RequestMapping(value = "/rma/{returnAuthGroupId}/cancel", method = RequestMethod.POST)
@ResponseBody
public void cancelRMA(HttpServletRequest request, HttpServletResponse response,@PathVariable("returnAuthGroupId") Long returnAuthGroupId) throws ReturnsException {...}
Admin initiated RMA confirmation process (Warehouse and Returns Agent functions)
The return confirmation process is initiated in the Admin via the com.broadleafcommerce.oms.admin.web.controller.AdminOmsReceiptController
Endpoint to estimate Return Authorization Group confirmation totals:
@RequestMapping(value = "/{returnAuthorizationGroupId}/estimate-rma-confirmation-totals", method = RequestMethod.POST)
@ResponseBody
public ModelAndView estimateRMAConfirmationTotals(HttpServletRequest request, @ModelAttribute("returnConfGroupForm") ReturnConfForm returnConfForm) throws ReturnsException, RefundException {...}
Endpoint to actually confirm the Return Items in a Return Auth Group:
@RequestMapping(value = "/{returnAuthorizationGroupId}/confirm", method = RequestMethod.POST)
@ResponseBody
public void confirmRMA(HttpServletRequest request,@ModelAttribute("returnConfForm") ReturnConfForm returnConfForm) throws ReturnsException {...}
Site initiated RMA process
The site can initiate the RMA process using the same services that the Admin uses. See endpoints in the above Admin controllers for reference.
When you install the OMS module: the org.broadleafcommerce.core.order.domain.Order
domain is enhanced with several OMS specific properties that you can use to display various Order and Return level statuses to the Customer on your site
For example:
To get the Secondary Order Status for an Order:
SecondaryOrderStatus secondaryStatus = (OMSOrder) order.getSecondaryStatus();
To get all Fulfillment Orders that have been created against an Order, you can call:
List<FulfillmentOrder> fos = (OMSOrder) order.getAllFulfillmentOrders();
To get all Return Authorizations that have been created for an Order, you can call:
List<ReturnAuthorization> ras = (OMSOrder) order.getReturnAuthorizations();
There are also several convenience methods available to you as well:
getChangeOrderStatus()
getTotalAmountRefunded()
getTotalAmountAppeased()
It's best to look at com.broadleafcommerce.oms.order.domain.OMSOrderImpl
and determine what properties are available to you for a given order.
Return Refund Calculation
The default strategy to calculate the estimated and actual refund that will be initiated is defined here: com.broadleafcommerce.oms.returns.strategy.RefundCalculationStrategy