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