* fix: include id information to be consistent with create/reschedule flows * fix: include username as well * function expectBookingCancelledWebhookToHaveBeenFired created * chore: undo yarn.lock --------- Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
2 files changed
+44
-2
No files matched your search
@@ -975,6 +975,44 @@ export function expectBookingRescheduledWebhookToHaveBeenFired({
|
||||
});
|
||||
}
|
||||
|
||||
export function expectBookingCancelledWebhookToHaveBeenFired({
|
||||
booker,
|
||||
location,
|
||||
subscriberUrl,
|
||||
payload,
|
||||
}: {
|
||||
organizer: { email: string; name: string };
|
||||
booker: { email: string; name: string };
|
||||
subscriberUrl: string;
|
||||
location: string;
|
||||
payload?: Record<string, unknown>;
|
||||
}) {
|
||||
expectWebhookToHaveBeenCalledWith(subscriberUrl, {
|
||||
triggerEvent: "BOOKING_CANCELLED",
|
||||
payload: {
|
||||
...payload,
|
||||
metadata: null,
|
||||
responses: {
|
||||
booker: {
|
||||
label: "your_name",
|
||||
value: booker.name,
|
||||
isHidden: false,
|
||||
},
|
||||
email: {
|
||||
label: "email_address",
|
||||
value: booker.email,
|
||||
isHidden: false,
|
||||
},
|
||||
location: {
|
||||
label: "location",
|
||||
value: { optionValue: "", value: location },
|
||||
isHidden: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function expectBookingPaymentIntiatedWebhookToHaveBeenFired({
|
||||
booker,
|
||||
location,
|
||||
|
||||
@@ -200,6 +200,8 @@ async function handler(req: CustomRequest) {
|
||||
id: bookingToDelete.userId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
username:true,
|
||||
name: true,
|
||||
email: true,
|
||||
timeZone: true,
|
||||
@@ -255,6 +257,8 @@ async function handler(req: CustomRequest) {
|
||||
startTime: bookingToDelete?.startTime ? dayjs(bookingToDelete.startTime).format() : "",
|
||||
endTime: bookingToDelete?.endTime ? dayjs(bookingToDelete.endTime).format() : "",
|
||||
organizer: {
|
||||
id: organizer.id,
|
||||
username: organizer.username || undefined,
|
||||
email: bookingToDelete?.userPrimaryEmail ?? organizer.email,
|
||||
name: organizer.name ?? "Nameless",
|
||||
timeZone: organizer.timeZone,
|
||||
@@ -272,8 +276,8 @@ async function handler(req: CustomRequest) {
|
||||
destinationCalendar: bookingToDelete?.destinationCalendar
|
||||
? [bookingToDelete?.destinationCalendar]
|
||||
: bookingToDelete?.user.destinationCalendar
|
||||
? [bookingToDelete?.user.destinationCalendar]
|
||||
: [],
|
||||
? [bookingToDelete?.user.destinationCalendar]
|
||||
: [],
|
||||
cancellationReason: cancellationReason,
|
||||
...(teamMembers && {
|
||||
team: { name: bookingToDelete?.eventType?.team?.name || "Nameless", members: teamMembers, id: teamId! },
|
||||
|
||||
Reference in new issue
Block a user