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 Faker::Finance.vat_number #1348

Merged
merged 6 commits into from
Aug 29, 2018
Merged

Add Faker::Finance.vat_number #1348

merged 6 commits into from
Aug 29, 2018

Conversation

vbrazo
Copy link
Member

@vbrazo vbrazo commented Aug 28, 2018

Checklist

  • Add Faker::Finance.vat_number
  • Add tests
  • Add docs

This PR fixes #1326

@vbrazo
Copy link
Member Author

vbrazo commented Aug 28, 2018

@tagliala hey brother. Could you please take a look at this PR and let me know how it looks?

SI: "SI########"
SK: "SK##########"
SM: "SM#####"
UA: "UA##########"
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing new line at the end of file

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the heads up 👍

# the sum plus whatever the last digit is must be a multiple of 10. So, the
# last digit must be 10 - the last digit of the sum.
luhn_digit = (10 - (luhn_sum % 10)) % 10

template.gsub('L', luhn_digit.to_s)
end

def vat_number(country = 'BR')
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for the default country to be BR?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, there isn't

@vbrazo vbrazo merged commit a7c6b32 into faker-ruby:master Aug 29, 2018
davidmorton0 pushed a commit to davidmorton0/faker that referenced this pull request Jul 12, 2021
* Add Faker::Finance.vat_number, its tests and docs

* Update changelog

* Add tests and reorder locales

* Minor changes

* Update test_faker_finance.rb

* Minor change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VAT Number
2 participants