@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
63 lines • 2.51 kB
JavaScript
import { z } from 'zod';
import { BaseGetParamsSchema, BaseResponseSchema } from '../../../core/schemas';
// Invoice line item schema - based on Invoices.json
export const InvoiceLineItemSchema = z.object({
lineNo: z.number(),
invMastUid: z.number().nullable(),
itemId: z.string().nullable(),
itemDesc: z.string(),
unitOfMeasure: z.string().nullable(),
unitPrice: z.number(),
extendedPrice: z.number(),
qtyRequested: z.number(),
qtyShipped: z.number(),
oderNo: z.string().nullable(), // Note: typo in original API
oeLineNumber: z.number().nullable(),
});
// Invoice document schema - based on Invoices.json
export const InvoiceDocumentSchema = z.object({
invoiceNo: z.string(),
customerId: z.coerce.number(),
customerName: z.string(),
orderNo: z.string().nullable(),
invoiceDate: z.string(), // Y-m-d format
poNo: z.string().nullable(),
ship2Name: z.string().nullable(),
ship2Contact: z.string().nullable(),
ship2Address1: z.string().nullable(),
ship2Address2: z.string().nullable(),
ship2Address3: z.string().nullable(),
ship2City: z.string().nullable(),
ship2State: z.string().nullable(),
ship2PostalCode: z.string().nullable(),
ship2Country: z.string().nullable(),
ship2EmailAddress: z.string().nullable(),
shipToPhone: z.string().nullable(),
bill2Name: z.string().nullable(),
bill2Contact: z.string().nullable(),
bill2Address1: z.string().nullable(),
bill2Address2: z.string().nullable(),
bill2Address3: z.string().nullable(),
bill2City: z.string().nullable(),
bill2State: z.string().nullable(),
bill2PostalCode: z.string().nullable(),
bill2Country: z.string().nullable(),
totalAmount: z.number(),
amountPaid: z.number(),
paidInFullFlag: z.string().nullable(),
taxAmount: z.number(),
taxAmountPaid: z.number(),
shippingCost: z.number().nullable(),
datePaid: z.string().nullable(), // Y-m-d format
lines: z.array(InvoiceLineItemSchema),
});
export const InvoiceListParamsSchema = BaseGetParamsSchema.extend({
q: z.string(),
shipToId: z.coerce.number().optional(),
limit: z.coerce.number().optional(),
offset: z.coerce.number().optional(),
});
// Response schemas using BaseResponseSchema (8-field format)
export const InvoiceListResponseSchema = BaseResponseSchema(z.array(InvoiceDocumentSchema));
export const InvoiceResponseSchema = BaseResponseSchema(InvoiceDocumentSchema);
//# sourceMappingURL=invoices.js.map