go-credit-card
go-credit-card copied to clipboard
Libreria does not recognize the following BIN: 67999989
Library does not recognize the following BIN 67999989, at the moment the error is obtained: Unknown credit card method
func isMaestro(c *Card, ccDigits digits) bool {
return matchesValue(ccDigits.At(4), []int{5018, 5020, 5038, 5612, 5893, 6304, 6759, 6761, 6762, 6763, 6390}) ||
c.Number[:3] == "0604"
}
This example uses the card validator library from npm. And as we can see the card number 6799998900000200010 gets maestro as the card brand.
'use strict'
const valid = require("card-validator")
const numberValidation = valid.number("6799998900000200010")
if (!numberValidation.isPotentiallyValid) {
console.error("error")
}
if (numberValidation.card) {
console.log(numberValidation.card.type) // 'maestro'
}
card-validator uses credit-card-type to validate the card brands. And as we can see in src/lib/card-types.ts line 104
maestro: {
niceType: "Maestro",
type: "maestro",
patterns: [
493698,
[500000, 504174],
[504176, 506698],
[506779, 508999],
[56, 59],
63,
67,
6,
],
gaps: [4, 8, 12],
lengths: [12, 13, 14, 15, 16, 17, 18, 19],
code: {
name: "CVC",
size: 3,
},
} as BuiltInCreditCardType,
Maestro uses more numbers as a pattern to check the brand.
patterns: [
493698,
[500000, 504174],
[504176, 506698],
[506779, 508999],
[56, 59],
63,
67,
6,
],
When in Go we only use these
5018, 5020, 5038, 5612, 5893, 6304, 6759, 6761, 6762, 6763, 6390 and 0604