Description
Implement VatNumber as a ValueObject in the finance module.
Spec: EU VAT number with country-prefix + format validation
Implementation checklist
Implementation detail
Input / Output
|
Type |
Alias |
| Input |
String |
VatNumberInput |
| Output |
String |
VatNumberOutput |
Normalization
Trim, uppercase, strip internal spaces.
Validation
- Must start with a known EU country prefix (2 ASCII letters): AT, BE, BG, CY, CZ, DE, DK, EE, EL, ES, FI, FR, HR, HU, IE, IT, LT, LU, LV, MT, NL, PL, PT, RO, SE, SI, SK, XI.
- After the 2-letter prefix: 2–13 alphanumeric characters.
- For MVP this structural validation is sufficient; per-country format rules (e.g. CZ has 8–10 digits, DE has 9 digits) can be added later.
Extra methods
country_prefix() -> &str — first 2 characters, e.g. "CZ", "DE".
References
Description
Implement
VatNumberas aValueObjectin thefinancemodule.Spec: EU VAT number with country-prefix + format validation
Implementation checklist
src/finance/vatnumber.rsValueObjecttrait#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]src/finance/mod.rsandprelude# ExampleblockROADMAP.mdfrom ⬜ to ✅Implementation detail
Input / Output
StringVatNumberInputStringVatNumberOutputNormalization
Trim, uppercase, strip internal spaces.
Validation
Extra methods
country_prefix() -> &str— first 2 characters, e.g."CZ","DE".References