Preparing your design workspace

Loading the problem and your saved attempt…

Design an Extensible Return Resolution System

Decide which return resolutions an item qualifies for under product, category, and marketplace rules, and add new resolutions without rewriting the decision.

Design the part of an online store that decides which resolutions a customer can choose when returning a product. A resolution is how the return is settled. The store starts with two, Return and Refund, and must make it easy to add more later, such as Gift Card.

Business rules can differ by product, by category, and by marketplace (the store for one country or region). A cheaper item, say one under $100, might get Refund while a pricier item does not, and one item can qualify for several resolutions at once.

For this exercise, assume the following. Return means the customer sends the item back and gets the money once it arrives. Refund means a returnless refund: the money comes back and the customer keeps the item.

Each request covers one customer and one delivered order item: product, category, marketplace, price paid, and delivery date. The answer is the list of resolutions the item qualifies for today, in a fixed display order. An empty list is a valid answer.

An invalid request, such as one with a delivery date after today, is an error.

Rule values, such as price limits and return windows (how many days after delivery a resolution stays open), are data that business teams change without a code release. A rule can also turn a resolution off, for example for one product.

For each resolution, the most specific level that has a rule decides: product first, then category, then marketplace. If no level has a rule, the resolution is not offered. The same request, date, and rules always give the same answer.

Carrying out the chosen resolution (labels, payments, gift card balance) and the tools for editing rules are out of scope. Design the objects, their interfaces, and the decision flow.