Skip to content

Add Bic (finance) #24

@vhrcgcom

Description

@vhrcgcom

Description

Implement Bic as a ValueObject in the finance module.

Spec: BIC/SWIFT, 8 or 11 chars

Implementation checklist

  • Create src/finance/bic.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 BicInput
Output String BicOutput

Normalization

Trim, convert to uppercase.

Validation

  • Must be 8 or 11 alphanumeric characters.
  • Structure: BBBB CC LL [BBB] (no spaces in the actual value):
    • Positions 1–4: bank code — 4 ASCII letters.
    • Positions 5–6: country code — 2 ASCII letters.
    • Positions 7–8: location code — 2 alphanumeric characters.
    • Positions 9–11 (optional): branch code — 3 alphanumeric characters.

Extra methods

  • bank_code() -> &str — first 4 characters.
  • country_code() -> &str — characters 5–6.
  • location_code() -> &str — characters 7–8.
  • branch_code() -> Option<&str> — characters 9–11 if present (11-char BIC), None for 8-char BIC.

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