Skip to content

Commit

Permalink
Add Maestro card numbers for Belgium (#131)
Browse files Browse the repository at this point in the history
* fix bancontact maestro card numbers

* update test

* fix laser test

---------

Co-authored-by: zfighou <[email protected]>
  • Loading branch information
fighou and zfighou authored Sep 21, 2023
1 parent 6b6f9f3 commit f7dc0d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/DEdge.Cardidy/Model/Cards.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ public MaestroUk() : base(CardType.MaestroUk, new[] { 6759, 676770, 676774 }, Fr

internal record Maestro : ALuhnCard
{
public Maestro() : base(CardType.Maestro, new[] { 5018, 5020, 5038, 5893, 6304, 6759, 6761, 6762, 6763 }, From12To19) { }
public Maestro() : base(CardType.Maestro, new[] { 5018, 5020, 5038, 5893, 6304, 6759, 6761, 6762, 6763,
//https://www.freebinchecker.com/belgium_maestro-bin-list-brand?hl=fr
6703,6799,6775,6711,6708,6705,6709,6390,6792,6706,6704
}, From12To19) { }
}

internal record MasterCard : ALuhnCard
Expand Down
6 changes: 4 additions & 2 deletions src/Tests/IdentifyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class IdentifyTests
[TestCase("5018-7100009012345", ExpectedResult = CardType.Maestro)]
[TestCase("5018-71000090123456", ExpectedResult = CardType.Maestro)]
[TestCase("5018-710000901234567", ExpectedResult = CardType.Maestro)]
[TestCase("6704-44444444449", ExpectedResult = CardType.Maestro)]
[TestCase("6703-000000000000003", ExpectedResult = CardType.Maestro)]
public CardType ShouldIdentifyAsMaestro(string cardNumber) => Cardidy.Identify(cardNumber, useCheck: false, ignoreNoise: true).First();

[TestCase("676770-0000901089", ExpectedResult = CardType.MaestroUk)]
Expand Down Expand Up @@ -165,10 +167,10 @@ public class IdentifyTests
[TestCase("6384960368309025--", ExpectedResult = CardType.InstaPayment)]
public CardType ShouldIdentifyAsInstaPayment(string cardNumber) => Cardidy.Identify(cardNumber, useCheck: true, ignoreNoise: true).First();

[TestCase("6709123456789876", ExpectedResult = new[] { CardType.Laser, CardType.GPN })]
[TestCase("6709123456789876", ExpectedResult = new[] { CardType.Maestro, CardType.Laser, CardType.GPN })]
[TestCase("6771123456789876", ExpectedResult = new[] { CardType.Laser, CardType.GPN })]
[TestCase("6304000004583145", ExpectedResult = new[] { CardType.Maestro, CardType.Laser, CardType.GPN })]
[TestCase("6706710000901089", ExpectedResult = new[] { CardType.Laser, CardType.GPN })]
[TestCase("6706710000901089", ExpectedResult = new[] { CardType.Maestro, CardType.Laser, CardType.GPN })]
public IEnumerable<CardType> ShouldIdentifyAsLaser(string cardNumber) => Cardidy.Identify(cardNumber, useCheck: false, ignoreNoise: true).ToArray();

[TestCase("4903670912340031", ExpectedResult = new[] { CardType.Visa, CardType.Switch })]
Expand Down

0 comments on commit f7dc0d0

Please sign in to comment.