isPossiblyValidRuc static method
Validates if an Ecuadorian RUC number is valid for only length and province code.
ruc
The RUC number to validate.
Returns an IdentificationResult with the validation result.
Implementation
static IdentificationResult isPossiblyValidRuc(String ruc) {
try {
initValidate(ruc, TypeIdentification.rucPersonNatural);
validateCodeProvince(ruc.substring(0, 2));
return IdentificationResult(
isValid: true,
errorMessage: null,
typeCodeError: null,
);
} catch (e) {
if (e is IdentificationException) {
return IdentificationResult(
isValid: false,
errorMessage: e.message,
typeCodeError: e.code,
);
}
return IdentificationResult(
isValid: false,
errorMessage: 'Invalid ruc identification',
typeCodeError: ErrorCode.invalidIdentification,
);
}
}