pub struct Field33B {
pub currency: String,
pub amount: f64,
pub raw_amount: String,
}
Expand description
§Field 33B: Currency/Instructed Amount
§Overview
Field 33B specifies the original ordered amount in currency conversions and multi-currency transactions. This field is used when the instructed amount differs from the settlement amount, typically in foreign exchange transactions, currency conversions, or when fees are deducted from the principal amount. It provides transparency about the original instruction versus the actual settlement.
§Format Specification
Format: 3!a15d
- 3!a: Currency code (3 alphabetic characters, ISO 4217)
- 15d: Amount with up to 15 digits including decimal places
§Component Details
-
Currency Code (3!a):
- ISO 4217 standard currency codes
- Exactly 3 alphabetic characters
- Case-insensitive input, stored as uppercase
- Must be valid and active currency code
- Examples: USD, EUR, GBP, JPY, CHF
-
Amount (15d):
- Up to 15 digits including decimal places
- Decimal separator: comma (,) in SWIFT format
- No thousands separators allowed
- Must be non-negative (≥ 0)
- Precision varies by currency (typically 2 decimal places)
§Usage Context
Field 33B appears in various SWIFT MT message types where currency conversion or amount differentiation is required:
§Primary Usage
- MT103: Single Customer Credit Transfer - when original amount differs from settlement
- MT202: General Financial Institution Transfer - for currency conversion scenarios
- MT202COV: Cover for customer credit transfer - original instructed amount
- MT205: Financial Institution Transfer - when amounts differ due to charges
§Secondary Usage
- MT400: Advice of Payment - original payment instruction amount
- MT410: Acknowledgement - acknowledged original amount
- MT420: Tracer - original traced amount
- MT900/910: Confirmation messages - original instruction amount
§Business Applications
- Currency conversion: Original amount before FX conversion
- Charge deduction: Principal amount before fee deduction
- Multi-currency processing: Cross-currency transaction handling
- Reconciliation: Matching original instructions with settlements
- Audit trails: Maintaining complete transaction history
- Compliance reporting: Regulatory reporting of original amounts
- Customer transparency: Showing original vs. settled amounts
- FX risk management: Tracking exposure in original currency
§Related Fields
Field 33B works in conjunction with other amount fields:
§Field 32A (Value Date/Currency/Amount)
- 32A: Settlement amount and currency
- 33B: Original instructed amount and currency
- Relationship: 33B shows original, 32A shows final settlement
§Field 71A (Details of Charges)
- 71A: Charge allocation (OUR/BEN/SHA)
- 33B: Amount before charge deduction
- Usage: When charges affect the settlement amount
§Field 36 (Exchange Rate)
- 36: Exchange rate applied
- 33B: Amount in original currency
- Usage: FX transactions showing rate and original amount
§Currency Conversion Scenarios
- Customer instructs: EUR 100,000
- Bank converts to: USD 108,500 (at rate 1.085)
- Field 33B: EUR100000,00 (original instruction)
- Field 32A: USD108500,00 (settlement amount)
§Charge Deduction Scenarios
- Customer instructs: USD 50,000
- Bank deducts charges: USD 25 (wire fee)
- Field 33B: USD50000,00 (original amount)
- Field 32A: USD49975,00 (net settlement)
§Validation Rules
- Currency format: Must be exactly 3 alphabetic characters
- Currency validity: Should be valid ISO 4217 code
- Amount format: Must follow SWIFT decimal format (comma separator)
- Amount value: Must be non-negative (zero allowed for certain scenarios)
- Precision: Should match currency-specific decimal place rules
- Consistency: Should be logically consistent with Field 32A
§Network Validated Rules (SWIFT Standards)
- Currency code must be exactly 3 characters (Error: T52)
- Currency must be valid ISO 4217 code (Error: T52)
- Amount must be properly formatted (Error: T40)
- Amount cannot be negative (Error: T13)
- Field should be present when amounts differ (Warning: recommended)
- Currency should be actively traded (Warning: recommended)
§Examples
:33B:EUR100000,00
└─── Original instruction: EUR 100,000.00
:33B:USD50000,00
└─── Before charges: USD 50,000.00
:33B:GBP25000,50
└─── Original amount: GBP 25,000.50
Fields§
§currency: String
ISO 4217 currency code (3 alphabetic characters)
Specifies the currency of the original instructed amount using the international standard ISO 4217 currency codes. This represents the currency in which the customer originally instructed the transaction.
Format: Exactly 3 uppercase alphabetic characters Standard: ISO 4217 (International Organization for Standardization) Case handling: Automatically converted to uppercase Validation: Must be valid and preferably active currency code
§Common Scenarios
- FX conversion: Original currency before conversion to settlement currency
- Multi-currency: Different from settlement currency in Field 32A
- Charge scenarios: Same as settlement currency but different amount
§Examples
"EUR"
- Euro (original instruction currency)"USD"
- US Dollar (before conversion to EUR settlement)"GBP"
- British Pound (customer’s account currency)
amount: f64
Original instructed amount as decimal value
The monetary amount as originally instructed by the customer or ordering party, before any currency conversion, charge deduction, or other modifications that result in a different settlement amount.
Range: Must be non-negative (≥ 0.0) Precision: Should follow currency-specific decimal place rules Usage: Represents the “gross” or “original” amount
§Business Context
- Before FX: Amount before currency conversion
- Before charges: Amount before fee/charge deduction
- Customer view: Amount as seen by the ordering customer
- Audit trail: Original instruction for compliance purposes
§Examples
100000.00
- EUR 100,000 before conversion to USD50000.00
- USD 50,000 before $25 wire fee deduction25000.50
- GBP 25,000.50 original instruction amount
raw_amount: String
Raw amount string as received (preserves original formatting)
Maintains the exact string representation of the amount as received in the SWIFT message, preserving the original formatting including decimal separator, precision, and any leading/trailing characters.
Format: SWIFT standard with comma as decimal separator Preservation: Exact reproduction of original message format Usage: For message reconstruction and audit purposes
§Format Examples
"100000,00"
- SWIFT format with comma separator"50000,00"
- Two decimal places preserved"25000,50"
- Original precision maintained"0,01"
- Minimum amount with leading zero
Implementations§
Source§impl Field33B
impl Field33B
Sourcepub fn new(currency: impl Into<String>, amount: f64) -> Result<Self, ParseError>
pub fn new(currency: impl Into<String>, amount: f64) -> Result<Self, ParseError>
Create a new Field33B with validation
Creates a new Field33B instance with comprehensive validation of both currency code and amount. The currency is normalized to uppercase and the amount is formatted according to SWIFT standards.
§Arguments
currency
- ISO 4217 currency code (will be converted to uppercase)amount
- Original instructed amount (must be non-negative)
§Returns
Result containing the Field33B instance or validation error
§Example
let field = Field33B::new("EUR", 100000.00).unwrap();
assert_eq!(field.currency(), "EUR");
assert_eq!(field.amount(), 100000.00);
Sourcepub fn from_raw(
currency: impl Into<String>,
raw_amount: impl Into<String>,
) -> Result<Self, ParseError>
pub fn from_raw( currency: impl Into<String>, raw_amount: impl Into<String>, ) -> Result<Self, ParseError>
Create from raw amount string
Creates a Field33B instance from a raw amount string, preserving the original formatting while parsing the numeric value.
§Arguments
currency
- ISO 4217 currency coderaw_amount
- Amount string in SWIFT format
§Returns
Result containing the Field33B instance or parse error
§Example
let field = Field33B::from_raw("USD", "50000,00").unwrap();
assert_eq!(field.amount(), 50000.00);
assert_eq!(field.raw_amount(), "50000,00");
Sourcepub fn raw_amount(&self) -> &str
pub fn raw_amount(&self) -> &str
Sourcepub fn format_amount(amount: f64) -> String
pub fn format_amount(amount: f64) -> String
Format amount for SWIFT output (with comma as decimal separator)
Formats a decimal amount according to SWIFT standards using comma as the decimal separator.
§Arguments
amount
- Amount to format
§Returns
Formatted amount string
§Example
let formatted = Field33B::format_amount(1234.56);
assert_eq!(formatted, "1234,56");
Sourcepub fn is_valid_currency(&self) -> bool
pub fn is_valid_currency(&self) -> bool
Check if this is a valid ISO 4217 currency code (basic validation)
Performs basic format validation to check if the currency code follows ISO 4217 standards (3 alphabetic characters).
§Returns
true
if the currency code format is valid
§Example
let field = Field33B::new("USD", 1000.00).unwrap();
assert!(field.is_valid_currency());
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 and frequent usage.
§Returns
true
if the currency is a major currency
§Example
let usd_field = Field33B::new("USD", 1000.00).unwrap();
assert!(usd_field.is_major_currency());
let exotic_field = Field33B::new("XYZ", 1000.00).unwrap();
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 = Field33B::new("USD", 1000.00).unwrap();
assert!(usd_field.has_decimal_places());
let jpy_field = Field33B::new("JPY", 1000.00).unwrap();
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 = Field33B::new("USD", 1000.00).unwrap();
assert_eq!(usd_field.decimal_places(), 2);
let jpy_field = Field33B::new("JPY", 1000.00).unwrap();
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 original instructed amount exceeds typical high-value thresholds that may require special handling or reporting.
§Returns
true
if this is considered a high-value transaction
§Example
let high_value = Field33B::new("USD", 1500000.00).unwrap();
assert!(high_value.is_high_value_transaction());
let normal_value = Field33B::new("USD", 50000.00).unwrap();
assert!(!normal_value.is_high_value_transaction());
Sourcepub fn is_currency_conversion(&self, settlement_currency: &str) -> bool
pub fn is_currency_conversion(&self, settlement_currency: &str) -> bool
Check if this represents a currency conversion scenario
This method would typically be used in conjunction with Field 32A to determine if the transaction involves currency conversion.
§Arguments
settlement_currency
- Currency from Field 32A for comparison
§Returns
true
if currencies differ, indicating conversion
§Example
let field = Field33B::new("EUR", 100000.00).unwrap();
assert!(field.is_currency_conversion("USD"));
assert!(!field.is_currency_conversion("EUR"));
Sourcepub fn fx_exposure_category(&self) -> &'static str
pub fn fx_exposure_category(&self) -> &'static str
Calculate potential FX exposure
Estimates the foreign exchange exposure based on the original amount and currency. This is useful for risk management purposes.
§Returns
Exposure category as string
§Example
let field = Field33B::new("USD", 2000000.00).unwrap();
assert_eq!(field.fx_exposure_category(), "High");
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 = Field33B::new("USD", 1234.56).unwrap();
assert_eq!(usd_field.formatted_amount(), "1234.56");
let jpy_field = Field33B::new("JPY", 1234.00).unwrap();
assert_eq!(jpy_field.formatted_amount(), "1234");
Sourcepub fn transaction_purpose(&self) -> &'static str
pub fn transaction_purpose(&self) -> &'static str
Get transaction purpose classification
Provides a classification of the likely transaction purpose based on amount and currency characteristics.
§Returns
Transaction purpose category
§Example
let field = Field33B::new("USD", 50000.00).unwrap();
let purpose = field.transaction_purpose();
assert!(!purpose.is_empty());
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Get human-readable description
Returns a comprehensive description of the original instructed amount including currency, amount, and transaction characteristics.
§Returns
Formatted description string
§Example
let field = Field33B::new("EUR", 100000.00).unwrap();
let desc = field.description();
assert!(desc.contains("EUR"));
assert!(desc.contains("100000.00"));
Sourcepub fn comprehensive_analysis(&self) -> String
pub fn comprehensive_analysis(&self) -> String
Get comprehensive transaction analysis
Returns a detailed analysis of the transaction including currency characteristics, amount classification, and risk assessment.
§Returns
Formatted analysis string
§Example
let field = Field33B::new("USD", 1500000.00).unwrap();
let analysis = field.comprehensive_analysis();
assert!(analysis.contains("USD"));
assert!(analysis.contains("High-value"));
assert!(analysis.contains("Major currency"));