@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
121 lines • 4.8 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RatesResponseSchema = exports.TaxCalculationResultSchema = exports.TaxLineSchema = exports.RatesRequestParamsSchema = exports.HealthCheckResponseSchema = void 0;
const zod_1 = require("zod");
const schemas_1 = require("../../core/schemas");
// Health check schemas
exports.HealthCheckResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.string());
// Tax rates request parameters schema
exports.RatesRequestParamsSchema = zod_1.z
.object({
// Common tax calculation parameters
lines: zod_1.z
.array(zod_1.z.object({
amount: zod_1.z.number().min(0),
description: zod_1.z.string().optional(),
taxCode: zod_1.z.string().optional(),
customerUsageType: zod_1.z.string().optional(),
itemCode: zod_1.z.string().optional(),
quantity: zod_1.z.number().min(0).optional(),
discount: zod_1.z.number().min(0).optional(),
}))
.min(1),
addresses: zod_1.z
.object({
shipFrom: zod_1.z
.object({
line1: zod_1.z.string().optional(),
city: zod_1.z.string().optional(),
region: zod_1.z.string().optional(),
country: zod_1.z.string().optional(),
postalCode: zod_1.z.string().optional(),
})
.optional(),
shipTo: zod_1.z.object({
line1: zod_1.z.string().optional(),
city: zod_1.z.string().optional(),
region: zod_1.z.string().optional(),
country: zod_1.z.string().optional(),
postalCode: zod_1.z.string().optional(),
}),
})
.optional(),
date: zod_1.z.string().optional(),
type: zod_1.z
.enum(['SalesOrder', 'SalesInvoice', 'ReturnInvoice', 'InventoryTransferOrder'])
.optional(),
companyCode: zod_1.z.string().optional(),
customerCode: zod_1.z.string().optional(),
businessIdentificationNo: zod_1.z.string().optional(),
commit: zod_1.z.boolean().optional(),
currencyCode: zod_1.z.string().optional(),
})
.passthrough();
// Tax rate calculation response schemas
exports.TaxLineSchema = zod_1.z
.object({
lineNumber: zod_1.z.string().optional(),
taxableAmount: zod_1.z.number().optional(),
tax: zod_1.z.number().optional(),
taxCalculated: zod_1.z.number().optional(),
rate: zod_1.z.number().optional(),
exemptAmount: zod_1.z.number().optional(),
details: zod_1.z
.array(zod_1.z.object({
jurisdictionName: zod_1.z.string().optional(),
rate: zod_1.z.number().optional(),
tax: zod_1.z.number().optional(),
taxableAmount: zod_1.z.number().optional(),
taxType: zod_1.z.string().optional(),
jurisdictionType: zod_1.z.string().optional(),
}))
.optional(),
})
.passthrough();
exports.TaxCalculationResultSchema = zod_1.z
.object({
totalAmount: zod_1.z.number().optional(),
totalExempt: zod_1.z.number().optional(),
totalTaxable: zod_1.z.number().optional(),
totalTax: zod_1.z.number().optional(),
totalTaxCalculated: zod_1.z.number().optional(),
taxDate: zod_1.z.string().optional(),
lines: zod_1.z.array(exports.TaxLineSchema).optional(),
addresses: zod_1.z
.array(zod_1.z.object({
addressType: zod_1.z.string().optional(),
line1: zod_1.z.string().optional(),
city: zod_1.z.string().optional(),
region: zod_1.z.string().optional(),
country: zod_1.z.string().optional(),
postalCode: zod_1.z.string().optional(),
latitude: zod_1.z.number().optional(),
longitude: zod_1.z.number().optional(),
}))
.optional(),
summary: zod_1.z
.array(zod_1.z.object({
country: zod_1.z.string().optional(),
region: zod_1.z.string().optional(),
jurisType: zod_1.z.string().optional(),
jurisCode: zod_1.z.string().optional(),
jurisName: zod_1.z.string().optional(),
taxAuthorityType: zod_1.z.number().optional(),
stateAssignedNo: zod_1.z.string().optional(),
taxType: zod_1.z.string().optional(),
taxName: zod_1.z.string().optional(),
taxGroup: zod_1.z.string().optional(),
rateType: zod_1.z.string().optional(),
taxable: zod_1.z.number().optional(),
rate: zod_1.z.number().optional(),
tax: zod_1.z.number().optional(),
taxCalculated: zod_1.z.number().optional(),
nonTaxable: zod_1.z.number().optional(),
exemption: zod_1.z.number().optional(),
}))
.optional(),
})
.passthrough();
// Response schemas
exports.RatesResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.TaxCalculationResultSchema);
//# sourceMappingURL=schemas.js.map