コード例 #1
0
// Tell if the bank account is valid
func (e Exception1Checker) IsValid(b m.BankAccount, sc m.SortCodeData, attempt int) bool {
	if !e.Handles(b, sc, attempt) {
		panic("Should be exception of type 1")
	}

	return algorithms.DoubleAlternate(b, sc, 27) == 0
}
コード例 #2
0
// Get the remainder of the check
func (e GeneralChecker) RemainderFromRegularCheck(b m.BankAccount, scData m.SortCodeData) int {
	switch {
	case scData.Algorithm == "DBLAL":
		return algorithms.DoubleAlternate(b, scData, 0)
	case scData.Algorithm == "MOD11":
		return algorithms.Modulus(b, 11, scData)
	case scData.Algorithm == "MOD10":
		return algorithms.Modulus(b, 10, scData)
	}

	panic("Should have algo")
}