pub struct Field51A {
pub account_line_indicator: Option<String>,
pub account_number: Option<String>,
pub bic: String,
}
Expand description
§Field 51A: Sending Institution
§Overview
Field 51A identifies the sending institution in SWIFT payment messages using a BIC code. This field specifies the financial institution that is sending the payment message, typically used in correspondent banking arrangements and institutional transfers. The sending institution is distinct from the ordering institution and represents the actual message sender in the SWIFT network, providing crucial information for message routing, settlement processing, and regulatory compliance.
§Format Specification
Format: [/1!a][/34x]4!a2!a2!c[3!c]
- 1!a: Optional account line indicator (1 character)
- 34x: Optional account number (up to 34 characters)
- 4!a2!a2!c[3!c]: BIC code (8 or 11 characters)
§BIC Structure
CHASUS33XXX
││││││││└┴┴─ Branch Code (3 characters, optional)
││││││└┴──── Location Code (2 characters)
││││└┴────── Country Code (2 letters)
└┴┴┴──────── Bank Code (4 letters)
§Field Components
- Account Line Indicator: Optional qualifier for account type or purpose
- Account Number: Institution’s account number for settlement
- BIC: Bank Identifier Code uniquely identifying the sending institution
§Usage Context
Field 51A is used in:
- MT103: Single Customer Credit Transfer (optional)
- MT103.REMIT: Single Customer Credit Transfer with Remittance (optional)
- MT200: Financial Institution Transfer
- MT202: General Financial Institution Transfer
- MT202COV: Cover for customer credit transfer
§Business Applications
- Correspondent banking: Identifying the actual message sender
- Settlement: Providing account information for settlement processes
- Compliance: Meeting regulatory requirements for sender identification
- Audit trails: Maintaining clear sender identification records
- Message routing: Supporting proper SWIFT network routing
- Risk management: Enabling counterparty risk assessment
§MT103 Variant Support
- MT103 Core: Optional field
- MT103.STP: Not allowed (STP compliance restriction)
- MT103.REMIT: Optional field
§Examples
use swift_mt_message::fields::Field51A;
// BIC only
let field = Field51A::new(None, None, "CHASUS33XXX").unwrap();
// With account number
let field = Field51A::new(None, Some("1234567890".to_string()), "DEUTDEFF500").unwrap();
// With account line indicator and account number
let field = Field51A::new(Some("C".to_string()), Some("1234567890".to_string()), "HSBCHKHH").unwrap();
§Account Line Indicators
Common account line indicators include:
- A: Account identifier (generic)
- B: Beneficiary account
- C: Checking account
- D: Deposit account
- S: SWIFT account identifier
- T: Trust account
- N: Nostro account
- V: Vostro account
§Validation Rules
- BIC format: Must be valid 8 or 11 character BIC code
- BIC structure: 4!a2!a2!c[3!c] format required
- Bank code: Must be 4 alphabetic characters
- Country code: Must be 2 alphabetic characters
- Location code: Must be 2 alphanumeric characters
- Branch code: Must be 3 alphanumeric characters (if present)
- Account line indicator: If present, exactly 1 character
- Account number: If present, max 34 characters
- Character validation: All components must use valid character sets
§Network Validated Rules (SWIFT Standards)
- BIC must be valid format and registered (Error: T27)
- BIC format must comply with ISO 13616 standards (Error: T11)
- Account line indicator must be single character (Error: T12)
- Account number cannot exceed 34 characters (Error: T14)
- Bank code must be alphabetic only (Error: T15)
- Country code must be valid ISO 3166-1 code (Error: T16)
- Location code must be alphanumeric (Error: T17)
- Branch code must be alphanumeric if present (Error: T18)
- Characters must be from SWIFT character set (Error: T61)
- Field 51A not allowed in MT103.STP messages (Error: C51)
- Field 51A optional in MT103 Core and MT103.REMIT (Warning: W51)
Fields§
§account_line_indicator: Option<String>
Account line indicator (optional, 1 character)
account_number: Option<String>
Account number (optional, up to 34 characters)
bic: String
BIC code (8 or 11 characters)
Implementations§
Source§impl Field51A
impl Field51A
Sourcepub fn new(
account_line_indicator: Option<String>,
account_number: Option<String>,
bic: impl Into<String>,
) -> Result<Self>
pub fn new( account_line_indicator: Option<String>, account_number: Option<String>, bic: impl Into<String>, ) -> Result<Self>
Create a new Field51A with validation
§Arguments
account_line_indicator
- Optional account line indicator (1 character)account_number
- Optional account number (up to 34 characters)bic
- BIC code (8 or 11 characters)
§Examples
use swift_mt_message::fields::Field51A;
// BIC only
let field = Field51A::new(None, None, "CHASUS33XXX").unwrap();
// With account number
let field = Field51A::new(None, Some("1234567890".to_string()), "DEUTDEFF500").unwrap();
// With account line indicator and account number
let field = Field51A::new(Some("C".to_string()), Some("1234567890".to_string()), "HSBCHKHH").unwrap();
Sourcepub fn account_line_indicator(&self) -> Option<&str>
pub fn account_line_indicator(&self) -> Option<&str>
Get the account line indicator if present
Sourcepub fn account_number(&self) -> Option<&str>
pub fn account_number(&self) -> Option<&str>
Get the account number if present
Sourcepub fn is_stp_allowed(&self) -> bool
pub fn is_stp_allowed(&self) -> bool
Check if this field is allowed in MT103.STP messages
Field 51A is NOT allowed in MT103.STP messages according to SWIFT standards
Sourcepub fn country_code(&self) -> &str
pub fn country_code(&self) -> &str
Get country code from BIC
Sourcepub fn location_code(&self) -> &str
pub fn location_code(&self) -> &str
Get location code from BIC
Sourcepub fn branch_code(&self) -> Option<&str>
pub fn branch_code(&self) -> Option<&str>
Get branch code from BIC if present