Skip to content

Add VatNumber (finance) #25

@vhrcgcom

Description

@vhrcgcom

Description

Implement VatNumber as a ValueObject in the finance module.

Spec: EU VAT number with country-prefix + format validation

Implementation checklist

  • Create src/finance/vatnumber.rs
  • Implement ValueObject trait
  • Add #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
  • Export from src/finance/mod.rs and prelude
  • Unit tests: valid input · empty input · invalid format · normalisation
  • Doc comment with # Example block
  • Update status in ROADMAP.md from ⬜ to ✅

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions