File tree 3 files changed +40
-4
lines changed
3 files changed +40
-4
lines changed Original file line number Diff line number Diff line change 910
910
"add_exchange2013" : " Connect Exchange 2013 Server" ,
911
911
"add_exchange2016" : " Connect Exchange 2016 Server" ,
912
912
"specific_issue" : " Have a specific issue" ,
913
- "browse_our_docs" : " browse our docs"
913
+ "browse_our_docs" : " browse our docs" ,
914
+ "attendee_name" : " Attendee's name"
914
915
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import getAppKeysFromSlug from "@calcom/app-store/_utils/getAppKeysFromSlug";
6
6
import { _DestinationCalendarModel , _EventTypeCustomInputModel , _EventTypeModel } from "@calcom/prisma/zod" ;
7
7
import { stringOrNumber } from "@calcom/prisma/zod-utils" ;
8
8
import { createEventTypeInput } from "@calcom/prisma/zod/custom/eventtype" ;
9
+ import { stripeDataSchema } from "@calcom/stripe/server" ;
9
10
10
11
import { createProtectedRouter } from "@server/createRouter" ;
11
12
import { viewerRouter } from "@server/routers/viewer" ;
@@ -265,6 +266,7 @@ export const eventTypesRouter = createProtectedRouter()
265
266
users,
266
267
id,
267
268
hashedLink,
269
+ price,
268
270
...rest
269
271
} = input ;
270
272
assertValidUrl ( input . successRedirectUrl ) ;
@@ -314,6 +316,26 @@ export const eventTypesRouter = createProtectedRouter()
314
316
} ;
315
317
}
316
318
319
+ if ( price ) {
320
+ const paymentCredential = await ctx . prisma . credential . findFirst ( {
321
+ where : {
322
+ userId : ctx . user . id ,
323
+ type : {
324
+ contains : "_payment" ,
325
+ } ,
326
+ } ,
327
+ select : {
328
+ type : true ,
329
+ key : true ,
330
+ } ,
331
+ } ) ;
332
+
333
+ if ( paymentCredential ?. type === "stripe_payment" ) {
334
+ const { default_currency } = stripeDataSchema . parse ( paymentCredential . key ) ;
335
+ data . currency = default_currency ;
336
+ }
337
+ }
338
+
317
339
const connectedLink = await ctx . prisma . hashedLink . findFirst ( {
318
340
where : {
319
341
eventTypeId : input . id ,
Original file line number Diff line number Diff line change 1
1
import Stripe from "stripe" ;
2
+ import { z } from "zod" ;
2
3
3
4
export type PaymentData = Stripe . Response < Stripe . PaymentIntent > & {
4
5
stripe_publishable_key : string ;
5
6
stripeAccount : string ;
6
7
} ;
7
8
8
- export type StripeData = Stripe . OAuthToken & {
9
- default_currency : string ;
10
- } ;
9
+ export const stripeOAuthTokenSchema = z . object ( {
10
+ access_token : z . string ( ) . optional ( ) ,
11
+ scope : z . string ( ) . optional ( ) ,
12
+ livemode : z . boolean ( ) . optional ( ) ,
13
+ token_type : z . literal ( "bearer" ) . optional ( ) ,
14
+ refresh_token : z . string ( ) . optional ( ) ,
15
+ stripe_user_id : z . string ( ) . optional ( ) ,
16
+ stripe_publishable_key : z . string ( ) . optional ( ) ,
17
+ } ) ;
18
+
19
+ export const stripeDataSchema = stripeOAuthTokenSchema . extend ( {
20
+ default_currency : z . string ( ) ,
21
+ } ) ;
22
+
23
+ export type StripeData = z . infer < typeof stripeDataSchema > ;
11
24
12
25
const stripePrivateKey = process . env . STRIPE_PRIVATE_KEY ! ;
13
26
You can’t perform that action at this time.
0 commit comments