AlgoViz

Design an online shop

hard 90 min

Model a catalog, a cart, stock and orders as objects, and write a checkout that holds the goods, gets the money and sells, with a way back from every step.

Watch lesson4:40

Where it shows up

The same pattern appears across everyday software.

  • Adobe Commerce inventory

    Keeps a salable quantity apart from the quantity at each source. Reservations lower the first at checkout, and when an order ships the reservation clears and the source goes down. The split of this page between held and on hand.

  • Shopify inventory states

    An inventory level has several quantities such as available, on hand, incoming and committed. An order moves pieces from available to committed, and fulfilment lowers committed.

  • WooCommerce hold stock

    A setting in minutes: an unpaid order is cancelled when the limit is reached, and its held stock is released. The sand timer as a number in a form.

  • WooCommerce order statuses

    Pending payment, processing, completed, cancelled, refunded and others, with a meaning for each. A published table of states to compare with your own.

  • Saleor stock

    Documents stock reservation during checkout apart from stock allocation for orders. Two words for our HELD and SOLD.

  • Medusa inventory module

    Inventory items, levels for each location and reservation items, each reservation with its own record. Holds as rows and not as a counter.

  • Stripe PaymentIntent

    One object for one payment with states such as `requires_action` and `requires_capture`. It shows why "succeeded or not" is too small.

  • Stripe idempotent requests

    The same key returns the first result, so a lost answer can be asked for again. The order key of our checkout.

  • Adyen capture

    Documents capturing as a step after authorisation, with immediate, delayed and manual variants.

  • Spring Data JPA specifications

    The Specification pattern as an interface: small questions combined and turned into a database query.

  • commercetools carts

    Every cart has a version that an update must name. A second tab with the old version is refused.