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

Domains: Add Luhn check for SIREN/SIRET values #41816

Merged
merged 4 commits into from
May 6, 2020

Conversation

eltongo
Copy link
Contributor

@eltongo eltongo commented May 5, 2020

Changes proposed in this Pull Request

This PR updates validation checks for .fr domains, to include a Luhn check on the SIREN/SIRET value provided by the user.

Testing instructions

  • Run tests and make sure they pass (yarn run test-client "client/components/domains/registrant-extra-info/test")
  • Add a .fr domain to cart
  • After submitting the contact info, you will be asked "Who's this domain for?". Choose "Organization"
  • Provide different values to the SIREN/SIRET field, and ensure that error messages appear when appropriate

This error should appear when the value is not valid (i.e. invalid characters or length):

Screenshot 2020-05-05 at 5 32 35 PM

This error should appear when everything else is OK, but the Luhn check fails:

Screenshot 2020-05-05 at 5 32 53 PM

@eltongo eltongo added the [Feature Group] Emails & Domains Features related to email integrations and domain management. label May 5, 2020
@eltongo eltongo requested a review from a team May 5, 2020 15:40
@eltongo eltongo self-assigned this May 5, 2020
@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~252 bytes added 📈 [gzipped])

name      parsed_size           gzip_size
checkout       +521 B  (+0.0%)     +252 B  (+0.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@eltongo eltongo added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 5, 2020
Copy link
Contributor

@klimeryk klimeryk left a comment

Choose a reason for hiding this comment

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

Tested and works as expected 🎉

However, lonng-term we'll have to do this check on the backend instead, because that's what the new checkout uses. But in the meantime I'll be happy to get rid of the registration failures caused by invalid SIREN/SIRET numbers...

@@ -25,7 +25,7 @@ describe( 'validateContactDetails', () => {
extra: {
fr: {
registrantType: 'individual',
sirenSiret: '123456789',
Copy link
Contributor

Choose a reason for hiding this comment

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

Hahaha, love that the old test used an invalid SIREN number and still passed :D

@klimeryk klimeryk added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels May 6, 2020
@eltongo eltongo merged commit 3fd872a into master May 6, 2020
@eltongo eltongo deleted the update/fr-siren-siret-checksum branch May 6, 2020 19:24
@a8ci18n
Copy link

a8ci18n commented May 22, 2020

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/3502280

Thank you @eltongo for including a screenshot in the description! This is really helpful for our translators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature Group] Emails & Domains Features related to email integrations and domain management.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants