ordercloud-api / headstart

A complete and opinionated eCommerce solution using OrderCloud as the backbone - built with .NET Core and Angular
MIT License
31 stars 74 forks source link

Replace rmas with ordercloud order returns #480

Closed crhistianramirez closed 1 year ago

crhistianramirez commented 1 year ago

This pull request removes our custom RMA functionality that was built on CosmosDB and replaces it with native OrderCloud Order Returns

Differences from previous implementation

Although OrderCloud order returns solves the same general problem, it does so in a slightly different way. Feature parity was kept wherever possible but there are some notable changes that should be mentioned

  1. You are now able to define which products are returnable (Product.Returnable) this is part of editing a product and will default to true on new products. If you are using an existing marketplace, this will need to be set to true before returns can be submitted against the order. Note: this will only work for any orders submitted from this point forward
  2. Order returns do not support partial cancellations and we have decided not to support partial cancellations via a custom feature at this time. An order must have no line items that have shipped for it to be canceled (in full). Once any line items on an order have shipped it can no longer be cancelled, only returns can be submitted against those shipped items.
  3. The approval process is working with OrderCloud's seller approval roles which means you can define a subset of admin users that are allowed to process returns. You can go to Seller Admin > Seller Users to add the "Order Return Approver" permission to any admin user that you wish. Note: they will need to log out and log back in for permissions to take effect, additionally old permissions are cached for up to 5 minutes
  4. You are now able to override return amounts. By default, the returned line items refund amount will be calculated to take into account promotions, tax, etc but will exclude shipping cost.
  5. Only admin users are able to process returns. Previously suppliers could also process returns.

Migrating an existing marketplace from RMAS (old) to Order Returns (new)

  1. Call the POST /seed endpoint to regenerate the data inside your marketplace
  2. Update Product.Returnable on any product you wish to be returnable. This can be done via the admin UI in product edit. Note: this will not affect already submitted orders
  3. Grant any admin user you wish to handle order returns the "Order Return Approver" permission. This can be done via the admin UI in Seller Admin > Seller Users > Edit seller user
  4. If you are using the Sendgrid integration, then you will need to define SendgridSettings:OrderReturnTemplateID in app settings. A default template can be found in assets/templates/email folder
  5. Deploy solution (new endpoints for handling order returns must be exposed to OrderCloud)

Order Return User Flow

  1. User creates an order where at least one lineitem has product.Returnable=true
  2. Admin ships line items where product.Returnable=true
  3. User creates an order return by selecting line items, quantities, and return reason
  4. Admin user belonging to the "Order Return Approver" user group can now see the order return awaiting their approval. They may choose to modify the refund amount on the line items and then "Approve" or "Decline" the order return with a comment. When approving the return they can choose to refund immediately in which case any payment will be refunded and the return will be completed or they can choose to simply approve it in which case they can elect to complete it at a later time (possibly when they receive the returned items)

Coming Soon