Fixes paid bookings

# Conflicts:
#	apps/web/ee/components/stripe/Payment.tsx
This commit is contained in:
zomars committed 2022-05-24 19:23:47 -06:00
1 parent db784f8333
commit 9fba3f3767
5 files changed
+8 -4

No files matched your search

@@ -129,6 +129,7 @@ const BookingPage = ({
paymentUid, paymentUid,
date, date,
name: attendees[0].name, name: attendees[0].name,
email: attendees[0].email,
absolute: false, absolute: false,
}) })
); );
+2 -1
View File
@@ -47,7 +47,7 @@ type States =
export default function PaymentComponent(props: Props) { export default function PaymentComponent(props: Props) {
const { t, i18n } = useLocale(); const { t, i18n } = useLocale();
const router = useRouter(); const router = useRouter();
const { name, date } = router.query; const { email, name, date } = router.query;
const [state, setState] = useState<States>({ status: "idle" }); const [state, setState] = useState<States>({ status: "idle" });
const stripe = useStripe(); const stripe = useStripe();
const elements = useElements(); const elements = useElements();
@@ -86,6 +86,7 @@ export default function PaymentComponent(props: Props) {
date, date,
type: props.eventType.id, type: props.eventType.id,
user: props.user.username, user: props.user.username,
email,
name, name,
bookingId: props.bookingId, bookingId: props.bookingId,
}; };
+1
View File
@@ -80,6 +80,7 @@ export async function handlePayment(
link: createPaymentLink({ link: createPaymentLink({
paymentUid: payment.uid, paymentUid: payment.uid,
name: booking.user?.name, name: booking.user?.name,
email: booking.user?.email,
date: booking.startTime.toISOString(), date: booking.startTime.toISOString(),
}), }),
}, },
+1 -1
View File
@@ -705,7 +705,7 @@ const schema = z.object({
recur: z.string().optional(), recur: z.string().optional(),
location: z.string().optional(), location: z.string().optional(),
eventSlug: z.string().default("15min"), eventSlug: z.string().default("15min"),
eventName: z.string(), eventName: z.string().default(""),
bookingId: strToNumber, bookingId: strToNumber,
}); });
+3 -2
View File
@@ -25,12 +25,13 @@ export function createPaymentLink(opts: {
paymentUid: string; paymentUid: string;
name?: Maybe<string>; name?: Maybe<string>;
date?: Maybe<string>; date?: Maybe<string>;
email?: Maybe<string>;
absolute?: boolean; absolute?: boolean;
}): string { }): string {
const { paymentUid, name, date, absolute = true } = opts; const { paymentUid, name, email, date, absolute = true } = opts;
let link = ""; let link = "";
if (absolute) link = process.env.NEXT_PUBLIC_WEBSITE_URL!; if (absolute) link = process.env.NEXT_PUBLIC_WEBSITE_URL!;
const query = stringify({ date, name }); const query = stringify({ date, name, email });
return link + `/payment/${paymentUid}?${query}`; return link + `/payment/${paymentUid}?${query}`;
} }