fix: send awaiting payment email only to the current seat (#23630)
This commit is contained in:
@@ -358,8 +358,8 @@ export class PaymentService implements IAbstractPaymentService {
|
||||
paymentData: Payment,
|
||||
eventTypeMetadata?: EventTypeMetadata
|
||||
): Promise<void> {
|
||||
const attendeesToEmail = event.attendeeSeatId
|
||||
? event.attendees.filter(attendee => attendee.bookingSeat?.referenceUid === event.attendeeSeatId)
|
||||
const attendeesToEmail = event.attendeeSeatId
|
||||
? event.attendees.filter((attendee) => attendee.bookingSeat?.referenceUid === event.attendeeSeatId)
|
||||
: event.attendees;
|
||||
|
||||
await sendAwaitingPaymentEmailAndSMS(
|
||||
|
||||
@@ -48,8 +48,6 @@ const createNewSeat = async (
|
||||
return { ...attendee, language: { translate: tAttendees, locale: attendeeLanguage ?? "en" } };
|
||||
});
|
||||
|
||||
evt = { ...evt, attendees: [...bookingAttendees, invitee[0]] };
|
||||
|
||||
if (
|
||||
eventType.seatsPerTimeSlot &&
|
||||
eventType.seatsPerTimeSlot <= seatedBooking.attendees.filter((attendee) => !!attendee.bookingSeat).length
|
||||
@@ -76,9 +74,6 @@ const createNewSeat = async (
|
||||
where: {
|
||||
uid: seatedBooking.uid,
|
||||
},
|
||||
include: {
|
||||
attendees: true,
|
||||
},
|
||||
data: {
|
||||
attendees: {
|
||||
create: {
|
||||
@@ -108,8 +103,16 @@ const createNewSeat = async (
|
||||
},
|
||||
});
|
||||
|
||||
evt.attendeeSeatId = attendeeUniqueId;
|
||||
const newBookingSeat = await prisma.bookingSeat.findUnique({
|
||||
where: {
|
||||
referenceUid: attendeeUniqueId,
|
||||
},
|
||||
});
|
||||
|
||||
const attendeeWithSeat = { ...inviteeToAdd, bookingSeat: newBookingSeat ?? null };
|
||||
|
||||
evt = { ...evt, attendees: [...bookingAttendees, attendeeWithSeat] };
|
||||
evt.attendeeSeatId = attendeeUniqueId;
|
||||
const newSeat = seatedBooking.attendees.length !== 0;
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,18 @@ import type { NewBookingEventType } from "../handleNewBooking/getEventTypesFromD
|
||||
import type { OriginalRescheduledBooking } from "../handleNewBooking/originalRescheduledBookingUtils";
|
||||
|
||||
export type BookingSeat = Prisma.BookingSeatGetPayload<{ include: { booking: true; attendee: true } }> | null;
|
||||
export type Invitee = {
|
||||
email: string;
|
||||
name: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
timeZone: string;
|
||||
phoneNumber?: string;
|
||||
language: {
|
||||
translate: TFunction;
|
||||
locale: string;
|
||||
};
|
||||
}[];
|
||||
|
||||
export type NewSeatedBookingObject = {
|
||||
rescheduleUid: string | undefined;
|
||||
|
||||
Reference in New Issue
Block a user