Closed swift-fs closed 1 month ago
func Test_BankCard(t *testing.T) { gtest.C(t, func(t *gtest.T) { rule := "bank-card" val1 := "6230514630000424470" val2 := "6230514630000424473" // this bocom card valid result is already true and error is nil val3 := "60142870670591508" err1 := g.Validator().Data(val1).Rules(rule).Run(ctx) err2 := g.Validator().Data(val2).Rules(rule).Run(ctx) err3 := g.Validator().Data(val3).Rules(rule).Run(ctx) t.AssertNE(err1, nil) t.Assert(err2, nil) // but no pass t.Assert(err3, nil) }) }
The bank card number of bocom does not fully follow the luhn algorithm and needs to be optimized and adapted.
Currently I have customized the rules to fit older bank card numbers, and this issue can be closed directly.
The bank card number of bocom does not fully follow the luhn algorithm and needs to be optimized and adapted.