-
Notifications
You must be signed in to change notification settings - Fork 27
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 french ID parser #8
base: main
Are you sure you want to change the base?
Conversation
add RP in document codes
Update parseDocumentCodeId.js
parse mrz from French driving licence
@@ -59,7 +59,7 @@ module.exports = [ | |||
}, | |||
Object.assign({}, documentNumberTemplate, { | |||
line: 1, | |||
start: 7, | |||
start: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change? The 3 fields are separated in the description of wikipedia. They can always be reconcatenated later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.consilium.europa.eu/prado/en/FRA-BO-02002/image-7890.html
First 12 symbols represent complete Document Number. I don't think there is a case to use just part of it somewhere. Without this change all library clients should check if it's France then concatenate 3 fields to get the doc number.
I can make a pull request without this change if you don't want to break the backward compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation. This LGTM then. No problem, we'll make a major release with all the changes.
@@ -5,7 +5,8 @@ const formats = { | |||
TD2: 'TD2', | |||
TD3: 'TD3', | |||
SWISS_DRIVING_LICENSE: 'SWISS_DRIVING_LICENSE', | |||
FRENCH_NATIONAL_ID: 'FRENCH_NATIONAL_ID' | |||
FRENCH_NATIONAL_ID: 'FRENCH_NATIONAL_ID', | |||
FRENCH_DRIVING_LICENSE: 'FRENCH_DRIVING_LICENSE' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we call it EU_DRIVING_LICENSE or the french one has non-standard parts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no standard in EU driving license. As I know, French, Swiss and Netherlands driving licenses are all has unique format.
Thank you for the contribution! |
"name": "@lukesolo/mrz", | ||
"version": "3.1.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"name": "@lukesolo/mrz", | |
"version": "3.1.3", | |
"name": "mrz", | |
"version": "3.1.1", |
|
||
module.exports = { | ||
testURL: 'http://localhost', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, as I remember I had some problems with Jest and after googling this helped me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it I get
FAIL src/parse/__tests__/td3.js
● Test suite failed to run
SecurityError: localStorage is not available for opaque origins
at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15)
at Array.forEach (<anonymous>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you try with testEnvironment: "node"
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it helps.
Thanks!
@targos any idea why this branch was not merged = |
There are open discussions |
For those interested in a much smaller scope: I created a PR that only adds support for french national IDs with no administrative code. |
https://en.wikipedia.org/wiki/National_identity_card_(France)#Machine-readable_zone
Some French IDs don't have issuance code, so it's not correct to pick MRZ type by it's presence.