Description
Implement Bic as a ValueObject in the finance module.
Spec: BIC/SWIFT, 8 or 11 chars
Implementation checklist
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
Description
Implement
Bicas aValueObjectin thefinancemodule.Spec: BIC/SWIFT, 8 or 11 chars
Implementation checklist
src/finance/bic.rsValueObjecttrait#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]src/finance/mod.rsandprelude# ExampleblockROADMAP.mdfrom ⬜ to ✅Implementation detail
Input / Output
StringBicInputStringBicOutputNormalization
Trim, convert to uppercase.
Validation
BBBB CC LL [BBB](no spaces in the actual value):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),Nonefor 8-char BIC.References