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

Added more credit cards inside cards.js #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions src/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,149 @@ export default [
bins: /^(?:2131|1800|35\d{3})\d{11}$/,
codeLength: 3,
},
{
name: 'American Express Corporate',
bins: /^378(2[8-9]|3[0-9]|4[0-9]|5[0-9])\d{12}$/,
codeLength: 4,
},
{
name: 'Bankcard',
bins: /^(5610|560221|560222|560223|560224|560225|560226|560227|5602[89])\d{8}$/,
codeLength: 3,
},
{
name: 'China UnionPay',
bins: /^(62[0-9]{14,17})$/,
codeLength: 3,
},
{
name: 'Maestro',
bins: /^(50|5[6-9]|6[0-9])\d{12,17}$/,
codeLength: 3,
},
{
name: 'Switch',
bins: /^(4903|4905|4911|4936|6333|6759)\d{12}$/,
codeLength: 3,
},
{
name: 'Solo',
bins: /^(6334|6767)\d{12}$/,
codeLength: 3,
},
{
name: 'RuPay',
bins: /^(60|6521|6522)\d{14}$/,
codeLength: 3,
},
{
name: 'Mir',
bins: /^(2200|2204)\d{12}$/,
codeLength: 3,
},
{
name: 'NPS Pridnestrovie',
bins: /^605474\d{10}$/,
codeLength: 3,
},
{
name: 'UnionPay International',
bins: /^(62[1-5]|81[0-9])\d{14,17}$/,
codeLength: 3,
},
{
name: 'Carte Blanche',
bins: /^389[0-9]{11}$/,
codeLength: 3,
},
{
name: 'Laser',
bins: /^(6304|6706|6771|6709)\d{8,15}$/,
codeLength: 3,
},
{
name: 'Eurocard',
bins: /^(4596|4312|4317|4388)\d{12}$/,
codeLength: 3,
},
{
name: 'Carta Si',
bins: /^432917\d{10}$/,
codeLength: 3,
},
{
name: 'ECMC',
bins: /^5[45][0-9]{14}$/,
codeLength: 3,
},
{
name: 'Visa Electron',
bins: /^4(026|17500|405|508|844|913|917)\d{10,13}$/,
codeLength: 3,
},
{
name: 'UATP',
bins: /^1\d{14}$/,
codeLength: 4,
},
{
name: 'Banamex',
bins: /^52[2-9]\d{14}$/,
codeLength: 3,
},
{
name: 'Bancomer',
bins: /^53[0-9]\d{14}$/,
codeLength: 3,
},
{
name: 'KoreanCard',
bins: /^9[0-9]{15}$/,
codeLength: 3,
},
{
name: 'N26',
bins: /^5355\d{14}$/,
codeLength: 3,
},
{
name: 'Revolut',
bins: /^5398\d{14}$/,
codeLength: 3,
},
{
name: 'Starbucks Card',
bins: /^62\d{17}$/,
codeLength: 3,
},
{
name: 'Woori Card',
bins: /^6[0-9]{18}$/,
codeLength: 3,
},
{
name: 'Shinhan Card',
bins: /^9[0-9]{16}$/,
codeLength: 3,
},
{
name: 'Sberbank',
bins: /^4276\d{12}$/,
codeLength: 3,
},
{
name: 'Alfa-Bank',
bins: /^4154\d{12}$/,
codeLength: 3,
},
{
name: 'Santander',
bins: /^4\d{15}$/,
codeLength: 3,
},
{
name: 'Caixa Econômica Federal',
bins: /^627\d{13,16}$/,
codeLength: 3,
},
Comment on lines +203 to +211

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vr-varad, are all these new registrations card brands? From what I noticed, Santander and Caixa Econômica Federal are banks and not card brands.

Comment on lines +67 to +211

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests in credicard.test.js file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests as in can u briefly explain it would be helpful

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you notice file credicard.test.js contains tests to ensure getCreditCardNameByNumber method works correctly. Ideally, tests should be added for each new card.

];