import { C as CbteTipoCode, S as SolicitarCaeInput, b as SolicitarCaeResult, a as ConsultarComprobanteResult, D as DummyResult, U as UltimoComprobanteResult, l as DocTipoCode } from './types-YZrnSVLy.js'; /** * `@ar-agents/facturacion/testing` — fixtures + mock WSFE client for tests. * * Mocks the AFIP/ARCA WSFE surface so cookbook recipes, agent loops, and * downstream apps can be tested without a real ARCA cert + WSAA token round- * trip. * * What you get: * * - **`MockWsfeClient`** — public-method-compatible stand-in for `WsfeClient`. * Pass it to `facturacionTools({ wsfe: mock as unknown as WsfeClient })`. * Calls are recorded in `.calls` for assertion. Seed responses with * `seedSolicitarCAE`, `seedUltimoAutorizado`, `seedConsultarComprobante`, * `seedDummy`. * * - **Factories** for the result shapes: * `mockSolicitarCaeApproved`, `mockSolicitarCaeRejected`, * `mockUltimoComprobante`, `mockConsultarComprobante`, * `mockDummyOk`, `mockDummyDown`. * * The `validator.ts` tests don't need this — that module is pure. */ /** * Approved factura — CAE issued, no observaciones, no errors. * * Defaults to a Factura B (1 unit, $100k, 21% IVA) but the caller can override * any field. Useful for happy-path agent-loop tests. */ declare function mockSolicitarCaeApproved(overrides?: Partial): SolicitarCaeResult; /** * Rejected factura — no CAE, with `errors` populated. Default error code 10015 * is "Factura B con receptor que no es Consumidor Final" — a common rejection * the validator catches but tests need to simulate the AFIP-side path too. */ declare function mockSolicitarCaeRejected(args?: { code?: number; msg?: string; ptoVta?: number; cbteTipo?: CbteTipoCode; cbteDesde?: number; }): SolicitarCaeResult; /** Last authorized comprobante — defaults to "no comprobante yet" (cbteNro 0). */ declare function mockUltimoComprobante(ptoVta?: number, cbteTipo?: CbteTipoCode, cbteNro?: number): UltimoComprobanteResult; /** Echo of an authorized comprobante. */ declare function mockConsultarComprobante(args?: { found?: boolean; ptoVta?: number; cbteTipo?: CbteTipoCode; cbteNro?: number; docTipo?: DocTipoCode; docNro?: string; impTotal?: number; impNeto?: number; impIVA?: number; }): ConsultarComprobanteResult; /** AFIP servers all healthy. */ declare function mockDummyOk(): DummyResult; /** AFIP DB server down — simulates planned-maintenance window. */ declare function mockDummyDown(which?: "appServer" | "dbServer" | "authServer"): DummyResult; type CallLogEntry = { method: "dummy"; } | { method: "consultarUltimoAutorizado"; ptoVta: number; cbteTipo: CbteTipoCode; } | { method: "consultarComprobante"; ptoVta: number; cbteTipo: CbteTipoCode; cbteNro: number; } | { method: "solicitarCAE"; input: SolicitarCaeInput; } | { method: "getTiposCbte" | "getTiposDoc" | "getTiposIva" | "getTiposConcepto" | "getTiposMonedas"; } | { method: "getCotizacion"; monId: string; }; /** * Stand-in for `WsfeClient`. Public-method compatible — pass to * `facturacionTools()` with a single cast: * * ```ts * import { MockWsfeClient, mockSolicitarCaeApproved } from "@ar-agents/facturacion/testing"; * import type { WsfeClient } from "@ar-agents/facturacion"; * import { facturacionTools } from "@ar-agents/facturacion"; * * const mock = new MockWsfeClient() * .seedSolicitarCAE(mockSolicitarCaeApproved({ cbteDesde: 42 })); * * const tools = facturacionTools({ wsfe: mock as unknown as WsfeClient }); * ``` */ declare class MockWsfeClient { private solicitarCaeQueue; private ultimoByKey; private consultarByKey; private dummyResult; private cotizacionByMonId; private tiposCbte; private tiposDoc; private tiposIva; private tiposConcepto; private tiposMonedas; /** Append-only call log for assertions. */ readonly calls: CallLogEntry[]; /** Queue a solicitarCAE response. Pops FIFO; falls back to a synthesized approval. */ seedSolicitarCAE(result: SolicitarCaeResult): this; seedSolicitarCAEMany(results: SolicitarCaeResult[]): this; /** Seed the "last authorized" lookup for a (ptoVta, cbteTipo) pair. */ seedUltimoAutorizado(ptoVta: number, cbteTipo: CbteTipoCode, cbteNro: number): this; /** Seed a "consultar comprobante" echo. */ seedConsultarComprobante(ptoVta: number, cbteTipo: CbteTipoCode, cbteNro: number, result: ConsultarComprobanteResult): this; /** Set the dummy() health-check response. Defaults to all-OK. */ seedDummy(result: DummyResult): this; /** Seed a foreign-currency cotización. */ seedCotizacion(monId: string, monCotiz: number): this; /** Provide a custom catalog (defaults to empty array). */ setTiposCbte(items: Array<{ id: number; desc: string; }>): this; setTiposDoc(items: Array<{ id: number; desc: string; }>): this; setTiposIva(items: Array<{ id: number; desc: string; }>): this; setTiposConcepto(items: Array<{ id: number; desc: string; }>): this; setTiposMonedas(items: Array<{ id: string; desc: string; }>): this; /** Clear `.calls` (does NOT clear seeded data). */ reset(): this; /** Clear everything — seeded data + call log. */ clear(): this; dummy(): Promise; consultarUltimoAutorizado(ptoVta: number, cbteTipo: CbteTipoCode): Promise; consultarComprobante(ptoVta: number, cbteTipo: CbteTipoCode, cbteNro: number): Promise; solicitarCAE(input: SolicitarCaeInput): Promise; getTiposCbte(): Promise<{ id: number; desc: string; }[]>; getTiposDoc(): Promise<{ id: number; desc: string; }[]>; getTiposIva(): Promise<{ id: number; desc: string; }[]>; getTiposConcepto(): Promise<{ id: number; desc: string; }[]>; getTiposMonedas(): Promise<{ id: string; desc: string; }[]>; getCotizacion(monId: string): Promise<{ monId: string; monCotiz: number; fchCotiz: string; }>; } export { MockWsfeClient, mockConsultarComprobante, mockDummyDown, mockDummyOk, mockSolicitarCaeApproved, mockSolicitarCaeRejected, mockUltimoComprobante };