Phase 4 Route And Trip Calculation

SagaToll can now calculate and store a full trip from request to breakdown.

The repo has moved beyond isolated pricing previews. Route geometry, toll-point matching, pricing, and trip persistence now run through the same phase-4 flow that powers `POST /api/v1/trips/calculate`.

Trip engine

Routing, matching, pricing, and persistence now run as one deterministic flow

Access model

Signed sessions and tenant-aware API key boundaries remain in place

Route layer

HERE can plug in now, while local development still works without external keys

Phase 4 deliverable snapshot

What is live in the repo now?

Trip calculation schema for origin, destination, waypoints, departure time, and vehicle reference or inline vehicle data
Route-engine abstraction with HERE support when configured and a local development route builder when it is not
Route-to-toll-point matching for buffer-based points plus zone-entry detection
First end-to-end trip calculator that binds auth, routing, matching, pricing, persistence, and explainable response shaping
POST /api/v1/trips/calculate with tenant-aware API-key auth and structured validation errors
Seeded dashboard preview and trip history now generated through the real phase-4 route pipeline

Phase framing

Build order for SagaToll

Phase 1 established the app shell, local environment, migrations, and auth skeleton.
Phase 2 extended the data model and added tenant-safe CRUD plus seeded fixtures.
Phase 3 introduced the pricing engine as an isolated, testable service.
Phase 4 now connects route matching and the first end-to-end trip calculation.

Commercial baseline

Rate-limit plans from the spec

free

100/hour

1,000 requests/day and up to 10 trips per bulk job.

standard

1000/hour

25,000 requests/day and up to 100 trips per bulk job.

premium

5000/hour

100,000 requests/day and up to 500 trips per bulk job.

enterprise

10000/hour

250,000 requests/day and up to 1000 trips per bulk job.