Skip to content

Add CurrencyCode (finance) #22

@vhrcgcom

Description

@vhrcgcom

Description

Implement CurrencyCode as a ValueObject in the finance module.

Spec: ISO 4217 alpha-3 (EUR, USD, CZK…)

Implementation checklist

  • Create src/finance/currencycode.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 CurrencyCodeInput
Output String CurrencyCodeOutput

Normalization

Trim, convert to uppercase.

Validation

  • Exactly 3 ASCII letters.
  • Must be a known ISO 4217 alphabetic code (embed a static lookup table of all ~170 active currency codes, similar to the calling_code map in PhoneNumber).

Extra methods

None beyond the trait.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions