Communication center, chat, interactive map, distance pricing & demo trips - #8
Merged
Merged
Conversation
…demo trips Message Center / login codes (S46): - Login verification codes no longer become inbox messages. The demo code lives only in a challenge-bound, login-page-only DemoLoginCodeStore in auth-service (POST /api/auth/sms-code returns an opaque challengeId; POST /sms-code/demo-peek requires it). Plaintext is deleted on login/lockout/TTL, never logged, never an inbox record. notification V2 purges AUTH_SMS_CODE rows; notify rejects the category; inbox queries exclude it defensively. - Production Message Center at /api/inbox (pagination, unread count, mark one/all read, category filter, deep links, masked+explicit reveal). Demo inbox removed. - Domain-event fan-out via transactional notification outbox in order-service (relayed with event_id as dedupe key), best-effort driver verification notices, and a trip-service departure-reminder scan. Shared NotificationCategory enum. Chat (feature 3): - Passenger-driver conversations bound to a legitimate order, hosted in notification-service (no new JVM). Participants derived server-side from order + trip records; non-participants get 404 on every endpoint. Idempotent send by clientMsgId, per-participant read cursors, rate limits, content validation, 5s polling. Mobile + desktop chat windows and conversation list. Pricing (feature 6): - fare = max(minFare, baseFare + max(0, km - includedKm) x extraPerKm), BigDecimal only, documented rounding. Components stored per trip; PriceBreakdown returned by POST /api/trips/route-preview and rendered verbatim in booking UIs. Map + geolocation (features 4-5) and demo virtual trips (feature 7): - Shared route-selection store, expanded interactive map, geolocation preflight + accuracy warning; demo-gated deterministic virtual-trip generation with cleanup. Preserves gateway-only access, server-authoritative prices/roles/state, demo isolation, idempotency, replay protection, audit logging. Full verify.sh green: backend BUILD SUCCESS, frontend typecheck/build, Playwright 15 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes login verification codes from the Message Center and turns it into a real user communication center, adds passenger–driver chat, an interactive map with a working geolocation flow, distance-based pricing, and demo virtual-trip generation — while preserving every existing security/architecture invariant (gateway-only access, server-authoritative prices/roles/state, demo isolation, idempotency, replay protection, audit logging).
1. Login codes out of the Message Center
DemoLoginCodeStorein auth-service.POST /api/auth/sms-codereturns an opaquechallengeId;POST /api/auth/sms-code/demo-peek {phone, challengeId}returns the code only on an exact match. Plaintext is deleted on successful login, on lockout, and by TTL; never logged, never an inbox/notification record.V2purges historicalAUTH_SMS_CODEdeliveries;notifyrejects the category (CATEGORY_NOT_INBOXABLE); inbox queries exclude it defensively.2. Production Message Center (
/api/inbox)event_idas the receiver dedupe key) at every state transition; best-effort driver-verification notices; trip-service departure-reminder@Scheduledscan. SharedNotificationCategoryenum.3. Passenger–driver chat
clientMsgId, per-participant read cursors, send/create rate limits, 1–500 char validation, 5s polling. Mobile + desktop chat window and conversation list; "联系司机/乘客" entries on order cards.4–5. Interactive map + geolocation
6. Distance-based pricing
fare = max(minFare, baseFare + max(0, distanceKm − includedKm) × extraPerKm), BigDecimal only, documented rounding. Components stored per trip so the displayed breakdown always matches the stored price. NewPOST /api/trips/route-previewreturns{route, PriceBreakdown}(single pricing authority); rendered verbatim in booking UIs.7. Demo virtual trips
app.demo.virtual-trips-enabled, fenced byDemoModeGuard), deterministic seeded generation, strictly formula-derived prices, synthetic non-authenticatable drivers,source='DEMO'label, delete-then-insert cap + expiry cleanup,randomroute via an unrouted map-service demo-places endpoint.Migrations
V2purge,V3inbox links/dedupe,V4chat tablesV5notification outboxV6departure reminder,V7pricing breakdown,V8sourceVerification
./scripts/verify.shgreen — backendBUILD SUCCESS(all 15 modules), frontend typecheck + build (user-h5 + admin-console)scripts/demo-smoke.sh(needs the local Docker stack) and staging SSE load test.🤖 Generated with Claude Code