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

France Metropolitan Lyon Region Validation #63

Open
SLourenco opened this issue Jun 13, 2020 · 7 comments
Open

France Metropolitan Lyon Region Validation #63

SLourenco opened this issue Jun 13, 2020 · 7 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@SLourenco
Copy link

On the region digits, there is at least one case Metropolitan Lyon which has a letter in the COG.

'69M' => 'Metropolitan Lyon',

But the validation algorithm for France will throw a cast error when trying to parse an id that includes that COG.

public function validate(string $id): bool
{
  $id = $this->sanitize($id);

  $checksum = (int) substr($id, -2);
  $id = substr($id, 0, -2);

  $result = 97 - ((int) $id % 97); // cast error for an id like 1510269M02043

  return $checksum === $result;
}

I can't find any documentation on how to perform the control digit calculation for a scenario like that though.

@AlexOlival AlexOlival added bug Something isn't working help wanted Extra attention is needed labels Jun 14, 2020
@AlexOlival
Copy link
Collaborator

We should look around for some implementations of the French validator

@AlexOlival
Copy link
Collaborator

@all-contributors please add @SLourenco for bug, doc and code

@allcontributors
Copy link
Contributor

@AlexOlival

I've put up a pull request to add @SLourenco! 🎉

@JoaoFSCruz
Copy link
Collaborator

JoaoFSCruz commented Jun 14, 2020

I've been looking into it and found that Corsica has the same problem. It is referenced as 2A and 2B.

For Corsica, the wiki page provides a way to validate the INSEE. (https://fr.wikipedia.org/wiki/Num%C3%A9ro_de_s%C3%A9curit%C3%A9_sociale_en_France). But not for Lyon...

@AlexOlival
Copy link
Collaborator

So are there different ways of validating the INSEE depending on the region? Yikes...

@JoaoFSCruz
Copy link
Collaborator

I've just updated the ID validation for Corsica citizens, so it is now possible to validate and extract information from them.

You can check it at french-id-fixes branch.

Regarding Lyon... Still no clue how to work that around... 🤔

@AlexOlival AlexOlival added this to the v1.1.1 Update milestone Jun 17, 2020
@AlexOlival
Copy link
Collaborator

De-scoping this from the v1.1.1 for now, because we're blocked

@AlexOlival AlexOlival removed this from the v1.1.1 Update milestone Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants