} // ParseIssueIdentifier() /// <summary> /// This function parses the enumerated issuer type from the string /// credit card number. /// </summary> /// <param name="strAccountNumber"> /// The input fully-qualified credit card number. /// </param> /// <returns> /// The substring representation of the issuer identifier. /// </returns> internal static IssuerType ParsIssuerType(string strAccountNumber) { IssuerType eit = IssuerType.Unknown; foreach (CCNumberParser pars in m_apars) { if (pars.Parse(strAccountNumber.Length, CreditCardNumber.ParseIssueIdentifier(strAccountNumber))) { eit = pars.IssuerType; // Assumption: mutually exclusive types break; } // if( Parser.Parse() } // foreach( CCNumberParser pars in m_apars ) return(eit); } // ParsIssuerType()
} // ValidateUsingLuhnMethod() /// <summary> /// This internal function throws an null parameter exception as part /// of the validation routine. /// </summary> /// <param name="strAccountNumber"> /// The input fully-qualified credit card number. /// </param> /// <returns> /// This function returns true if the input passed the validation /// check. Otherwise, false. /// </returns> internal static bool __ValidateAccountNumber(string strAccountNumber) { bool blnReturn = false; if (null == strAccountNumber) { throw new ArgumentNullException( kstrParameterName, kstrExceptionMessageNull); } // if( null == strAccountNumber ) // Parse the issuer and test against unknown and // validate with Luhn method if ((IssuerType.Unknown != ParsIssuerType(strAccountNumber)) && (CreditCardNumber.ValidateUsingLuhnMethod(strAccountNumber))) { blnReturn = true; } return(blnReturn); } // __ValidateAccountNumber()