-
-
Notifications
You must be signed in to change notification settings - Fork 942
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
fix(finance): correct Discover card number format #3336
Conversation
✅ Deploy Preview for fakerjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Have you checked the other locales as well? |
ad69bfd
to
794cf32
Compare
You're right, I've missed one. I've just added it. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #3336 +/- ##
=======================================
Coverage 99.97% 99.97%
=======================================
Files 2811 2811
Lines 217012 217006 -6
Branches 939 937 -2
=======================================
- Hits 216959 216953 -6
Misses 53 53
|
Could you please link the official spec for the discover card numbers for easier verification of your changes? |
If possible, please also add a test that uses validatorjs' isCreditcard with provider discover. faker/test/modules/finance.spec.ts Lines 478 to 480 in 5436111
Is the validation pattern there correct? |
When i previously tested this validator.js incorrectly disallows the |
I've tried with validator.js but indeed it throws an error for the Should I add a test using validatorjs' isCreditcard and remove the |
We can omit the check for now and add it once validatorjs fixes their pattern. |
I looked for an existing PR in validatorjs addressing this issue, but I couldn't find any. |
If you would like to, you could create it when you have time. |
I'm not sure the official info from Discover provides enough info for a canonical validation regex. It shows the correct prefixes but not what lengths are valid for each prefix? |
Based on the official documentation from Discover, we know that the valid lengths for cards with the prefix 644-9 are between 16 and 19 digits. I think it should be enough to build the regex in validator.js? I will open an issue when I will have time. |
Right I mean it's fine if faker.js only generates a small subset of valid Discover card numbers. But validator.js should ideally validate all valid card numbers and I'm not sure we have detailed enough info to create a PR on validator.js to do that. |
Partially fixes #2350
This PR addresses an issue with the Discover card number format in the finance module. The previous implementation allowed invalid card number formats that did not align with Discover's official specifications. Discover card number can't have 20-digit card numbers.
https://www.discoverglobalnetwork.com/content/dam/discover/en_us/dgn/docs/IPP-VAR-Enabler-Compliance.pdf
Changes Introduced:
No breaking changes are introduced.