Amirali YaghoutiSenior Software Engineer

webapp Case study

Smart Reservation Platform

A booking system looks like a calendar and behaves like a concurrency problem. Two people can want the same slot at the same moment, a payment callback can arrive twice, and a customer can close the tab between paying and being confirmed. All of the interesting work is in those cases.

The business problem

Naive booking code checks availability and then writes a reservation, which leaves a window where two requests both see the slot as free. Payment makes it worse. Gateways retry their callbacks, so the same successful payment can arrive two or three times. A handler that is not idempotent then creates duplicate reservations, or duplicate credit against a single payment.

What I delivered

  • A buyer deposit and reservation foundation where the reservation is created against a confirmed payment rather than optimistically.
  • Idempotency on the WooCommerce payment callback, so a repeated notification for the same payment produces the same single reservation.
  • Admin-defined capacity and time rules, so the constraints are configuration rather than being encoded in the booking logic.
  • A status history and timeline on the underlying record, so the sequence of states a reservation passed through is readable afterwards.
  • An audit and events layer beneath it, so state changes are recorded as they happen rather than reconstructed from the current row.
  • Feature flags and a schema manager, so the reservation work could be developed and enabled independently of the rest of the platform.

Technical approach

  • Idempotency is designed in at the callback, not added after the first duplicate. Gateway retries are normal behaviour, not an error condition, and a handler that assumes exactly-once delivery is wrong from the first day.
  • I made capacity and time rules admin-defined, so the same architecture serves different business models without a code change. That was the point of building it as a reusable foundation.
  • I record state transitions as history rather than overwriting them, because a reservation dispute is always a question about the sequence, not the current state.
  • I put the whole thing behind feature flags with its own schema management, which is what let it ship incrementally into a live platform.

Result and evidence

Reservations are created once per confirmed payment regardless of how many times the gateway calls back, and the capacity rules are configuration rather than code. The foundation is in place through the reservation and deposit stage; certificate issuance, delivery and settlement are separate later stages.

Commercial value

Double-booking and double-charging are the two failures a reservation system cannot have, because both are visible to the customer and expensive to unwind. Designing for them first is much cheaper than detecting them later.

implementation-brief.readme

Readable implementation brief

implementation_brief {
  project: "Smart Reservation Platform"
  base: "a2-javaherian-watch-bazaar, modular WordPress plugin"
  reservation: "created against a CONFIRMED payment, never
                optimistically"
  idempotency: "WooCommerce payment callback is idempotent;
                gateway retries are normal, not an error"
  rules: "capacity and time windows are admin-defined config"
  record: "status history + timeline + audit/events layer"
  rollout: "feature flags + schema manager, shipped
            incrementally into a live platform"
  scope: "foundation through deposit/reservation; issuance,
          delivery and settlement are later stages"
}

What this project shows

Callback idempotency is the part I would want examined. It is not difficult, it is just routinely omitted, and it is the defect that shows up as a customer charged twice.

Being explicit about what is built and what is not is deliberate. This is a foundation through the deposit and reservation stage, and describing it as a finished marketplace would be misleading.