Skip to content

Commit

Permalink
feat: #ensure_valid_syntax on tax ids (#1)
Browse files Browse the repository at this point in the history
### Why?

As a user of TaxIds I want to make as few government database lookups as
possible. By making sure that the TaxId initializer only creates
instances that adhere to the specific TaxId type syntaxes we can avoid
any unnecessary lookups.

### What changed?

- Added the `tax_country_code` field to the TaxId struct. This field is
populated with the two-letter code at the start of the tax id value. IE:
`"SE"` in `"SE123456789101"`. This was added due to cases where the
TaxId value uses another two-letter iso code than the country. IE:
`"GR"` & `"EL"` or `"GB"` and `"XI"`.
- Depending on the tax id value provided, TaxId initializer will route
tp different `TaxIdTypes`. IE: `"SE123456789101"` will resolve to the
`EUVat` while `"GBHA123"` will resolve to `GBVat`.
- Added regexes for EUVats & GBVat
  • Loading branch information
Mollemoll authored May 2, 2024
1 parent 3c16fd1 commit 6bc867a
Show file tree
Hide file tree
Showing 6 changed files with 979 additions and 18 deletions.
54 changes: 54 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ name = "tax_ids"
version = "0.1.0"
edition = "2021"

[dependencies]
[dependencies]
lazy_static = "1.4.0"
regex = "1.10.4"
Loading

0 comments on commit 6bc867a

Please sign in to comment.