// Perform the check for a bank account and a given attempt. func (r Resolver) checkForSortCodeData(b m.BankAccount, scData m.SortCodeData, attempt int) bool { // If the sort code follows an exception if scData.HasException() { // Try to find a checker for this specific exception if checkerFound, hasKey := r.exceptionCheckers[scData.ExceptionValue]; hasKey { // Check that this checker can actually handle this case if checkerFound.Handles(b, scData, attempt) { // Validate the bank account number return checkerFound.IsValid(b, scData, attempt) } } } // General case return checkers.GeneralChecker{}.IsValid(b, scData, attempt) }