Struct Field32A

Source
pub struct Field32A {
    pub value_date: NaiveDate,
    pub currency: String,
    pub amount: f64,
    pub raw_amount: String,
}
Expand description

§Field 32A: Value Date, Currency Code, Amount

§Overview

Field 32A is a composite field that contains three critical components of a financial transaction: the value date (when the transaction becomes effective), the currency code (ISO 4217 standard), and the transaction amount. This field is fundamental to SWIFT MT messages and serves as the primary transaction specification in most payment messages.

§Format Specification

Format: 6!n3!a15d

  • 6!n: Value date in YYMMDD format (6 numeric characters)
  • 3!a: Currency code (3 alphabetic characters, ISO 4217)
  • 15d: Amount with up to 15 digits including decimal places

§Component Details

  1. Value Date (YYMMDD):

    • Year: 2-digit year (YY) - assumes 20YY for years 00-99
    • Month: 2-digit month (01-12)
    • Day: 2-digit day (01-31, depending on month)
    • Must be a valid calendar date
  2. Currency Code (3!a):

    • ISO 4217 standard currency codes
    • Exactly 3 alphabetic characters
    • Case-insensitive input, stored as uppercase
    • Examples: USD, EUR, GBP, JPY, CHF
  3. Amount (15d):

    • Up to 15 digits including decimal places
    • Decimal separator: comma (,) in SWIFT format
    • No thousands separators
    • Must be positive (> 0)
    • Precision: typically 2 decimal places for most currencies

§Usage Context

Field 32A appears in numerous SWIFT MT message types:

§Primary Usage

  • MT103: Single Customer Credit Transfer - transaction amount and value date
  • MT202: General Financial Institution Transfer - settlement amount
  • MT202COV: Cover for customer credit transfer - cover amount
  • MT205: Financial Institution Transfer for its Own Account

§Secondary Usage

  • MT400: Advice of Payment - payment amount
  • MT410: Acknowledgement - acknowledged amount
  • MT420: Tracer - traced amount
  • MT900: Confirmation of Debit - debited amount
  • MT910: Confirmation of Credit - credited amount

§Business Applications

  • Payment processing: Core transaction specification
  • Settlement: Value dating for settlement systems
  • Accounting: Transaction recording and reconciliation
  • Compliance: AML/KYC amount thresholds
  • Risk management: Exposure calculation and limits
  • Reporting: Regulatory and management reporting
  • FX processing: Currency conversion and hedging
  • Liquidity management: Cash flow planning

§Value Dating Rules

Value dates must follow specific business rules:

§Standard Rules

  • Same day value: Value date = current business date
  • Next day value: Value date = next business date
  • Forward value: Value date > current date (up to 1 year typically)
  • Back value: Value date < current date (limited, usually same week)

§Currency-Specific Rules

  • USD: T+0 or T+1 settlement
  • EUR: T+1 settlement (TARGET2)
  • GBP: T+0 settlement (CHAPS)
  • JPY: T+0 or T+1 settlement
  • Exotic currencies: May require T+2 or longer

§Holiday Considerations

  • Value dates must be valid business days
  • Consider both sending and receiving country holidays
  • Weekend adjustments follow market conventions
  • Holiday calendars vary by currency and market

§Amount Formatting Rules

  1. Decimal separator: Always comma (,) in SWIFT format
  2. No thousands separators: 1234567,89 not 1,234,567.89
  3. Leading zeros: Not required (123,45 not 0000123,45)
  4. Trailing zeros: Required for decimal places (100,00 not 100)
  5. Maximum precision: Varies by currency (typically 2 decimal places)

§Currency Code Validation

  • Must be valid ISO 4217 currency code
  • Active currencies only (not historical or test codes)
  • Some restricted currencies may require special handling
  • Cryptocurrency codes follow ISO 4217 digital currency standards

§Network Validated Rules (SWIFT Standards)

  • Value date must be valid calendar date (Error: T50)
  • Currency code must be valid ISO 4217 (Error: T52)
  • Amount must be positive and properly formatted (Error: T40)
  • Value date should be reasonable business date (Warning: recommended)
  • Currency should be actively traded (Warning: recommended)

§Examples

:32A:240315USD1234567,89
└─── Value: March 15, 2024, USD 1,234,567.89

:32A:240401EUR500000,00
└─── Value: April 1, 2024, EUR 500,000.00

:32A:240228GBP75000,50
└─── Value: February 28, 2024, GBP 75,000.50

Fields§

§value_date: NaiveDate

Value date when the transaction becomes effective

Specifies the date on which the transaction amount should be credited or debited to the beneficiary’s account. Must be a valid calendar date and typically a business day.

Format: YYMMDD (6 numeric characters) Range: Valid calendar dates Business rules: Should be valid business day for currency

§Examples

  • March 15, 2024 → NaiveDate::from_ymd_opt(2024, 3, 15)
  • December 31, 2023 → NaiveDate::from_ymd_opt(2023, 12, 31)
§currency: String

ISO 4217 currency code (3 alphabetic characters)

Specifies the currency of the transaction amount using the international standard ISO 4217 currency codes.

Format: Exactly 3 uppercase alphabetic characters Standard: ISO 4217 (International Organization for Standardization) Case handling: Automatically converted to uppercase

§Common Currencies

  • "USD" - United States Dollar
  • "EUR" - Euro
  • "GBP" - British Pound Sterling
  • "JPY" - Japanese Yen
  • "CHF" - Swiss Franc
  • "CAD" - Canadian Dollar
  • "AUD" - Australian Dollar

§Examples

let field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1000.00
);
assert_eq!(field.currency, "USD");
§amount: f64

Transaction amount as decimal value

The monetary amount of the transaction expressed as a floating-point number. Must be positive and should respect the precision rules for the specified currency.

Range: Must be positive (> 0.0) Precision: Typically 2 decimal places for most currencies Special cases: JPY typically has 0 decimal places

§Examples

  • 1234567.89 - One million, two hundred thirty-four thousand, five hundred sixty-seven and 89 cents
  • 100.00 - One hundred units
  • 0.01 - One cent (minimum for most currencies)
§raw_amount: String

Raw amount string as received (preserves original formatting)

Maintains the original string representation of the amount as received in the SWIFT message, preserving the exact formatting including decimal separator and precision.

Format: SWIFT standard with comma as decimal separator Preservation: Maintains original precision and formatting Usage: For exact reproduction of original message format

§Examples

  • "1234567,89" - SWIFT format with comma separator
  • "100,00" - Two decimal places preserved
  • "0,01" - Leading zero preserved

Implementations§

Source§

impl Field32A

Source

pub fn new(value_date: NaiveDate, currency: String, amount: f64) -> Self

Create a new Field32A

Creates a new Field32A instance with the specified value date, currency, and amount. The amount is automatically formatted according to SWIFT standards.

§Arguments
  • value_date - The value date for the transaction
  • currency - ISO 4217 currency code (will be converted to uppercase)
  • amount - Transaction amount (must be positive)
§Returns

A new Field32A instance

§Example
let field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1234.56
);
assert_eq!(field.amount, 1234.56);
assert_eq!(field.currency, "USD");
Source

pub fn from_raw( value_date: NaiveDate, currency: String, raw_amount: String, ) -> Result<Self, ParseFloatError>

Create from raw values

Creates a Field32A instance from raw string amount, preserving the original formatting while parsing the numeric value.

§Arguments
  • value_date - The value date for the transaction
  • currency - ISO 4217 currency code
  • raw_amount - Amount string in SWIFT format
§Returns

Result containing the Field32A instance or parse error

§Example
let field = Field32A::from_raw(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "EUR".to_string(),
    "1000,50".to_string()
).unwrap();
assert_eq!(field.amount, 1000.50);
assert_eq!(field.raw_amount, "1000,50");
Source

pub fn currency_code(&self) -> &str

Get the currency code

Returns the ISO 4217 currency code for this transaction.

§Returns

Currency code as string slice

§Example
let field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "GBP".to_string(),
    500.00
);
assert_eq!(field.currency_code(), "GBP");
Source

pub fn amount_decimal(&self) -> f64

Get the amount as decimal

Returns the transaction amount as a floating-point number.

§Returns

Amount as f64

§Example
let field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1234.56
);
assert_eq!(field.amount_decimal(), 1234.56);
Source

pub fn date_string(&self) -> String

Format date as YYMMDD string

Returns the value date formatted as a 6-character string in YYMMDD format as used in SWIFT messages.

§Returns

Date string in YYMMDD format

§Example
let field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1000.00
);
assert_eq!(field.date_string(), "240315");
Source

pub fn is_major_currency(&self) -> bool

Check if the currency is a major currency

Determines if the currency is one of the major internationally traded currencies with high liquidity.

§Returns

true if the currency is a major currency

§Example
let usd_field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1000.00
);
assert!(usd_field.is_major_currency());

let exotic_field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "XYZ".to_string(),
    1000.00
);
assert!(!exotic_field.is_major_currency());
Source

pub fn has_decimal_places(&self) -> bool

Check if the currency typically has decimal places

Determines if the currency typically uses decimal places in amount representation. Some currencies like JPY typically don’t use decimal places.

§Returns

true if the currency typically uses decimal places

§Example
let usd_field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1000.00
);
assert!(usd_field.has_decimal_places());

let jpy_field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "JPY".to_string(),
    1000.00
);
assert!(!jpy_field.has_decimal_places());
Source

pub fn decimal_places(&self) -> u8

Get the typical decimal places for this currency

Returns the number of decimal places typically used for this currency in financial transactions.

§Returns

Number of decimal places (0, 2, or 3)

§Example
let usd_field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1000.00
);
assert_eq!(usd_field.decimal_places(), 2);

let jpy_field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "JPY".to_string(),
    1000.00
);
assert_eq!(jpy_field.decimal_places(), 0);
Source

pub fn is_high_value_transaction(&self) -> bool

Check if the amount is a high-value transaction

Determines if the transaction amount exceeds typical high-value thresholds that may require special handling.

§Returns

true if this is considered a high-value transaction

§Example
let high_value = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1500000.00
);
assert!(high_value.is_high_value_transaction());

let normal_value = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    50000.00
);
assert!(!normal_value.is_high_value_transaction());
Source

pub fn settlement_timing(&self) -> &'static str

Get the settlement timing for this currency

Returns the typical settlement timing for transactions in this currency based on market conventions.

§Returns

Settlement timing description

§Example
let usd_field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1000.00
);
assert_eq!(usd_field.settlement_timing(), "T+0/T+1 (Same day or next day)");
Source

pub fn is_same_day_value(&self) -> bool

Check if this is a same-day value transaction

Determines if the value date is the same as today’s date, indicating same-day value requirements.

§Returns

true if the value date is today

§Example
let today = Utc::now().date_naive();
let field = Field32A::new(today, "USD".to_string(), 1000.00);
assert!(field.is_same_day_value());
Source

pub fn is_forward_dated(&self) -> bool

Check if this is a forward-dated transaction

Determines if the value date is in the future, indicating a forward-dated transaction.

§Returns

true if the value date is in the future

§Example
let future_date = Utc::now().date_naive() + Duration::days(5);
let field = Field32A::new(future_date, "USD".to_string(), 1000.00);
assert!(field.is_forward_dated());
Source

pub fn is_back_dated(&self) -> bool

Check if this is a back-dated transaction

Determines if the value date is in the past, indicating a back-dated transaction.

§Returns

true if the value date is in the past

§Example
let past_date = Utc::now().date_naive() - Duration::days(2);
let field = Field32A::new(past_date, "USD".to_string(), 1000.00);
assert!(field.is_back_dated());
Source

pub fn days_until_value_date(&self) -> i64

Get days until value date

Returns the number of days between today and the value date. Positive values indicate future dates, negative values indicate past dates.

§Returns

Number of days (positive for future, negative for past, 0 for today)

§Example
let future_date = Utc::now().date_naive() + Duration::days(3);
let field = Field32A::new(future_date, "USD".to_string(), 1000.00);
assert_eq!(field.days_until_value_date(), 3);
Source

pub fn formatted_amount(&self) -> String

Format amount with proper currency precision

Formats the amount according to the typical precision rules for the currency.

§Returns

Formatted amount string

§Example
let usd_field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1234.56
);
assert_eq!(usd_field.formatted_amount(), "1234.56");

let jpy_field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "JPY".to_string(),
    1234.00
);
assert_eq!(jpy_field.formatted_amount(), "1234");
Source

pub fn comprehensive_description(&self) -> String

Get comprehensive transaction description

Returns a detailed description of the transaction including value date, currency, amount, and transaction characteristics.

§Returns

Formatted description string

§Example
let field = Field32A::new(
    NaiveDate::from_ymd_opt(2024, 3, 15).unwrap(),
    "USD".to_string(),
    1500000.00
);
let desc = field.comprehensive_description();
assert!(desc.contains("USD"));
assert!(desc.contains("1500000.00"));
assert!(desc.contains("2024-03-15"));

Trait Implementations§

Source§

impl Clone for Field32A

Source§

fn clone(&self) -> Field32A

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 Field32A

Source§

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

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

impl<'de> Deserialize<'de> for Field32A

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 Field32A

Source§

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

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

impl PartialEq for Field32A

Source§

fn eq(&self, other: &Field32A) -> 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 Field32A

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 Field32A

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 Field32A

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>,