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

Add vat number rule for es-MX #1812

Merged
merged 1 commit into from
Jan 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/locales/es-MX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,6 @@ es-MX:
payment_methods: ["Tarjeta de credito", "Tarjeta de débito", "Paypal", "Efectivo", "Transferencia de dinero", "Bitcoins", "Cheque", "Apple Pay", "Google Pay", "WeChat Pay", "Alipay", "Visa Checkout"]
subscription_terms: ["Diaria", "Semanal", "Mensual", "Anual", "Bienal", "Trienal", "Quinquenal", "De por vida"]
payment_terms: ["Pago por adelantado", "Mensual", "Anual", "Suscripción completa"]
finance:
vat_number:
MX: /^([A-ZÑ]{3,4})([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])[A-Z0-9]{3}$/
6 changes: 6 additions & 0 deletions test/test_es_mx_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ def test_es_mx_university_methods
assert Faker::University.suffix.is_a? String
assert Faker::University.prefix.is_a? String
end

def test_es_mx_finance_vat_number
vat = Faker::Finance.vat_number(country: 'MX')
assert vat.is_a? String
assert_match(/([A-ZÑ]){3,4}(\d){6}([A-Z0-9]){3}/, vat)
end
end