UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

55 lines 3.47 kB
import { z } from 'zod'; import { BaseResponseSchema, BaseGetParamsSchema } from '../../../core/schemas'; // Checkout schemas - key fields only, passthrough for API flexibility /** Order header - passthrough for multi-format field names */ export const OrderHeaderSchema = z.object({}).passthrough(); /** Checkout customer - key field only */ export const CheckoutCustomerSchema = z.object({ customerId: z.number() }).passthrough(); /** Order line - key field only */ export const OrderLineSchema = z.object({ lineNo: z.number().optional() }).passthrough(); /** Payment - passthrough for multi-format field names */ export const PaymentSchema = z.object({}).passthrough(); /** Notes - passthrough */ export const NotesSchema = z.object({}).passthrough(); /** Web info - passthrough */ export const WebInfoSchema = z.object({}).passthrough(); /** Legacy payment - passthrough */ export const CheckoutPaymentSchema = z.object({}).passthrough(); /** Legacy shipping - passthrough */ export const CheckoutShippingSchema = z.object({}).passthrough(); /** Line item - key field only */ export const CheckoutLineItemSchema = z.object({ invMastUid: z.number() }).passthrough(); /** Checkout create request - passthrough for flexible input */ export const CheckoutCreateRequestSchema = z.object({}).passthrough(); export const CheckoutCreateParamsSchema = z.object({ cartHdrUid: z.coerce.number().optional(), }); /** Checkout - key field only */ export const CheckoutSchema = z.object({ checkoutUid: z.number() }).passthrough(); /** Checkout create data - key field only */ export const CheckoutCreateDataSchema = z.object({ checkoutUid: z.number() }).passthrough(); export const CheckoutCreateResponseSchema = BaseResponseSchema(CheckoutCreateDataSchema); export const CheckoutGetResponseSchema = BaseResponseSchema(CheckoutSchema); export const CheckoutDocParamsSchema = BaseGetParamsSchema.extend({ cartHdrUid: z.coerce.number().optional(), }); /** Checkout validate data - key field only */ export const CheckoutValidateDataSchema = z.object({ checkoutUid: z.number() }).passthrough(); export const CheckoutValidateResponseSchema = BaseResponseSchema(CheckoutValidateDataSchema); /** Checkout activate data - key field only */ export const CheckoutActivateDataSchema = z.object({ checkoutUid: z.number() }).passthrough(); export const CheckoutActivateResponseSchema = BaseResponseSchema(CheckoutActivateDataSchema); /** Checkout doc data - key field only */ export const CheckoutDocDataSchema = z.object({ checkoutUid: z.number() }).passthrough(); export const CheckoutDocResponseSchema = BaseResponseSchema(CheckoutDocDataSchema); /** P21 header create request - passthrough */ export const CheckoutProphet21HdrCreateRequestSchema = z.object({}).passthrough(); /** P21 header data - key field only */ export const CheckoutProphet21HdrDataSchema = z.object({ checkoutUid: z.number() }).passthrough(); export const CheckoutProphet21HdrResponseSchema = BaseResponseSchema(CheckoutProphet21HdrDataSchema); /** P21 line add request - minimal validation for required fields */ export const CheckoutProphet21LineAddRequestSchema = z.array(z.object({ invMastUid: z.number() }).passthrough()); /** P21 line item - key field only */ export const CheckoutProphet21LineItemSchema = z.object({ lineNo: z.number() }).passthrough(); export const CheckoutProphet21LineResponseSchema = BaseResponseSchema(z.array(CheckoutProphet21LineItemSchema)); //# sourceMappingURL=checkout.js.map