From 0d1ab6ade94f9540014df80ae8aba78594e1e19b Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue, 8 Aug 2023 16:45:16 +0100 Subject: [PATCH] fix: don't send request reminder for unpaid bookings (#10325) Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> --- apps/web/pages/api/cron/bookingReminder.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/web/pages/api/cron/bookingReminder.ts b/apps/web/pages/api/cron/bookingReminder.ts index 4c99aded04..ab511b5a42 100644 --- a/apps/web/pages/api/cron/bookingReminder.ts +++ b/apps/web/pages/api/cron/bookingReminder.ts @@ -31,6 +31,17 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) }, // Only send reminders if the event hasn't finished endTime: { gte: new Date() }, + OR: [ + // no payment required + { + payment: { none: {} }, + }, + // paid but awaiting approval + { + payment: { some: {} }, + paid: true, + }, + ], }, select: { ...bookingMinimalSelect,