示例#1
0
        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);
            }
        }
示例#2
0
        /// <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);
        }
示例#3
0
        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);
        }
示例#4
0
        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 );
        }
示例#5
0
        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 );
            }
        }