@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
75 lines • 3.12 kB
TypeScript
import { type TaxEngineRequest, type TaxEngineData } from '../schemas';
import type { PricingClient } from '../client';
import type { BaseResponse } from '../../../core/base-client';
type ExecuteRequest = PricingClient['executeRequest'];
/**
* Creates the taxEngine resource methods
* OpenAPI Path: /tax-engine → taxEngine.*
* @description Tax calculations and jurisdiction-based tax determination
*/
export declare function createTaxEngineResource(executeRequest: ExecuteRequest): {
/**
* Create tax calculation using the tax engine
* @description Tax calculation endpoint with postal code-based rate lookups and jurisdiction breakdowns
* @fullPath api.pricing.taxEngine.create
* @service pricing
* @domain tax-calculation
* @dataMethod taxEngineData.create
* @discoverable true
* @searchTerms ["tax engine", "tax calculation", "tax computation", "create tax"]
* @relatedEndpoints ["api.pricing.priceEngine.get"]
* @commonPatterns ["calculate tax", "run tax engine", "tax computation"]
* @param request Tax calculation request with customer, items, and shipping address information
* @returns Detailed tax calculation with total tax, rates, and jurisdiction-specific breakdowns
* @throws ValidationError When request is invalid or response is malformed
* @example
* ```typescript
* const tax = await client.taxEngine.create({
* customer_id: 12345,
* postal_code: '12345',
* items: [
* {
* item_id: 'ABC123',
* quantity: 2,
* unit_price: 25.99,
* extended_amount: 51.98
* }
* ],
* ship_to_address: {
* street: '123 Main St',
* city: 'Anytown',
* state: 'NY',
* postal_code: '12345'
* }
* });
*
* console.log('Total Tax:', tax.total_tax);
* console.log('Tax Rate:', tax.tax_rate);
* tax.jurisdictions.forEach(j => {
* console.log(`${j.jurisdiction_name}: ${j.tax_rate}% = $${j.tax_amount}`);
* });
* ```
*/
create: (request: TaxEngineRequest) => Promise<BaseResponse<TaxEngineData>>;
};
/**
* Creates the taxEngineData resource methods (data-only versions)
*/
export declare function createTaxEngineDataResource(taxEngine: ReturnType<typeof createTaxEngineResource>): {
/**
* Create tax calculation data without response metadata
* @fullPath api.pricing.taxEngineData.create
* @service pricing
* @domain tax-calculation
* @discoverable true
* @searchTerms ["tax engine data", "create tax data", "tax calculation data"]
* @relatedEndpoints ["api.pricing.taxEngine.create"]
* @commonPatterns ["create tax data", "tax calculation data"]
* @returns Promise<TaxEngineData> Tax calculation data directly
*/
create: (request: TaxEngineRequest) => Promise<TaxEngineData>;
};
export type TaxEngineResource = ReturnType<typeof createTaxEngineResource>;
export type TaxEngineDataResource = ReturnType<typeof createTaxEngineDataResource>;
export {};
//# sourceMappingURL=tax-engine.d.ts.map