* [CAL-1517] fix all Typescript warnings * solve conflicts * Update stripeCheckoutSession.handler.ts Parse is a guard, so even though the variable is unused the parse itself is needed. * Update ToolbarPlugin.tsx Don't change dependency tree --------- Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import Stripe from "stripe";
|
|
import { z } from "zod";
|
|
|
|
export type StripePaymentData = Stripe.Response<Stripe.PaymentIntent> & {
|
|
stripe_publishable_key: string;
|
|
stripeAccount: string;
|
|
};
|
|
|
|
export type StripeSetupIntentData = {
|
|
setupIntent: Stripe.Response<Stripe.SetupIntent>;
|
|
paymentIntent?: StripePaymentData;
|
|
};
|
|
|
|
export const stripeOAuthTokenSchema = z.object({
|
|
access_token: z.string().optional(),
|
|
scope: z.string().optional(),
|
|
livemode: z.boolean().optional(),
|
|
token_type: z.literal("bearer").optional(),
|
|
refresh_token: z.string().optional(),
|
|
stripe_user_id: z.string().optional(),
|
|
stripe_publishable_key: z.string().optional(),
|
|
});
|
|
|
|
export const stripeDataSchema = stripeOAuthTokenSchema.extend({
|
|
default_currency: z.string(),
|
|
});
|
|
|
|
export type StripeData = z.infer<typeof stripeDataSchema>;
|
|
|
|
/** Figure out a way to get this from the DB without too much wreckage. */
|
|
const stripePrivateKey = process.env.STRIPE_PRIVATE_KEY || "";
|
|
const stripe = new Stripe(stripePrivateKey, {
|
|
apiVersion: "2020-08-27",
|
|
});
|
|
|
|
export default stripe;
|