protocol

# `iso_9362_protocol`

Protocol for ISO 9362 BIC structure parsing and normalization.

Availability:
`logtalk_load(iso_9362(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-05-05
Compilation flags:
`static`
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

## Public predicates

### `bic/5`

Parses and validates an ISO 9362 BIC atom into business party prefix, ISO 3166-1 alpha-2 country code, business party suffix, and branch identifier. Eight-character BICs are normalized to the primary-office branch code `XXX`.

Compilation flags:
`static`
Template:
`bic(BIC,Prefix,CountryAlpha2,Suffix,Branch)`
Mode and number of proofs:
`bic(+atom,?atom,?atom,?atom,?atom)` - `zero_or_one`

### `canonical_bic/2`

Returns the canonical 11-character form of a valid ISO 9362 BIC, using the branch code `XXX` when the input is an eight-character primary-office BIC.

Compilation flags:
`static`
Template:
`canonical_bic(BIC,Canonical)`
Mode and number of proofs:
`canonical_bic(+atom,?atom)` - `zero_or_one`

### `primary_office_bic/1`

True when a valid ISO 9362 BIC denotes the primary office, either because it is eight characters long or because its branch identifier is `XXX`.

Compilation flags:
`static`
Template:
`primary_office_bic(BIC)`
Mode and number of proofs:
`primary_office_bic(+atom)` - `zero_or_one`

## Protected predicates

(none)

## Private predicates

(none)

## Operators

(none)