30 lines
725 B
TypeScript
30 lines
725 B
TypeScript
import type Stripe from "stripe";
|
|
import { z } from "zod/v4";
|
|
|
|
export const StripeSubscriptionScheduleActionSchema = z.discriminatedUnion(
|
|
"type",
|
|
[
|
|
z.object({
|
|
type: z.literal("create"),
|
|
params: z.custom<Stripe.SubscriptionScheduleUpdateParams>(),
|
|
}),
|
|
z.object({
|
|
type: z.literal("update"),
|
|
stripeSubscriptionScheduleId: z.string(),
|
|
params: z.custom<Stripe.SubscriptionScheduleUpdateParams>(),
|
|
}),
|
|
z.object({
|
|
type: z.literal("release"),
|
|
stripeSubscriptionScheduleId: z.string(),
|
|
}),
|
|
z.object({
|
|
type: z.literal("cancel"),
|
|
stripeSubscriptionScheduleId: z.string(),
|
|
}),
|
|
],
|
|
);
|
|
|
|
export type StripeSubscriptionScheduleAction = z.infer<
|
|
typeof StripeSubscriptionScheduleActionSchema
|
|
>;
|