Struct Field51A

Source
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

  1. BIC format: Must be valid 8 or 11 character BIC code
  2. BIC structure: 4!a2!a2!c[3!c] format required
  3. Bank code: Must be 4 alphabetic characters
  4. Country code: Must be 2 alphabetic characters
  5. Location code: Must be 2 alphanumeric characters
  6. Branch code: Must be 3 alphanumeric characters (if present)
  7. Account line indicator: If present, exactly 1 character
  8. Account number: If present, max 34 characters
  9. 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

Source

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();
Source

pub fn bic(&self) -> &str

Get the BIC code

Source

pub fn account_line_indicator(&self) -> Option<&str>

Get the account line indicator if present

Source

pub fn account_number(&self) -> Option<&str>

Get the account number if present

Source

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

Source

pub fn bank_code(&self) -> &str

Get bank code from BIC

Source

pub fn country_code(&self) -> &str

Get country code from BIC

Source

pub fn location_code(&self) -> &str

Get location code from BIC

Source

pub fn branch_code(&self) -> Option<&str>

Get branch code from BIC if present

Trait Implementations§

Source§

impl Clone for Field51A

Source§

fn clone(&self) -> Field51A

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Field51A

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Field51A

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Field51A

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Field51A

Source§

fn eq(&self, other: &Field51A) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Field51A

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl SwiftField for Field51A

Source§

fn parse(value: &str) -> Result<Self, ParseError>

Parse field value from string representation
Source§

fn to_swift_string(&self) -> String

Convert field back to SWIFT string format
Source§

fn validate(&self) -> ValidationResult

Validate field according to SWIFT format rules
Source§

fn format_spec() -> &'static str

Get field format specification
Source§

impl StructuralPartialEq for Field51A

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,