feat: support ARCA production environment with dynamic endpoint configuration and environment selection

This commit is contained in:
2026-08-12 09:04:06 -03:00
parent 6e7bf6e835
commit 4ffb6a281f
7 changed files with 82 additions and 18 deletions
@@ -19,8 +19,12 @@ export type ArcaWsfeLastVoucherParams = {
};
export type ArcaWsfeLastVoucherResult = {
environment: "homologation";
environment: "homologation" | "production";
service: "wsfe";
endpoints?: {
wsaaHost?: string;
wsfeHost?: string;
};
pointOfSale: number;
voucherType: 11;
lastVoucherNumber: number;
@@ -4,15 +4,22 @@ import QuestionCard from "../../QuestionCard/QuestionCard";
export type ArcaWsaaTestResult = {
status?: string;
environment?: string;
environment?: "homologation" | "production";
service?: string;
endpoints?: ArcaEndpointMetadata;
expirationTime?: string;
cached?: boolean;
};
type ArcaEndpointMetadata = {
wsaaHost?: string;
wsfeHost?: string;
};
export type ArcaWsfeDiagnosticsResult = {
environment?: string;
environment?: "homologation" | "production";
service?: string;
endpoints?: ArcaEndpointMetadata;
dummy?: {
ok: boolean;
appServer?: string;
@@ -84,6 +91,7 @@ export default function ArcaTestConnectionFlow({ currentStepIndex, loading, diag
<InfoPanel>WSAA está OK. El diagnóstico WSFE no emite comprobantes: solo consulta salud, puntos de venta, tipos de comprobante y último número autorizado.</InfoPanel>
<InfoRow label="Ambiente" value={result?.environment || "homologation"} />
<InfoRow label="Servicio" value={result?.service || "wsfe"} />
{result?.endpoints?.wsaaHost ? <InfoRow label="WSAA host" value={result.endpoints.wsaaHost} /> : null}
<InfoRow label="Vencimiento" value={formatExpiration(result?.expirationTime)} />
<InfoRow label="Token" value={result?.cached ? "Reutilizado desde caché" : "Creado en esta prueba"} />
{diagnosticsLoading && <InfoPanel>Consultando FEDummy, puntos de venta, tipos de comprobante y último comprobante autorizado...</InfoPanel>}
@@ -125,6 +133,7 @@ function WsfeDiagnosticsPanel({ diagnostics }: { diagnostics: ArcaWsfeDiagnostic
return (
<div style={{ display: "flex", flexDirection: "column", gap: "10px" }}>
<InfoRow label="WSFE FEDummy" value={diagnostics.dummy?.ok ? `OK (${[diagnostics.dummy.appServer, diagnostics.dummy.dbServer, diagnostics.dummy.authServer].filter(Boolean).join(" / ") || "sin detalle"})` : `Error: ${diagnostics.dummy?.error || "sin detalle"}`} />
{diagnostics.endpoints?.wsfeHost ? <InfoRow label="WSFE host" value={diagnostics.endpoints.wsfeHost} /> : null}
<InfoRow label="Punto de venta configurado" value={diagnostics.pointsOfSale?.includesConfiguredPointOfSale ? `OK (${diagnostics.pointsOfSale.configuredPointOfSale})` : `No aparece (${diagnostics.pointsOfSale?.configuredPointOfSale || "sin configurar"})`} />
{diagnostics.pointsOfSale?.points?.length ? <InfoRow label="Puntos de venta ARCA" value={diagnostics.pointsOfSale.points.join(", ")} /> : null}
{diagnostics.pointsOfSale?.error ? <StatusMessage error={diagnostics.pointsOfSale.error} /> : null}