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.
| Class | Id | Options interface | Fields |
|---|---|---|---|
IbanType | iban | IbanTypeOptions | placeholder?, fallback? |
BicType | bic | BicTypeOptions | placeholder?, fallback? |
VatNumberType | vat_number | VatNumberTypeOptions | placeholder?, defaultCountry?, fallback? |
CompanyNumberType | company_number | CompanyNumberTypeOptions | country: 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.
IbanTypechecks 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.BicTypechecks the shape of ISO 9362: a four-character party prefix, a two-letter country, a two-character location and an optional three-character branch.VatNumberTypestores 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 asEL, and a typedGRis read asEL), 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 indefaultCountry, and is refused when nodefaultCountryis set. The type does not ask VIES whether the number is registered.CompanyNumberTyperequirescountryand 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
DataTypecontract, the registry and the other default types.