createFaceLivenessSession function
Crea una nueva sesión de Face Liveness. Selecciona la implementación según el integrationType de la configuración.
Implementation
Future<ApacuanaSuccess<CreateFaceLivenessSessionResponse>>
createFaceLivenessSession() {
final cfg = getConfig();
// Soporta tanto comparación por string como por enum si se usa en el futuro.
final typeStr = cfg.integrationType;
final typeEnum = IntegrationType.fromValue(typeStr);
if (typeEnum == IntegrationType.onboarding ||
typeStr == INTEGRATION_TYPE['ONBOARDING']) {
return _createFaceLivenessSessionOnBoarding();
}
if (typeEnum == IntegrationType.onPremise ||
typeStr == INTEGRATION_TYPE['ONPREMISE']) {
return _createFaceLivenessSessionOnPremise();
}
throw ApacuanaAPIError(
'Unsupported integration type: $typeStr',
statusCode: 400,
errorCode: 'UNSUPPORTED_INTEGRATION_TYPE',
);
}