UNPKG

@paykit-sdk/core

Version:

The Payment Toolkit for Typescript

34 lines (29 loc) 965 B
import { z } from 'zod'; // src/resources/billing.ts z.record(z.string(), z.string()); // src/tools/utils.ts var schema = () => { return (schema2) => schema2; }; // src/resources/billing.ts var billingAddressSchema = schema()( z.object({ name: z.string().min(1, "Recipient name is required"), line1: z.string().min(1, "Address line 1 is required"), line2: z.string().default("").optional(), city: z.string().min(1, "City is required"), state: z.string().optional(), // Optional because not all countries use states postal_code: z.string().min(1, "Postal code is required"), country: z.string().length(2, "Country must be a 2-letter ISO code").toUpperCase(), phone: z.string().optional() }) ); var billingSchema = schema()( z.object({ address: billingAddressSchema, carrier: z.string().optional(), currency: z.string().min(1, "Currency is required") }) ); export { billingAddressSchema, billingSchema };