UNPKG

@paykit-sdk/core

Version:

The Payment Toolkit for Typescript

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