feat: agregar validaciones para el módulo ARCA según el plan de la organización
This commit is contained in:
@@ -206,6 +206,7 @@ export default function StepEngine({ flowId, action, initialCompanyId, initialEm
|
||||
const [wapError, setWapError] = useState<string | null>(null);
|
||||
|
||||
// State for ARCA onboarding flow
|
||||
const [arcaIsBlocked, setArcaIsBlocked] = useState(false);
|
||||
const [arcaCuit, setArcaCuit] = useState("");
|
||||
const [arcaLegalName, setArcaLegalName] = useState("");
|
||||
const [arcaTaxCondition, setArcaTaxCondition] = useState<"MONOTRIBUTO" | "EXENTO">("MONOTRIBUTO");
|
||||
@@ -277,6 +278,7 @@ export default function StepEngine({ flowId, action, initialCompanyId, initialEm
|
||||
};
|
||||
|
||||
const loadOrganizationContext = (org: any) => {
|
||||
setArcaIsBlocked(false);
|
||||
setCreatedCompanyId(org.id || org._id);
|
||||
setSelectedOrganization(org);
|
||||
setOrgName(org.name || "");
|
||||
@@ -499,6 +501,18 @@ export default function StepEngine({ flowId, action, initialCompanyId, initialEm
|
||||
setWapQr(null);
|
||||
setWapError(null);
|
||||
} else if (flowId === "arca-onboarding") {
|
||||
const orgSub = SessionInfo.organizationSubscriptions[org.id || org._id];
|
||||
const planSupportsPayments = orgSub ? orgSub.plan?.payments : false;
|
||||
|
||||
if (!planSupportsPayments) {
|
||||
setArcaIsBlocked(true);
|
||||
setCurrentStepIndex(0);
|
||||
setArcaError(null);
|
||||
setArcaLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
setArcaIsBlocked(false);
|
||||
setCurrentStepIndex(0);
|
||||
setArcaError(null);
|
||||
setArcaLoading(false);
|
||||
@@ -527,6 +541,19 @@ export default function StepEngine({ flowId, action, initialCompanyId, initialEm
|
||||
setArcaStatusLabel(getArcaStatusLabel(credential.status));
|
||||
}).catch(console.error);
|
||||
} else if (flowId === "arca-test-connection") {
|
||||
const orgSub = SessionInfo.organizationSubscriptions[org.id || org._id];
|
||||
const planSupportsPayments = orgSub ? orgSub.plan?.payments : false;
|
||||
|
||||
if (!planSupportsPayments) {
|
||||
setArcaIsBlocked(true);
|
||||
setCurrentStepIndex(0);
|
||||
setArcaError(null);
|
||||
setArcaLoading(false);
|
||||
setArcaTestResult(null);
|
||||
return;
|
||||
}
|
||||
|
||||
setArcaIsBlocked(false);
|
||||
setCurrentStepIndex(0);
|
||||
setArcaError(null);
|
||||
setArcaLoading(false);
|
||||
@@ -2415,8 +2442,42 @@ export default function StepEngine({ flowId, action, initialCompanyId, initialEm
|
||||
if (flowId === "public-link") return renderPublicLinkFlow();
|
||||
if (flowId === "notifications") return renderNotificationsFlow();
|
||||
if (flowId === "whatsapp-bot") return renderWhatsAppBotFlow();
|
||||
if (flowId === "arca-onboarding") return renderArcaOnboardingFlow();
|
||||
if (flowId === "arca-test-connection") return renderArcaTestConnectionFlow();
|
||||
if (flowId === "arca-onboarding") {
|
||||
if (arcaIsBlocked) {
|
||||
return (
|
||||
<QuestionCard
|
||||
isActive
|
||||
title="Módulo ARCA no disponible"
|
||||
description="Este flujo requiere un plan con el módulo de pagos habilitado para emitir Factura C."
|
||||
onNext={() => router.push("/landing/pricing")}
|
||||
nextLabel="Ver planes"
|
||||
>
|
||||
<div style={{ color: "rgba(255,255,255,0.75)", textAlign: "center", lineHeight: 1.6 }}>
|
||||
La organización seleccionada necesita un plan con el módulo de pagos activo para usar ARCA. Actualizá tu plan o volvé al asistente y elegí otra opción.
|
||||
</div>
|
||||
</QuestionCard>
|
||||
);
|
||||
}
|
||||
return renderArcaOnboardingFlow();
|
||||
}
|
||||
if (flowId === "arca-test-connection") {
|
||||
if (arcaIsBlocked) {
|
||||
return (
|
||||
<QuestionCard
|
||||
isActive
|
||||
title="Test de conexión ARCA no disponible"
|
||||
description="Este flujo requiere un plan con el módulo de pagos habilitado para probar la conexión con ARCA."
|
||||
onNext={() => router.push("/landing/pricing")}
|
||||
nextLabel="Ver planes"
|
||||
>
|
||||
<div style={{ color: "rgba(255,255,255,0.75)", textAlign: "center", lineHeight: 1.6 }}>
|
||||
La organización seleccionada necesita un plan con el módulo de pagos activo para usar ARCA. Actualizá tu plan o volvé al asistente y elegí otra opción.
|
||||
</div>
|
||||
</QuestionCard>
|
||||
);
|
||||
}
|
||||
return renderArcaTestConnectionFlow();
|
||||
}
|
||||
if (flowId === "disable-schedule") return renderDisableScheduleFlow();
|
||||
if (flowId === "open-reservation-periods") return renderReservationPeriodFlow();
|
||||
if (flowId === "override-schedule") return renderOverrideScheduleFlow();
|
||||
|
||||
Reference in New Issue
Block a user