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

Add support for Troy #22

Closed
aloisdg opened this issue Oct 7, 2021 · 8 comments · Fixed by #57
Closed

Add support for Troy #22

aloisdg opened this issue Oct 7, 2021 · 8 comments · Fixed by #57
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Hacktoberfest encourages participation in the open source community, which grows bigger every year. hacktoberfest-accepted

Comments

@aloisdg
Copy link
Member

aloisdg commented Oct 7, 2021

Hello,

I would like to identify card from Troy. You can get Troy traits on Wikipedia.

If you want to solve this issue, check this how-to guide.

Cheers,

@aloisdg aloisdg added enhancement New feature or request good first issue Good for newcomers hacktoberfest Hacktoberfest encourages participation in the open source community, which grows bigger every year. hacktoberfest-accepted labels Oct 7, 2021
@hey24sheep
Copy link
Contributor

If I add "Troy" 3 tests fail because of the IINRange is same as other cards. As you can see "65" falls in these other providers.

What to do?

[
  {
    "issuingNetwork": "Discover Card",
    "iinRanges": "6011, 644-649, 65",
    "active": "Yes",
    "length": "16–19",
    "validation": "Luhn algorithm"
  },
  {
    "issuingNetwork": "RuPay",
    "iinRanges": "60, 65, 81, 82, 508",
    "active": "Yes",
    "length": "16",
    "validation": "Luhn algorithm"
  },
  {
    "issuingNetwork": "Troy",
    "iinRanges": "65, 9792",
    "active": "Yes",
    "length": "16",
    "validation": "Luhn algorithm"
  },
  {
    "issuingNetwork": "Verve",
    "iinRanges": "506099–506198, 650002–650027",
    "active": "Yes",
    "length": "16, 19",
    "validation": "Unknown"
  },
]

@torendil
Copy link
Contributor

I believe it really is time to think about changing the output and the tests of cardidy. I'll work on that on friday

@aloisdg
Copy link
Member Author

aloisdg commented Oct 27, 2021

Same IIN Range means it is a co branded card. They should identify as both. The order is quite arbitrary. We tried to move the most specific one above the other. Visa Electron being before Visa is a good example of that.

@torendil
Copy link
Contributor

Yeah, but I think we should give several cards as answers if we manage to meet several valid tests

@aloisdg
Copy link
Member Author

aloisdg commented Oct 27, 2021

@torendil this is what we already do:

[TestCase("6500020000000000", false, ExpectedResult = new[] { CardType.Verve, CardType.Discover, CardType.RuPay })]
[TestCase("6500100000000000", false, ExpectedResult = new[] { CardType.Verve, CardType.Discover, CardType.RuPay })]
[TestCase("6500270000000000", false, ExpectedResult = new[] { CardType.Verve, CardType.Discover, CardType.RuPay })]
[TestCase("65002700000000000", false, ExpectedResult = new[] { CardType.Discover })]
[TestCase("650027000000000000", false, ExpectedResult = new[] { CardType.Discover })]
[TestCase("6500270000000000000", false, ExpectedResult = new[] { CardType.Verve, CardType.Discover })]
public IEnumerable<CardType> ShouldIdentifyAsVerve(string cardNumber, bool useCheck) => Cardidy.Identify(cardNumber, useCheck: useCheck).ToArray();

source

@torendil
Copy link
Contributor

My bad 😅 @hey24sheep you can correct those tests to include Troy, I believe

@aloisdg
Copy link
Member Author

aloisdg commented Oct 28, 2021

No problem. It happens to all of us. 👍

@hey24sheep
Copy link
Contributor

My bad 😅 @hey24sheep you can correct those tests to include Troy, I believe

No worries, I have added a PR for Troy. Have a look, thanks :)

@aloisdg aloisdg linked a pull request Oct 28, 2021 that will close this issue
aloisdg pushed a commit that referenced this issue Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Hacktoberfest encourages participation in the open source community, which grows bigger every year. hacktoberfest-accepted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants