Struct Field33B

Source
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

  1. 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
  2. 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

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

  1. Customer instructs: EUR 100,000
  2. Bank converts to: USD 108,500 (at rate 1.085)
  3. Field 33B: EUR100000,00 (original instruction)
  4. Field 32A: USD108500,00 (settlement amount)

§Charge Deduction Scenarios

  1. Customer instructs: USD 50,000
  2. Bank deducts charges: USD 25 (wire fee)
  3. Field 33B: USD50000,00 (original amount)
  4. Field 32A: USD49975,00 (net settlement)

§Validation Rules

  1. Currency format: Must be exactly 3 alphabetic characters
  2. Currency validity: Should be valid ISO 4217 code
  3. Amount format: Must follow SWIFT decimal format (comma separator)
  4. Amount value: Must be non-negative (zero allowed for certain scenarios)
  5. Precision: Should match currency-specific decimal place rules
  6. 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 USD
  • 50000.00 - USD 50,000 before $25 wire fee deduction
  • 25000.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

Source

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

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 code
  • raw_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");
Source

pub fn currency(&self) -> &str

Get the currency code

Returns the ISO 4217 currency code for the original instructed amount.

§Returns

Currency code as string slice

§Example
let field = Field33B::new("GBP", 25000.50).unwrap();
assert_eq!(field.currency(), "GBP");
Source

pub fn amount(&self) -> f64

Get the amount value

Returns the original instructed amount as a floating-point number.

§Returns

Amount as f64

§Example
let field = Field33B::new("USD", 75000.25).unwrap();
assert_eq!(field.amount(), 75000.25);
Source

pub fn raw_amount(&self) -> &str

Get the raw amount string

Returns the original amount string as received, preserving the exact formatting from the SWIFT message.

§Returns

Raw amount string

§Example
let field = Field33B::from_raw("EUR", "1000,50").unwrap();
assert_eq!(field.raw_amount(), "1000,50");
Source

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

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

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

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

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");
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 = 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");
Source

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

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

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"));

Trait Implementations§

Source§

impl Clone for Field33B

Source§

fn clone(&self) -> Field33B

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 Field33B

Source§

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

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

impl<'de> Deserialize<'de> for Field33B

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 Field33B

Source§

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

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

impl PartialEq for Field33B

Source§

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

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 Field33B

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 Field33B

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