pub struct SwiftMessage<T: SwiftMessageBody> {
pub basic_header: BasicHeader,
pub application_header: ApplicationHeader,
pub user_header: Option<UserHeader>,
pub trailer: Option<Trailer>,
pub message_type: String,
pub fields: T,
}
Expand description
Complete SWIFT message with headers and body
Fields§
§basic_header: BasicHeader
Basic Header (Block 1)
application_header: ApplicationHeader
Application Header (Block 2)
user_header: Option<UserHeader>
User Header (Block 3) - Optional
trailer: Option<Trailer>
Trailer (Block 5) - Optional
message_type: String
Message type identifier
fields: T
Parsed message body with typed fields
Implementations§
Source§impl<T: SwiftMessageBody> SwiftMessage<T>
impl<T: SwiftMessageBody> SwiftMessage<T>
Sourcepub fn has_reject_codes(&self) -> bool
pub fn has_reject_codes(&self) -> bool
Check if this message contains reject codes (MT103 specific)
Reject messages are identified by checking:
- Field 20 (Sender’s Reference) for “REJT” prefix
- Block 3 field 108 (MUR - Message User Reference) for “REJT”
- Field 72 (Sender to Receiver Information) containing
/REJT/
code
Sourcepub fn has_return_codes(&self) -> bool
pub fn has_return_codes(&self) -> bool
Check if this message contains return codes (MT103 specific)
Return messages are identified by checking:
- Field 20 (Sender’s Reference) for “RETN” prefix
- Block 3 field 108 (MUR - Message User Reference) for “RETN”
- Field 72 (Sender to Receiver Information) containing
/RETN/
code
pub fn is_cover_message(&self) -> bool
pub fn is_stp_message(&self) -> bool
Sourcepub fn validate_business_rules(&self) -> ValidationResult
pub fn validate_business_rules(&self) -> ValidationResult
Validate message against business rules using JSONLogic This validation method has access to both headers and message fields, allowing for comprehensive validation of MT103 and other message types.
pub fn to_mt_message(&self) -> String
Sourcepub fn sample() -> Selfwhere
T: SwiftMessageBody,
pub fn sample() -> Selfwhere
T: SwiftMessageBody,
Generate a sample SWIFT message with headers and message body Returns a complete message with all blocks including sample headers
Sourcepub fn sample_minimal() -> Selfwhere
T: SwiftMessageBody,
pub fn sample_minimal() -> Selfwhere
T: SwiftMessageBody,
Generate a minimal sample SWIFT message (mandatory fields only) Returns a complete message with headers and minimal field set
Sourcepub fn sample_full() -> Selfwhere
T: SwiftMessageBody,
pub fn sample_full() -> Selfwhere
T: SwiftMessageBody,
Generate a full sample SWIFT message (all fields populated) Returns a complete message with headers and all possible fields
Sourcepub fn sample_with_config(config: &MessageConfig) -> Selfwhere
T: SwiftMessageBody,
pub fn sample_with_config(config: &MessageConfig) -> Selfwhere
T: SwiftMessageBody,
Generate a sample SWIFT message with custom configuration Returns a complete message with headers and configurable field generation
Trait Implementations§
Source§impl<T: Clone + SwiftMessageBody> Clone for SwiftMessage<T>
impl<T: Clone + SwiftMessageBody> Clone for SwiftMessage<T>
Source§fn clone(&self) -> SwiftMessage<T>
fn clone(&self) -> SwiftMessage<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more