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
-
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
-
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
-
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
- Decimal separator: Always comma (,) in SWIFT format
- No thousands separators: 1234567,89 not 1,234,567.89
- Leading zeros: Not required (123,45 not 0000123,45)
- Trailing zeros: Required for decimal places (100,00 not 100)
- 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 cents100.00
- One hundred units0.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
impl Field32A
Sourcepub fn new(value_date: NaiveDate, currency: String, amount: f64) -> Self
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 transactioncurrency
- 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");
Sourcepub fn from_raw(
value_date: NaiveDate,
currency: String,
raw_amount: String,
) -> Result<Self, ParseFloatError>
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 transactioncurrency
- ISO 4217 currency coderaw_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");
Sourcepub fn currency_code(&self) -> &str
pub fn currency_code(&self) -> &str
Sourcepub fn amount_decimal(&self) -> f64
pub fn amount_decimal(&self) -> f64
Sourcepub fn date_string(&self) -> String
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");
Sourcepub fn is_major_currency(&self) -> bool
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());
Sourcepub fn has_decimal_places(&self) -> bool
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());
Sourcepub fn decimal_places(&self) -> u8
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);
Sourcepub fn is_high_value_transaction(&self) -> bool
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());
Sourcepub fn settlement_timing(&self) -> &'static str
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)");
Sourcepub fn is_same_day_value(&self) -> bool
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());
Sourcepub fn is_forward_dated(&self) -> bool
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());
Sourcepub fn is_back_dated(&self) -> bool
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());
Sourcepub fn days_until_value_date(&self) -> i64
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);
Sourcepub fn formatted_amount(&self) -> String
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");
Sourcepub fn comprehensive_description(&self) -> String
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"));