예제 #1
0
        public AccountCheckResult Check(BankDetails bankDetails)
        {
            var modulusparametersFactory = new ModulusParametersFactory(_modulusWeightingTable);
            var modulusChecker           = new StandardModulusCheck(modulusparametersFactory.CreateModulusParameters(bankDetails));

            return(new AccountCheckResult(modulusChecker.IsValid(bankDetails)));
        }
예제 #2
0
        public ModulusParameters CreateModulusParameters(BankDetails bankAccount)
        {
            var modulusWeighting = _modulusWeightingTable.Find(bankAccount);
            ModulusCheckingMethod modulusCheckingMethod;

            if (modulusWeighting == null)
            {
                modulusCheckingMethod = ModulusCheckingMethod.None;
            }
            else
            {
                modulusCheckingMethod = modulusWeighting.CheckingMethod;
            }

            return(new ModulusParameters(modulusCheckingMethod, modulusWeighting));
        }
예제 #3
0
 public ModulusWeightingDetails Find(BankDetails bankDetails)
 {
     return(_modulusWeightings.FirstOrDefault(m => String.Compare(bankDetails.SortCode, m.FromSortCode, StringComparison.Ordinal) >= 0 && String.Compare(bankDetails.SortCode, m.ToSortCode, StringComparison.Ordinal) <= 0));
 }