Road distance, ETA computation, and deterministic pricing quotes for the eBikes Africa dispatch platform
# eBikes Africa — Routing & Pricing Service
> Computes road distances, ETAs, and deterministic pricing quotes for orders before the agent assignment begins.
---
## Overview
The Routing & Pricing service owns route orchestration and the full pricing lifecycle for the eBikes Africa dispatch
platform. It wraps a self-hosted Valhalla routing engine to produce point-to-point routes and agent distance matrices,
and generates immutable pricing quotes scoped to global, organization, and branch commercial terms.
A committed `PricingQuote` is a prerequisite for an order entering `PENDING_ASSIGNMENT`.
**Owns:**
- Pricing plans, modifiers, and quotes
- Route and matrix orchestration via Valhalla
- Business vehicle class → engine costing profile mapping
- Haversine fallback when the routing engine is unavailable
- Scoped pricing resolution (`BRANCH → ORGANIZATION → GLOBAL`)
**Does not own:**
- Agent proximity search — belongs to Workforce
- Assignment strategy — belongs to Assignment
- Order lifecycle state transitions — belongs to Orders
---
## Platform Context
| Relationship | Service | How |
|--------------|------------|--------------------------------------------------------------|
| Consumed by | Orders | `POST /quotes` — committed quote before `PENDING_ASSIGNMENT` |
| Consumed by | Assignment | `POST /matrices` — distance/ETA for Workforce shortlist |
| Depends on | Valhalla | Self-hosted routing engine for routes and matrices |
| Auth via | Keycloak | JWT / OIDC — all endpoints require Bearer token |
---
## Tech Stack
| Concern | Technology |
|-----------|------------------------------------|
| Language | Java 21 |
| Framework | Spring Boot 3.x |
| Database | PostgreSQL (Liquibase migrations) |
| Messaging | RabbitMQ (outbox pattern) |
| Auth | Keycloak (JWT / OIDC) …