[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationIdentifier data types

Identifier data types

The default data types that read and check an IBAN, a BIC, a VAT number and a company number.

These are the default data types that hold a legal or banking identifier. Each one takes its options object as its only constructor argument, and compares with contains, is, is_not, not_contains, is_empty and is_not_empty. A filter value is read like a typed value: contains:BE68 5390 finds the stored "BE68539007547034", and is:0123.456.749 the stored company number "0123456749", compared as text.

ClassIdOptions interfaceFields
IbanTypeibanIbanTypeOptionsplaceholder?, fallback?
BicTypebicBicTypeOptionsplaceholder?, fallback?
VatNumberTypevat_numberVatNumberTypeOptionsplaceholder?, defaultCountry?, fallback?
CompanyNumberTypecompany_numberCompanyNumberTypeOptionscountry: CompanyNumberCountry ("BE" | "FR"), placeholder?, fallback?

What each type accepts

IbanType, BicType, VatNumberType and CompanyNumberType read what a person types: spaces, dots, dashes and slashes are dropped and letters put in upper case. The schema transforms a valid value to that canonical form, so it is stored in that form. It refuses any other value with the issue message $dms.field_errors.invalid_iban, invalid_bic, invalid_vat_number or invalid_company_number. Their input, FormComponents.InputIdentifier, checks the same rules in the browser, and the dashboard shows an IBAN in groups of four and a company number as its country prints it. Its options, FormComponents.InputIdentifierOptions, depend on identifier: "company_number" requires country, only "vat_number" takes defaultCountry, and "iban" and "bic" take neither.

  • IbanType checks the two check digits (ISO 13616, modulo 97) and stores "BE68539007547034". It does not check each country's IBAN length: a cut-short or mistyped number already fails the check digits.
  • BicType checks the shape of ISO 9362: a four-character party prefix, a two-letter country, a two-character location and an optional three-character branch.
  • VatNumberType stores the number as VIES writes it ("BE0123456749"). The number after the country code must have that country's shape, for the 27 EU countries (Greece as EL, and a typed GR is read as EL), Northern Ireland (XI) and Great Britain (GB). Belgium, Germany, France (a numeric key), Italy and Luxembourg also check the check digits. A number typed without its country code is read in defaultCountry, and is refused when no defaultCountry is set. The type does not ask VIES whether the number is registered.
  • CompanyNumberType requires country and throws when it is built with a country it does not read. "BE" reads an enterprise number of ten digits ("0123456749", the last two being 97 minus the first eight modulo 97); a nine-digit number from before 2005 gets its leading zero. "FR" reads a SIREN of nine digits checked with the Luhn algorithm. A number typed with its country code in front ("BE 0123.456.749") reads the same.

Next steps

  • Data types: The DataType contract, the registry and the other default types.