Skip to content

feat(customers): add rider routes with owner checks - #420

Merged
roncodes merged 6 commits into
release/v0.7.0from
feat/passenger-rider-access
Nov 6, 2026
Merged

roncodes merged 6 commits into
release/v0.7.0from
feat/passenger-rider-access

Conversation

@roncodes

@roncodes roncodes commented Nov 5, 2026

Copy link
Copy Markdown
Member

Summary

Adds the /v1/customers routes a white-label rider app needs, so it no longer has to use company-wide routes. Every route is limited to the signed-in rider's own records. An order or place belonging to someone else returns 404.

New routes

  • POST customers/request-code sends a login or signup code and answers the same for any number. verify-code returns new_customer only after the code is proven, without using the code up.
  • GET customers/places/search returns the rider's places plus geocoder results. Unowned rows are excluded because they hold addresses from other riders' trips.
  • GET customers/geocode looks up an address or coordinates and stores nothing.
  • POST, PUT and DELETE customers/places.
  • POST customers/me/phone-code.
  • POST customers/orders/{id}/dispatch and cancel, and GET driver, tracker and eta. driver returns name, photo, location and car, with no contact details.

Behaviour changes for existing callers

  • customers/me refuses a phone change unless it comes with a code sent to the new number, and refuses a number another account holds. Storefront and Navigator don't use this route, but a third-party integration might.
  • ServiceQuote::resolveFromRequest treats another company's quote as not found.
  • customers/orders refuses an expired fare or one from another company.
  • verify-code for an unknown identity now says Invalid verification code. instead of Unable to verify code..
  • GET service-quotes?preview=1 no longer stores a place for coordinates.
  • The signup password is optional.

Left unchanged

  • places/search still returns customer-owned places to a full key, because the Odoo and ERPNext clients use it. The rider key in fleetbase/core-api is what keeps a published app off this route.
  • customers/login-with-sms still reveals unknown numbers to older callers.

The rider key profile is a separate change in core-api, and neither PR needs the other to merge first.

Testing

Pest passes on PHP 8.4 for every test file touching this code. The full suite wasn't run, and CI on this PR is the first full run.

Also run against a local API with a rider key: place isolation, saved places, previews storing nothing, cancel, tracker, ETA, two-step signup with no password, and phone changes.

Not exercised against a real API

  • request-code, which could text a real number (mocked tests only).
  • The socket principal, because socket auth is off locally.
  • driver and dispatch with a real assigned driver.

Give a rider app what it needs on /v1/customers, limited to the rider's
own records:
- request-code answers the same for known and unknown numbers
- verify-code reports new_customer only after the code is proven
- places/search, geocode, and saving, editing and deleting places
- dispatch, cancel, driver, tracker and ETA for the rider's own orders
- a narrow customer socket principal

Also:
- Make the signup password optional
- Require a code for the new number to change phone on customers/me
- Refuse expired fares when a rider books
- Stop fare previews storing a place per request
- Treat another company's service quote as not found
Composer refuses to install illuminate/mail on Laravel 10 because of
CVE-2026-48019, which has no patch before Laravel 12. Ignore this one
advisory in PHP CI so the tests can run. Production dependencies don't
change. Remove this when the Laravel 12 upgrade lands.
symfony/http-kernel 6.4, the only version Composer will install for
Laravel 10 now, conflicts with var-dumper below 6.3. This is a dev-only
dependency, and production already runs 6.4.
Cover the rider place, phone change, order and tracking routes, the
customer socket principal, and another company's service quote. Update
existing tests for the verify-code message and for phone changes needing
a code.

Check a quote's company after looking it up, so a quote from another
company is refused the same way for every lookup, and move the rider
place query behind a method so it can be tested.
@codecov

codecov Bot commented Nov 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (811aa71) to head (6e53c01).

Additional details and impacted files
@@             Coverage Diff              @@
##                main      #420    +/-   ##
============================================
  Coverage     100.00%   100.00%            
- Complexity     13847     13947   +100     
============================================
  Files            642       642            
  Lines          49865     50099   +234     
============================================
+ Hits           49865     50099   +234     
Flag Coverage Δ
backend 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@roncodes
roncodes changed the base branch from main to release/v0.7.0 November 6, 2026 02:41
@roncodes
roncodes merged commit f3e712c into release/v0.7.0 Nov 6, 2026
10 of 11 checks passed
@roncodes
roncodes deleted the feat/passenger-rider-access branch November 6, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant