File tree Expand file tree Collapse file tree
apps/web/app/(use-page-wrapper)/auth/verify
features/ee/payments/server
trpc/server/routers/publicViewer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ import type { PageProps as _PageProps } from "app/_types";
22import { _generateMetadata } from "app/_utils" ;
33import { z } from "zod" ;
44
5- import { StripeService } from "@calcom/lib/server/service/stripe" ;
6-
75import VerifyPage from "~/auth/verify-view" ;
86
97const querySchema = z . object ( {
@@ -14,18 +12,10 @@ const querySchema = z.object({
1412
1513export const generateMetadata = async ( { params, searchParams } : _PageProps ) => {
1614 const p = { ...( await params ) , ...( await searchParams ) } ;
17- const { sessionId, stripeCustomerId } = querySchema . parse ( p ) ;
18-
19- const data = await StripeService . getCheckoutSession ( {
20- stripeCustomerId,
21- checkoutSessionId : sessionId ,
22- } ) ;
23-
24- const { hasPaymentFailed } = data ;
15+ const { sessionId } = querySchema . parse ( p ) ;
2516
2617 return await _generateMetadata (
27- ( ) =>
28- hasPaymentFailed ? "Your payment failed" : sessionId ? "Payment successful!" : `Verify your email` ,
18+ ( ) => ( sessionId ? "Payment Page" : `Verify your email` ) ,
2919 ( ) => "" ,
3020 undefined ,
3121 undefined ,
Original file line number Diff line number Diff line change 11import stripe from "@calcom/features/ee/payments/server/stripe" ;
2- import {
3- ZStripeCheckoutSessionInputSchema ,
4- type TStripeCheckoutSessionInputSchema ,
5- } from "@calcom/trpc/server/routers/publicViewer/stripeCheckoutSession.schema" ;
2+
3+ type StripeCheckoutSessionInput = {
4+ checkoutSessionId ?: string ;
5+ stripeCustomerId ?: string ;
6+ } ;
67
78export class StripeService {
8- static async getCheckoutSession ( input : TStripeCheckoutSessionInputSchema ) {
9+ static async getCheckoutSession ( input : StripeCheckoutSessionInput ) {
910 const { checkoutSessionId, stripeCustomerId } = input ;
1011
11- // Moved the following data checks to superRefine
12- ZStripeCheckoutSessionInputSchema . parse ( input ) ;
13-
1412 let customerId : string ;
1513 let isPremiumUsername = false ;
1614 let hasPaymentFailed = false ;
Original file line number Diff line number Diff line change 1- import { StripeService } from "@calcom/lib/server/service/ stripe" ;
1+ import { StripeService } from "@calcom/features/ee/payments/server/ stripe-service " ;
22
3+ import { ZStripeCheckoutSessionInputSchema } from "./stripeCheckoutSession.schema" ;
34import type { TStripeCheckoutSessionInputSchema } from "./stripeCheckoutSession.schema" ;
45
56type StripeCheckoutSessionOptions = {
67 input : TStripeCheckoutSessionInputSchema ;
78} ;
89
910export const stripeCheckoutSessionHandler = async ( { input } : StripeCheckoutSessionOptions ) => {
10- return await StripeService . getCheckoutSession ( input ) ;
11+ const parsedInput = ZStripeCheckoutSessionInputSchema . parse ( input ) ;
12+
13+ return await StripeService . getCheckoutSession ( parsedInput ) ;
1114} ;
1215
1316export default stripeCheckoutSessionHandler ;
You can’t perform that action at this time.
0 commit comments