d-edge / Cardidy

A .net library to identify credit card number and cvv
MIT License
30 stars 12 forks source link

feat(switch): add support for Switch #97

Closed ntbm closed 1 year ago

ntbm commented 1 year ago

Closes #21

aloisdg commented 1 year ago

The tests are failing. Could you fix them?

A total of 1 test files matched the specified pattern.
  Failed ShouldIdentifyAsMaestros("6759710000901011") [66 ms]
  Error Message:
     Expected is <DEdge.CardType[3]>, actual is <System.Linq.Enumerable+WhereSelectArrayIterator`2[DEdge.Model.ICard,DEdge.CardType]>
  Values differ at index [2]
  Expected: GPN
  But was:  Switch

source: https://github.com/d-edge/Cardidy/actions/runs/3164565462/jobs/5156547997#step:6:1

Switch's 6759 is shared with Maestro and Maestro UK. Edit

[TestCase("6759710000901011", ExpectedResult = new[] { CardType.MaestroUk, CardType.Maestro, CardType.GPN })]
[TestCase("6759710000901086", ExpectedResult = new[] { CardType.MaestroUk, CardType.Maestro, CardType.GPN })]

to be

[TestCase("6759710000901011", ExpectedResult = new[] { CardType.MaestroUk, CardType.Maestro, CardType.Switch, CardType.GPN })]
[TestCase("6759710000901086", ExpectedResult = new[] { CardType.MaestroUk, CardType.Maestro, CardType.Switch, CardType.GPN })]

source: https://github.com/d-edge/Cardidy/blob/81cd3f6929b3f61a0656960eb3b574bf1eb07c2d/src/Tests/IdentifyTests.cs#L93

Payment card are weird sometimes. Thanks for your work :+1:

ntbm commented 1 year ago

Repushed a signed version of the code. Also fixed the tests. Sorry for not running them before and also thank you for providing me an opportunity to learn about payment cards :)

aloisdg commented 1 year ago

You are welcome. Thanks for you work!