fix: signup (#25334)

* Handle Stripe logic in `paymentCallback`

* Remove endpoint

* Do not send email verification email if premium username

* Remove logic from verify-view

* Callback send verification email

* Add `create` method to `VerificationToken` repository

* Create `VerificationTokenService`

* Early return if payment failed

* Refactor token generation

* Add tests

* Type fixes

* Type fixes
This commit is contained in:
Joe Au-Yeung authored and GitHub committed 2025-11-21 19:51:19 +00:00
1 parent 06348982a3
commit e5ebf7feb4
12 files changed
+714 -104

No files matched your search

@@ -4,13 +4,8 @@ import { ZUserEmailVerificationRequiredSchema } from "./checkIfUserEmailVerifica
import { ZMarkHostAsNoShowInputSchema } from "./markHostAsNoShow.schema";
import { event } from "./procedures/event";
import { ZSamlTenantProductInputSchema } from "./samlTenantProduct.schema";
import { ZStripeCheckoutSessionInputSchema } from "./stripeCheckoutSession.schema";
import { ZSubmitRatingInputSchema } from "./submitRating.schema";
const NAMESPACE = "publicViewer";
const namespaced = (s: string) => `${NAMESPACE}.${s}`;
// things that unauthenticated users can query about themselves
export const publicViewerRouter = router({
countryCode: publicProcedure.query(async (opts) => {
@@ -29,10 +24,6 @@ export const publicViewerRouter = router({
const { default: handler } = await import("./samlTenantProduct.handler");
return handler(opts);
}),
stripeCheckoutSession: publicProcedure.input(ZStripeCheckoutSessionInputSchema).query(async (opts) => {
const { default: handler } = await import("./stripeCheckoutSession.handler");
return handler(opts);
}),
event,
ssoConnections: publicProcedure.query(async () => {
const { default: handler } = await import("./ssoConnections.handler");
@@ -1,16 +0,0 @@
import { StripeService } from "@calcom/features/ee/payments/server/stripe-service";
import { ZStripeCheckoutSessionInputSchema } from "./stripeCheckoutSession.schema";
import type { TStripeCheckoutSessionInputSchema } from "./stripeCheckoutSession.schema";
type StripeCheckoutSessionOptions = {
input: TStripeCheckoutSessionInputSchema;
};
export const stripeCheckoutSessionHandler = async ({ input }: StripeCheckoutSessionOptions) => {
const parsedInput = ZStripeCheckoutSessionInputSchema.parse(input);
return await StripeService.getCheckoutSession(parsedInput);
};
export default stripeCheckoutSessionHandler;
@@ -1,23 +0,0 @@
import { z } from "zod";
export const ZStripeCheckoutSessionInputSchema = z
.object({
stripeCustomerId: z.string().optional(),
checkoutSessionId: z.string().optional(),
})
.superRefine((arg, ctx) => {
if (!arg.checkoutSessionId && !arg.stripeCustomerId) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "Missing checkoutSessionId or stripeCustomerId",
});
}
if (arg.checkoutSessionId && arg.stripeCustomerId) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "Both checkoutSessionId and stripeCustomerId provided",
});
}
});
export type TStripeCheckoutSessionInputSchema = z.infer<typeof ZStripeCheckoutSessionInputSchema>;