maielo / stripe-tax-utils

stripe-vat utility tools
MIT License
5 stars 5 forks source link

Mexican taxcode Regex (BUG) #8

Open mmmarcolino opened 4 months ago

mmmarcolino commented 4 months ago

https://github.com/maielo/stripe-tax-utils/blob/7aa2eb32090a1215cb0b71e264a1a21f9e71a6cc/src/stripeTaxMap.ts#L381

The Mexican tax-code regex do not accepts person's RFC number.

While companies has a RFC starting with only 3 letters instead persons have a RIF starting with 4 letters (cfr. https://en.wikipedia.org/wiki/VAT_identification_number#:~:text=Mexico,g.%20P%26G851223B24 and sorry if I do not have a better reference).

Perhaps this personal tax-code 'AABD770905341' should be accepted as a valid Mexican tax-code (as far as I know) but it doesn't.

Using only the knowledge I have I would suggest the following:

{
      countryName: "Mexico",
      country: "MX",
      type: "mx_rfc",
      description: "Mexican RFC number",
      example: "A-12345678-9",
      regex: /^[A-Z]{3,4}[0-9]{6}\d{3}$/
 }

I used \d{3} because as far as I know the last 3 digits can have both numbers and letters.

Thanks for your help in advance.