This library is for parsing Business Identifier Codes (BIC) used e.g. in banking. The implementation is based on ISO 9362 Fourth edition 2014-12-01.
Business party prefix (4 alpha-numeric).
CountryCode (ISO 3166). Just an alias to Iso3166.CountryCode from rl-king/elm-iso3166-country-codes
Business party suffix (2 alpha-numeric).
Branch identifier (3 alpha-numeric).
The branch code is optional ("XXX" for primary office). Where an eight digit BIC code is given, it may be assumed that it refers to the primary office.
Try to parse a String into a BIC. Spaces in that String will
be removed and all letters will be upcased.
fromString "FDDO DE MM" -- Ok (BIC "FDDO" Iso3166.DE "MM" Nothing)
fromString "FDDO DE MM XXX" -- Ok (BIC "FDDO" Iso3166.DE "MM" Nothing)
fromString "axisinbb002" -- Ok (BIC "AXIS" Iso3166.IN "BB" (Just "002"))Parser errors potentially returned by fromString.
fromString "FDDO" -- Err LengthError
fromString "FDDODEMMXXX Q" -- Err LengthError
fromString "FD @! DEMMXXX" -- Err NotAlphaNumeric
fromString "FDDO QQ MMXXX" -- Err UnknownCountryCodeConvert BIC to an either 8 or 11 character String, depending on the
availability of the branch code.
-- bic == BIC "FDDO" Iso3166.DE "MM" Nothing
toString bic -- "FDDODEMM"
-- bic == BIC "AXIS" Iso3166.IN "BB" (Just "002")
toString bic -- "AXISINBB002"Convert BIC to an 11 character String, where the branch code will be set
to "XXX" if it doesn't exist.
-- bic == BIC "FDDO" Iso3166.DE "MM" Nothing
toString11 bic -- "FDDODEMMXXX"
-- bic == BIC "AXIS" Iso3166.IN "BB" (Just "002")
toString11 bic -- "AXISINBB002"Extract business party prefix from BIC.
-- bic == BIC "FDDO" Iso3166.DE "MM" Nothing
toPartyPrefix bic -- "FDDO"Extract country code from BIC.
-- bic == BIC "FDDO" Iso3166.DE "MM" Nothing
toCountryCode bic -- Iso3166.DEExtract business party suffix code from BIC.
-- bic == BIC "FDDO" Iso3166.DE "MM" Nothing
toPartySuffix bic -- "MM"Extract branch code from BIC, using "XXX" if not available.
-- bic == BIC "FDDO" Iso3166.DE "MM" Nothing
toBranchId bic -- "XXX"
-- bic == BIC "AXIS" Iso3166.IN "BB" (Just "002")
toBranchId bic -- "002"Extract branch code from BIC if available.
-- bic == BIC "FDDO" Iso3166.DE "MM" Nothing
toOptionalBranchId bic -- Nothing
-- bic == BIC "AXIS" Iso3166.IN "BB" (Just "002")
toOptionalBranchId bic -- Just "002"
Represents a Business Identifier Code (BIC) as an opaque type.