mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Merge remote changes: Add SeatClass model and seat-classes module while preserving local IAM integration and enhancements
This commit is contained in:
@@ -92,7 +92,7 @@ export class BookingsService {
|
||||
}
|
||||
|
||||
// Calculate fare with age-based pricing
|
||||
const baseFareMinor = await this.getBaseFare(dto.tripId, dto.serviceClass);
|
||||
const baseFareMinor = await this.getBaseFare(dto.tripId, dto.serviceClass, dto.seatClassId);
|
||||
const adultFareMinor = baseFareMinor * adultCount;
|
||||
const paidChildrenCount = Math.max(0, childCount - 1);
|
||||
const childFareMinor = baseFareMinor * paidChildrenCount;
|
||||
@@ -176,7 +176,13 @@ export class BookingsService {
|
||||
};
|
||||
}
|
||||
|
||||
private async getBaseFare(tripId: string, serviceClass: string): Promise<number> {
|
||||
private async getBaseFare(tripId: string, serviceClass: string, seatClassId?: string): Promise<number> {
|
||||
if (seatClassId) {
|
||||
const fareRule = await this.prisma.fareRule.findFirst({
|
||||
where: { tripId, seatClassId },
|
||||
});
|
||||
if (fareRule) return fareRule.baseFareMinor;
|
||||
}
|
||||
const fareRule = await this.prisma.fareRule.findFirst({
|
||||
where: { tripId, serviceClass: serviceClass as any },
|
||||
});
|
||||
@@ -208,7 +214,7 @@ export class BookingsService {
|
||||
fullName: bs.passengerName,
|
||||
category: bs.passengerCategory,
|
||||
verifaydaVerified: bs.verifaydaVerified,
|
||||
seat: { number: bs.seat.label, coach: bs.seat.coach.label, class: bs.seat.coach.serviceClass },
|
||||
seat: { number: bs.seat.label, coach: bs.seat.coach.label, class: bs.seat.coach.serviceClass, seatClassId: bs.seat.coach.seatClassId },
|
||||
})),
|
||||
payment: booking.paymentIntent ? { method: booking.paymentIntent.method, status: booking.paymentIntent.status } : undefined,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user