ModulusChecking.Steps.Calculators.DoubleAlternateCalculatorExceptionFive.Process C# (CSharp) Method

Process() public method

/Perform the second double alternate check, and for the double alternate check with exception 5 the checkdigit is h from the original account number, except: • After dividing the result by 10; - if the remainder=0 and h=0 the account number is valid - for all other remainders, take the remainder away from 10. If the number you get is the same as h then the account number is valid.
public Process ( BankAccountDetails bankAccountDetails ) : bool
bankAccountDetails ModulusChecking.Models.BankAccountDetails
return bool
        public override bool Process(BankAccountDetails bankAccountDetails)
        {
            var remainder = GetWeightSumForStep(bankAccountDetails) % Modulus;
            switch (remainder)
            {
                case 0:
                    return bankAccountDetails.AccountNumber.IntegerAt(7) == 0;
                default:
                    return (Modulus - remainder) == bankAccountDetails.AccountNumber.IntegerAt(7);
            }
        }
    }

Usage Example

Esempio n. 1
0
 public override bool Process(BankAccountDetails bankAccountDetails)
 {
     return(GetMappingException(bankAccountDetails.WeightMappings) == 5
                ? DoubleAlternateCalculatorExceptionFive.Process(bankAccountDetails)
                : (GetWeightSumForStep(bankAccountDetails) % Modulus) == 0);
 }
DoubleAlternateCalculatorExceptionFive