Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libreria does not recognize the following BIN: 67999989 #13

Open
anthonybastidas49 opened this issue Jul 5, 2022 · 1 comment
Open

Comments

@anthonybastidas49
Copy link

Library does not recognize the following BIN 67999989, at the moment the error is obtained: Unknown credit card method

@4k1k0
Copy link
Contributor

4k1k0 commented Jul 5, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants