2023-04-25 22:39:47 +00:00
|
|
|
import { z } from "zod";
|
|
|
|
|
2023-05-13 04:11:12 +00:00
|
|
|
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",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2023-04-25 22:39:47 +00:00
|
|
|
|
|
|
|
export type TStripeCheckoutSessionInputSchema = z.infer<typeof ZStripeCheckoutSessionInputSchema>;
|