Design the backend for an online shopping cart that lets users temporarily collect items before converting the cart into a confirmed order at checkout.
Each cart belongs to exactly one (user, merchant) pair. A user may therefore have different carts for different merchants, but only one active cart for a particular merchant. Users should be able to add and remove items, change quantities, leave the application, and…