public static boolean isValidVATIN ( @ Nonnull final String sVATIN , final boolean bIfNoValidator ) { ValueEnforcer . notNull ( sVATIN , "VATIN" ) ; if ( sVATIN . length ( ) > 2 ) { final String sCountryCode = sVATIN . substring ( 0 , 2 ) . toUpperCase ( Locale . US ) ; final IToBooleanFunction < String > aValidator = s_aMap . get ( sCountryCode ) ; if ( aValidator != null ) return aValidator . applyAsBoolean ( sVATIN . substring ( 2 ) ) ; } // No validator return bIfNoValidator ; }
Check if the provided VATIN is valid . This method handles VATINs for all countries . This check uses only the checksum algorithm and does not call any webservice etc .