feat(itineraries): partner itineraries API (#51) #156

Merged
amiryahaya merged 8 commits from feat/partner-itineraries-51 into main 2026-11-04 03:43:25 +01:00
Owner

What

Partner itineraries, API half of #51 (the web pages are PR B, the ADR and notes are Task 7). A tour operator saves a draft plan (customers of its organization, parks with dates, extras), gets the exact server-side quote, then requests payment: one pending tour_portal sale per park and currency, linked to the itinerary, which becomes pending_payment. Paying, invoices, refunds and cancel are #52.

  • Migration 0038: itineraries, itinerary_customers, itinerary_parks, itinerary_extras, itinerary_sales, transaction_lines.holder_name (tickets carry each traveller's name).
  • sales.ItinerarySales (Quote and Create share one pricing function, so the quote is the charge): whole stay priced day by day, KES if every day is natively priced else USD, extras per day times quantity, limited-seat products refused.
  • internal/itineraries (service, pgstore, handler): /v1/orgs/{id}/itineraries list, create, get, update, delete, /quote, /request-payment (idempotent; purchase rate class).
  • New setting itinerary_pending_days (default 7).
  • Tour-portal sales are hidden from the buyer's personal /v1/me reads, pay gate, QR and documents until #52 decides organization payment.

Review

Dual pass: ponytail-review (1 finding fixed, 1 deferred) then a fresh Opus reviewer (3 Important fixed, minors deferred; see the ledger). Rulings and deferred items are [verify] for the owner.

Checks

  • make lint: 0 issues. make contract: green (every operation exercised). Coverage (make cover): 91.6% total (minimum 80%); itineraries 95.7%/86.0%.

Owner questions: whole stay must be priced; extras charged per day times quantity; limited-seat products for operators; the KES-then-USD rule; itinerary status after its sales expire; payment method wallet on an immutable column.

🤖 Generated with Claude Code

## What Partner itineraries, API half of #51 (the web pages are PR B, the ADR and notes are Task 7). A tour operator saves a draft plan (customers of its organization, parks with dates, extras), gets the exact server-side quote, then requests payment: one pending `tour_portal` sale per park and currency, linked to the itinerary, which becomes `pending_payment`. Paying, invoices, refunds and cancel are #52. - Migration 0038: `itineraries`, `itinerary_customers`, `itinerary_parks`, `itinerary_extras`, `itinerary_sales`, `transaction_lines.holder_name` (tickets carry each traveller's name). - `sales.ItinerarySales` (Quote and Create share one pricing function, so the quote is the charge): whole stay priced day by day, KES if every day is natively priced else USD, extras per day times quantity, limited-seat products refused. - `internal/itineraries` (service, pgstore, handler): `/v1/orgs/{id}/itineraries` list, create, get, update, delete, `/quote`, `/request-payment` (idempotent; purchase rate class). - New setting `itinerary_pending_days` (default 7). - Tour-portal sales are hidden from the buyer's personal `/v1/me` reads, pay gate, QR and documents until #52 decides organization payment. ## Review Dual pass: ponytail-review (1 finding fixed, 1 deferred) then a fresh Opus reviewer (3 Important fixed, minors deferred; see the ledger). Rulings and deferred items are `[verify]` for the owner. ## Checks - `make lint`: 0 issues. `make contract`: green (every operation exercised). Coverage (`make cover`): **91.6%** total (minimum 80%); itineraries 95.7%/86.0%. Owner questions: whole stay must be priced; extras charged per day times quantity; limited-seat products for operators; the KES-then-USD rule; itinerary status after its sales expire; payment method `wallet` on an immutable column. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Routes under /v1/orgs/{id}/itineraries (list, create, get, update, delete, quote,
request-payment), OpenAPI operations and schemas, live contract test, wiring, and
the purchase rate class for request-payment.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fix(itineraries): review fixes (#51)
All checks were successful
ci / changes (pull_request) Successful in 19s
ci / clients (pull_request) Successful in 1m46s
ci / web-partner (pull_request) Successful in 7m53s
ci / api (pull_request) Successful in 10m42s
ci / web-ticket (pull_request) Successful in 11m48s
ci / web-admin (pull_request) Successful in 12m52s
ci / ci-gate (pull_request) Successful in 2s
c80914b13e
- itinerary (tour_portal) sales are hidden from the buyer's personal /v1/me reads, pay gate, QR and documents
- a removed partner customer cannot join a draft, and a removed one stops quote and request
- itinerary_pending_days is now a real setting (new days type, 1..365)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/kws!156
No description provided.