TorbatYar/docs/delivery-phase-10-8.md
Mortezakoohjani 72077908f1 feat(delivery): deploy backend phases 10.2-10.8 through settlement
Ship fleet, availability, pricing, dispatch, routing, tracking, and settlement on delivery-service 0.10.8.0 with migrations and phase tests green.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 21:01:23 +03:30

51 lines
1.8 KiB
Markdown

# Phase 10.8 — Settlement
| Field | Value |
| --- | --- |
| Identifier | `delivery-10.8` |
| Status | Complete |
| Module | delivery |
| Service | `delivery-service` |
| Version | `0.10.8.0` |
| Database | `delivery_db` |
| API Port | 8007 |
| Depends On | Phase 10.7, Accounting 5.11 (contracts) |
| ADR(s) | ADR-010, ADR-015, ADR-006 |
| Commercial Product | Torbat Driver |
## Goal
Deliver driver/merchant **settlement intents** in Delivery with line items and lifecycle, posting settlement references to Accounting via `AccountingProvider` protocol only — **no journal ownership** in `delivery_db`.
## Scope Delivered
- Aggregates: `SettlementIntent`, `SettlementLine`
- Lifecycle: draft → submitted → settled / failed
- `AccountingProvider.create_settlement_ref` on settle (`acct://` ref prefix)
- Permissions `delivery.settlement.*`
- Events `delivery.settlement_intent.*`, `delivery.settlement_line.added`
- APIs: `/api/v1/settlements`, lines, submit, settle
- Alembic `0008_phase_107_108_tracking_settlement` (shared with 10.7)
- Tests: `test_phase_108.py` — proves no journal tables in delivery_db
## Out of Scope
- Merchant connector (10.9)
- JournalEntry / Posting Engine (Accounting owns)
- Communication notifications on settlement (10.9)
## Boundary Compliance
| Delivery owns | Delivery does not own |
| --- | --- |
| Settlement intent + line metadata | Accounting journals |
| External settlement ref after settle | Cross-DB queries |
| Outbox `delivery.settlement_intent.*` | Payment PSP settlement |
## Related Documents
- [Phase Handover 10.8](phase-handover/phase-10-8.md)
- [Service Snapshot](service-snapshots/delivery.yaml)
- [Delivery Roadmap](delivery-roadmap.md)
- [ADR-010](architecture/adr/ADR-010.md)