mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 18:48:11 +00:00
@@ -321,7 +321,7 @@ export class BookingsService {
|
|||||||
bookingRef: b.bookingRef,
|
bookingRef: b.bookingRef,
|
||||||
status: b.status,
|
status: b.status,
|
||||||
totalMinor: b.totalMinor,
|
totalMinor: b.totalMinor,
|
||||||
currency: b.currency || 'ETB',
|
currency: b.currency || null,
|
||||||
displayCurrency: b.displayCurrency ?? null,
|
displayCurrency: b.displayCurrency ?? null,
|
||||||
displayTotalMinor: b.displayTotalMinor ?? null,
|
displayTotalMinor: b.displayTotalMinor ?? null,
|
||||||
adultCount: b.adultCount,
|
adultCount: b.adultCount,
|
||||||
@@ -554,7 +554,8 @@ export class BookingsService {
|
|||||||
const uniquePassengers = Array.from(new Map(passengerDetails.map((p: any) => [p.name, p])).values());
|
const uniquePassengers = Array.from(new Map(passengerDetails.map((p: any) => [p.name, p])).values());
|
||||||
return {
|
return {
|
||||||
id: booking.id, bookingRef: booking.bookingRef, status: booking.status,
|
id: booking.id, bookingRef: booking.bookingRef, status: booking.status,
|
||||||
totalMinor: resolvePackageRoundTripTotal(booking, booking.priceTier?.priceMinor, booking.adultCount, booking.childCount), currency: 'ETB',
|
totalMinor: resolvePackageRoundTripTotal(booking, booking.priceTier?.priceMinor, booking.adultCount, booking.childCount),
|
||||||
|
currency: booking.displayCurrency,
|
||||||
displayCurrency: booking.displayCurrency, displayTotalMinor: booking.displayTotalMinor,
|
displayCurrency: booking.displayCurrency, displayTotalMinor: booking.displayTotalMinor,
|
||||||
contactEmail: booking.contactEmail, contactPhone: booking.contactPhone,
|
contactEmail: booking.contactEmail, contactPhone: booking.contactPhone,
|
||||||
bookingType: booking.bookingType, packageId: booking.packageId, isPackageBooking: true,
|
bookingType: booking.bookingType, packageId: booking.packageId, isPackageBooking: true,
|
||||||
@@ -577,7 +578,7 @@ export class BookingsService {
|
|||||||
|
|
||||||
const mappedPkg = pkgItems.map((b: any) => ({
|
const mappedPkg = pkgItems.map((b: any) => ({
|
||||||
id: b.id, bookingRef: b.bookingRef, status: b.status,
|
id: b.id, bookingRef: b.bookingRef, status: b.status,
|
||||||
totalMinor: b.totalMinor, currency: b.currency || 'ETB',
|
totalMinor: b.totalMinor, currency: b.currency || b.displayCurrency,
|
||||||
displayCurrency: b.displayCurrency, displayTotalMinor: b.displayTotalMinor,
|
displayCurrency: b.displayCurrency, displayTotalMinor: b.displayTotalMinor,
|
||||||
contactEmail: b.contactEmail, contactPhone: b.contactPhone,
|
contactEmail: b.contactEmail, contactPhone: b.contactPhone,
|
||||||
bookingType: 'PACKAGE', packageId: b.packageId, priceTierId: b.priceTierId,
|
bookingType: 'PACKAGE', packageId: b.packageId, priceTierId: b.priceTierId,
|
||||||
@@ -723,7 +724,7 @@ export class BookingsService {
|
|||||||
bookingRef: b.bookingRef,
|
bookingRef: b.bookingRef,
|
||||||
status: b.status,
|
status: b.status,
|
||||||
totalMinor: b.totalMinor,
|
totalMinor: b.totalMinor,
|
||||||
currency: b.currency || 'ETB',
|
currency: b.currency || b.displayCurrency,
|
||||||
displayCurrency: b.displayCurrency,
|
displayCurrency: b.displayCurrency,
|
||||||
displayTotalMinor: b.displayTotalMinor,
|
displayTotalMinor: b.displayTotalMinor,
|
||||||
contactEmail: b.contactEmail,
|
contactEmail: b.contactEmail,
|
||||||
@@ -1314,7 +1315,7 @@ export class BookingsService {
|
|||||||
combinedBaseFareMinor: combinedBase,
|
combinedBaseFareMinor: combinedBase,
|
||||||
discountMinor, loyaltyRedemptionMinor: loyaltyMinor,
|
discountMinor, loyaltyRedemptionMinor: loyaltyMinor,
|
||||||
taxesFeesMinor: taxesMinor, totalMinor,
|
taxesFeesMinor: taxesMinor, totalMinor,
|
||||||
currency: 'ETB', displayCurrency, displayTotalMinor,
|
currency: displayCurrency, displayTotalMinor,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1513,7 +1514,7 @@ export class BookingsService {
|
|||||||
combinedBaseFareMinor: combinedBase,
|
combinedBaseFareMinor: combinedBase,
|
||||||
discountMinor, loyaltyRedemptionMinor: loyaltyMinor,
|
discountMinor, loyaltyRedemptionMinor: loyaltyMinor,
|
||||||
taxesFeesMinor: taxesMinor, totalMinor,
|
taxesFeesMinor: taxesMinor, totalMinor,
|
||||||
currency: 'ETB', displayCurrency, displayTotalMinor,
|
currency: displayCurrency, displayTotalMinor,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1810,7 +1811,7 @@ export class BookingsService {
|
|||||||
bookingRef: pkgBooking.bookingRef,
|
bookingRef: pkgBooking.bookingRef,
|
||||||
status: pkgBooking.status,
|
status: pkgBooking.status,
|
||||||
totalMinor: pkgBooking.totalMinor,
|
totalMinor: pkgBooking.totalMinor,
|
||||||
currency: pkgBooking.currency || 'ETB',
|
currency: pkgBooking.currency || pkgBooking.displayCurrency,
|
||||||
adultCount: pkgBooking.passengerCount,
|
adultCount: pkgBooking.passengerCount,
|
||||||
childCount: 0,
|
childCount: 0,
|
||||||
displayCurrency: pkgBooking.displayCurrency,
|
displayCurrency: pkgBooking.displayCurrency,
|
||||||
@@ -1870,7 +1871,8 @@ export class BookingsService {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
id: booking.id, bookingRef: booking.bookingRef, status: booking.status,
|
id: booking.id, bookingRef: booking.bookingRef, status: booking.status,
|
||||||
totalMinor: resolvePackageRoundTripTotal(booking, (booking as any).priceTier?.priceMinor, booking.adultCount, booking.childCount), currency: 'ETB',
|
totalMinor: resolvePackageRoundTripTotal(booking, (booking as any).priceTier?.priceMinor, booking.adultCount, booking.childCount),
|
||||||
|
currency: booking.displayCurrency,
|
||||||
adultCount: booking.adultCount, childCount: booking.childCount,
|
adultCount: booking.adultCount, childCount: booking.childCount,
|
||||||
displayCurrency: booking.displayCurrency, displayTotalMinor: booking.displayTotalMinor ?? undefined,
|
displayCurrency: booking.displayCurrency, displayTotalMinor: booking.displayTotalMinor ?? undefined,
|
||||||
bookingType: booking.bookingType,
|
bookingType: booking.bookingType,
|
||||||
@@ -1973,7 +1975,7 @@ export class BookingsService {
|
|||||||
await this.prisma.booking.update({ where: { bookingRef }, data: { status: 'CANCELLED' } });
|
await this.prisma.booking.update({ where: { bookingRef }, data: { status: 'CANCELLED' } });
|
||||||
this.eventEmitter.emit('booking.cancelled', { booking, refundAmount });
|
this.eventEmitter.emit('booking.cancelled', { booking, refundAmount });
|
||||||
await this.auditService.log({ userId: iamUserId ?? booking.passengerId, action: 'DELETE', entityType: 'Booking', entityId: booking.id, oldData: { bookingRef, status: booking.status }, newData: { status: 'CANCELLED', reason, refundAmount } });
|
await this.auditService.log({ userId: iamUserId ?? booking.passengerId, action: 'DELETE', entityType: 'Booking', entityId: booking.id, oldData: { bookingRef, status: booking.status }, newData: { status: 'CANCELLED', reason, refundAmount } });
|
||||||
return { cancelled: true, refundAmount: refundAmount / 100, currency: 'ETB' };
|
return { cancelled: true, refundAmount: refundAmount / 100, currency: booking.displayCurrency};
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, dto: any) {
|
async update(id: string, dto: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user