VatNumber
A VAT registration number, written as VIES writes it: its country's code (EL for Greece) and the number in that country's form, GB980780684.
Tax and identity numbers; not ordered; since Jadpo 0.1.0.
Make one
Build one from its fields, VatNumber { country: ... number: ... }.
text.parse(raw, as: VatNumber) reads one from its text; text that isn't one at all fails malformed, such as GB802311781, DE143454215 or FR84323140391.
Its parts keep these rules; a value that breaks one fails with the rule's name:
number_of_country:number is in the form of its country's numbers
Fields
| Field | Type |
|---|---|
country |
Country |
number |
Text |
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends its canonical text as a string.
| Text | JSON |
|---|---|
GB980780684 |
"GB980780684" |
DE143454214 |
"DE143454214" |
FR59542051180 |
"FR59542051180" |
IE6388047V |
"IE6388047V" |
EL094259216 |
"EL094259216" |
AU51824753556 |
"AU51824753556" |
It is stored in 2 columns, each named for the field, _ and its suffix. This is IE6388047V:
| Column | Type | Holds |
|---|---|---|
<field>_country |
text |
'IE' |
<field>_number |
text |
'6388047V' |
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
GB980780684 |
GB980780684 |
DE143454214 |
DE143454214 |
FR59542051180 |
FR59542051180 |
IE6388047V |
IE6388047V |
EL094259216 |
EL094259216 |
AU51824753556 |
AU51824753556 |
Operations
It has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-vat-number.md.Built from Jadpo main at e00e61f.