Documentation
¶
Overview ¶
Package bic provides parsing and validation of BIC (ISO 9362) codes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrLength = errors.New("bic: invalid length") ErrCountryCodeInappropriate = errors.New("bic: country code is neither officially assigned nor user-assigned") ErrBusinessPartyPrefix = errors.New("bic: invalid business party prefix") ErrBusinessPartySuffix = errors.New("bic: invalid business party suffix") ErrBranchCode = errors.New("bic: invalid branch code") )
Functions ¶
Types ¶
type BIC ¶
type BIC struct { // BusinessPartyPrefix, in former editions of ISO 9362 known as the // Bank or Institution Code, is a four-character alphanumeric code // that identifies the business party. BusinessPartyPrefix string // CountryCode is the two character alphabetic ISO 3166-1 alpha-2 // country code. // // Besides the officially assigned ISO 3166-1 country codes, "XK" is used // to represent the Republic of Kosovo. CountryCode string // BusinessPartySuffix, in former editions of ISO 9362 known as the // Location Code, is a two-character alphanumeric code that identifies // the location of the business party. BusinessPartySuffix string // BranchCode is the three character optional alphanumeric branch code. // // Some BICs may use "XXX" as branch code, which is equivalent to an empty // branch code and denotes the primary office of the institution. BranchCode string }
BIC is a ISO 9362 Business Identifier Code.
func Parse ¶
Parse parses s into a BIC.
If Parse returns without an error, the BIC is considered syntactically correct.
Validation Notes ¶
Despite not formally allowed by ISO 9362, Parse allows spaces and lowercase letters in s. The individual parts of the returned BIC are always uppercase and contain no spaces.
While SWIFT has, and will for the foreseeable future, only assigned letters to the business party prefix (c.f. 1: Entity Identifiers/BIC Structure and 2: section 4.3), ISO 9362 expressly allows digits in the business party prefix. Therefore, Parse DOES allow digits in the business party prefix.