Something went wrong. Try again.
ISO 9362 business identifier codes
Something went wrong. Try again.
Files
README.md
bic #
The business identifier code (BIC) of ISO 9362: 8 or 11 characters, the
business party prefix, the ISO 3166-1 alpha-2 country code, the business party
suffix and the optional branch code.
A payment message names a bank by its BIC; the EPC SEPA Credit Transfer
implementation guidelines accept a BIC 8 or a BIC 11. A string decodes to a
BIC or to the field it gets wrong.
Contents #
Installation #
$ opam install bic
The library is bic and its module is Bic.
Usage #
# let b = Result.get_ok (Bic.of_string "DEUTDEFF500");;
val b : Bic.t = <abstr>
# Bic.prefix b, Bic.Country.to_string (Bic.country b), Bic.suffix b, Bic.branch b;;
- : string * string * string * string option =
("DEUT", "DE", "FF", Some "500")
# Bic.to_string (Bic.bic8 b);;
- : string = "DEUTDEFF"
A malformed BIC names its first wrong field:
# Bic.of_string "DEUTZZFF" |> Result.iter_error (Fmt.pr "%a@." Bic.pp_error);;
country code "ZZ" is not an ISO 3166-1 alpha-2 code
- : unit = ()
What it covers #
- Each field's character set is the pattern of the ISO 20022 data type
BICFIDec2014Identifier,
[A-Z0-9]{4,4}[A-Z]{2,2}[A-Z0-9]{2,2}([A-Z0-9]{3,3}){0,1}: the business
party prefix admits digits, as the ISO 20022 message schemas do, although
SWIFT's BIC policy assigns prefixes of letters only. - The country code is one of the 249 officially assigned ISO 3166-1 alpha-2
codes, orXK, the user-assigned code SWIFT registers BICs under. - A BIC 11 whose branch code is
XXXis the primary office.
Whether a BIC is registered is SWIFT's directory's to say; this library checks
its form.
License #
ISC. See LICENSE.md.