private static void validateBbanLength(string iban, BBanStructure structure) { int expectedBbanLength = structure.GetBBanLength(); string bban = GetBBan(iban); int bbanLength = bban.Length; if (expectedBbanLength != bbanLength) { throw new IbanFormatException($"BBAN '{bban}' length is {bbanLength}, expected is {expectedBbanLength}", IbanFormatViolation.BBAN_LENGTH, bbanLength, expectedBbanLength); } }
/// <summary> /// Returns IBAN length for the specified country /// </summary> /// <param name="countryCode">Country code object</param> /// <returns>The length of IBAN for the specified country</returns> public static int GetIbanLength(CountryCodeEntry countryCode) { int result = 0; BBanStructure structure = getBbanStructure(countryCode); if (structure != null) { result = _COUNTRY_CODE_LENGTH + _CHECK_DIGIT_LENGTH + structure.GetBBanLength(); } return(result); }
private static bool hasValidBbanLength(string iban, BBanStructure structure, out IbanFormatViolation validationResult) { validationResult = IbanFormatViolation.NO_VIOLATION; int expectedBbanLength = structure.GetBBanLength(); string bban = GetBBan(iban); int bbanLength = bban.Length; if (expectedBbanLength != bbanLength) { validationResult = IbanFormatViolation.BBAN_LENGTH; } return(validationResult == IbanFormatViolation.NO_VIOLATION); }
private static bool hasValidBbanLength(string iban, BBanStructure structure, out IbanFormatViolation validationResult) { validationResult = IbanFormatViolation.NO_VIOLATION; int expectedBbanLength = structure.GetBBanLength(); string bban = GetBBan( iban ); int bbanLength = bban.Length; if (expectedBbanLength != bbanLength) { validationResult = IbanFormatViolation.BBAN_LENGTH; } return ( validationResult == IbanFormatViolation.NO_VIOLATION ); }
private static void validateBbanLength(string iban, BBanStructure structure) { int expectedBbanLength = structure.GetBBanLength(); string bban = GetBBan( iban ); int bbanLength = bban.Length; if (expectedBbanLength != bbanLength) { throw new IbanFormatException( $"BBAN '{bban}' length is {bbanLength}, expected is {expectedBbanLength}", IbanFormatViolation.BBAN_LENGTH, bbanLength, expectedBbanLength ); } }