riccardo-sapuppo

Nautical Rental Portal

A charter booking flow rebuilt so the price is written down once on the server, and the browser carries only an unguessable reference to it.

Area
Booking
Main stack
PHP · PHPUnit · SQLite · PDO

Key features

  • • Confirming a booking takes a reference, a customer and the clock: there is no price field to tamper with
  • • Money is whole cents throughout, with a parser that refuses an ambiguous amount instead of guessing
  • • A quote is consumed by one conditional update, so a double-click cannot book twice
  • • Six named reasons to refuse a stale quote; when the price moved, the refusal carries a fresh one
  • • The catalogue import refuses the whole run if it would withdraw more than a quarter of the boats
  • • Five claims computed at run time, printed by a command that fails when one stops holding

About the project

A charter costs four thousand euros, sometimes ten, and in the site this rebuilds the total was a number the customer’s own browser carried. A price fetched over AJAX came back as HTML with two hidden inputs inside it, was posted to the next page, echoed into two more, posted again, and finally written into the booking as four money fields — list price, sale price, deposit, final price — every one of them read from the request and never compared with anything.

The rebuild removes the field rather than validating it: the price is worked out once on the server, written down as a quote that stands for twenty minutes, and referred to afterwards by sixteen bytes from the operating system’s random source. The method that confirms a booking takes a reference, a customer and the clock, and has nowhere to put a total; a test reads its parameters by reflection and fails if anyone adds one.

Around that sit the cases a quote creates: an offer that expired, a price that moved, a boat somebody else took, and a double-click that must not book twice.

Technologies used

  • PHP
  • PHPUnit
  • SQLite
  • PDO
  • WordPress
  • Docker
  • Composer
  • GitHub Actions
main
nautical-rental-portal.mdUTF-8TypeScript