# `PiiCatalog.Validators.VatEu`
[🔗](https://github.com/signalvaultio/pii_catalog/blob/v0.1.0/lib/pii_catalog/validators/vat_eu.ex#L1)

EU VAT identification numbers, for the 27 member states.

The prefix is the country code, `EL` for Greece. The national number
follows in its compact form, after an optional space.

Each country's check is written from what its issuer, or the issuer's
government, publishes. Most come from one source: the Austrian Federal
Ministry of Finance's *Information über die Konstruktionsregeln der
Umsatzsteuer-Identifikationsnummern (UID)*, Stand November 2020. Member
states released the rules in it for publication. That covers AT, BE, DE,
DK, EE, FI, HU, IE, IT, LT, LU, NL, PL, PT, SE, SI and SK. The others come
from national law:

  * CZ – zákon č. 280/2009 Sb. § 130 (the number is the IČO of a legal
    entity or the birth number of a person), the Czech Statistical
    Office's description of the IČO check, and zákon č. 133/2000 Sb. § 13
    on birth numbers.
  * ES – Real Decreto 1065/2007 and Orden EHA/451/2008 on the NIF, and the
    Ministerio del Interior's DNI and NIE letter table.
  * FR – INSEE's description of the SIREN, which carries a Luhn check
    digit.
  * HR – Zakon o osobnom identifikacijskom broju (NN 60/2008) and its
    Pravilnik (NN 1/2009): the number is the OIB, with an ISO 7064
    MOD 11,10 check digit.

Only the structure is checked where no official source publishes a
check, or where a number with a published check cannot be told from one
without. That applies to all of a country's numbers for BG, CY, EL, LV, MT
and RO. It also applies to some numbers in three more countries:

  * ES – legal entities, and the K, L and M forms. Each is a letter,
    seven characters and a control character.
  * FR – the two-character key. The SIREN after it is still checked.
  * CZ – nine-digit birth numbers, which people born before 1954 hold.
    These have no check digit, so only their date is checked.

`SOURCES.md` in the repository lists the source for each country.

# `member_states`

```elixir
@spec member_states() :: [String.t(), ...]
```

The prefixes `valid?/1` knows, `EL` for Greece.

# `valid?`

```elixir
@spec valid?(binary()) :: boolean()
```

Whether a VAT number, with its two-letter prefix, passes its country's
check. A space between the prefix and the number is allowed.

    iex> PiiCatalog.Validators.VatEu.valid?("DE 111111125")
    true
    iex> PiiCatalog.Validators.VatEu.valid?("DE111111126")
    false

---

*Consult [api-reference.md](api-reference.md) for complete listing*
