mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 05:18:11 +00:00
Nationality, guest booking, waafi adapter, overall booking flow updates
This commit is contained in:
@@ -10,14 +10,16 @@ export class SearchController {
|
||||
|
||||
@Post()
|
||||
@ApiOperation({
|
||||
summary: 'Search schedules by any origin–destination stop pair',
|
||||
description: `Finds all train schedules where both origin and destination appear as stops (not just terminals).
|
||||
summary: 'Search trips by origin, destination, date, passengers, and nationality',
|
||||
description: `Finds all train schedules matching search criteria with real-time seat availability.
|
||||
|
||||
Example: A train running A→B→C→D will appear in results for A→B, A→C, A→D, B→C, B→D, and C→D searches.
|
||||
|
||||
Availability is computed per seat per segment — a seat booked A→B is still shown as available for B→D.
|
||||
|
||||
Returns departure/arrival times for the requested leg, the full stop list, and per-class seat counts.`
|
||||
- Any origin→destination stop pair (not just terminals)
|
||||
- Age-based passenger counts (adults ≥5 years, children <5 years)
|
||||
- Nationality filtering (Ethiopian, Djiboutian, Other)
|
||||
- Real-time seat availability per class
|
||||
- Multi-currency fare display
|
||||
- Example: Train A→B→C→D appears in results for A→B, A→C, A→D, B→C, B→D, C→D
|
||||
- Availability: Segment-based (seat booked A→B is still available B→D)`
|
||||
})
|
||||
@ApiResponse({ status: 200, description: 'Matching schedules with segment-accurate seat availability per class' })
|
||||
searchTrips(@Body() dto: SearchTripsDto) {
|
||||
@@ -26,17 +28,29 @@ Returns departure/arrival times for the requested leg, the full stop list, and p
|
||||
|
||||
@Post('fare-quote')
|
||||
@ApiOperation({
|
||||
summary: 'Get fare quote for a specific schedule leg',
|
||||
description: `Calculates fare for the requested origin→destination leg on a schedule.
|
||||
summary: 'Get fare quote with age-based pricing and multi-currency support',
|
||||
description: `Calculates detailed fare breakdown for a specific schedule leg.
|
||||
|
||||
Pricing rules (in priority order):
|
||||
Age-Based Pricing:
|
||||
- ADULT (≥5 years): 100% of base fare
|
||||
- CHILD (<5 years): First child FREE, subsequent children 100%
|
||||
- Example: 2 adults + 3 children = 4× base fare
|
||||
|
||||
Pricing Rules (priority order):
|
||||
1. Schedule-scoped FareRule (tripId = scheduleId)
|
||||
2. Segment route FareRule (e.g. ADD-DRE)
|
||||
3. Full-route FareRule (e.g. ADD-DJI)
|
||||
4. Default hardcoded fare
|
||||
|
||||
Age-based pricing: first child (age < 5) travels free, subsequent children pay full fare.
|
||||
Supports multi-currency display (ETB, DJF, USD).`
|
||||
Multi-Currency:
|
||||
- Transaction currency: ETB
|
||||
- Display currencies: ETB, DJF, USD
|
||||
- Real-time exchange rate conversion
|
||||
|
||||
Nationality-Based:
|
||||
- Ethiopian: National ID verification required
|
||||
- Djiboutian: Passport details, Waafi payment available
|
||||
- Other: Passport details, international payments`
|
||||
})
|
||||
@ApiResponse({ status: 200, description: 'Fare breakdown with adult/child pricing, discounts, taxes, and currency conversion' })
|
||||
@ApiResponse({ status: 404, description: 'Schedule not found or origin/destination not on schedule' })
|
||||
|
||||
Reference in New Issue
Block a user