swift_mt_message/messages/
mt202.rs

1use crate::{SwiftMessage, fields::*};
2use serde::{Deserialize, Serialize};
3
4/// MT202: General Financial Institution Transfer
5///
6/// This message type is used by financial institutions to transfer funds
7/// for their own account or for account of a customer to a receiving institution.
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, SwiftMessage)]
9#[swift_message(mt = "202")]
10pub struct MT202 {
11    /// Field 20: Transaction Reference
12    #[field("20")]
13    pub field_20: Field20,
14
15    /// Field 32A: Value Date, Currency Code, Amount
16    #[field("32A")]
17    pub field_32a: Field32A,
18}
19
20impl MT202 {
21    /// Create a new MT202 with the given fields
22    pub fn new(field_20: Field20, field_32a: Field32A) -> Self {
23        Self {
24            field_20,
25            field_32a,
26        }
27    }
28
29    /// Get the transaction reference
30    pub fn transaction_reference(&self) -> &str {
31        self.field_20.transaction_reference()
32    }
33
34    /// Get the currency code
35    pub fn currency_code(&self) -> &str {
36        self.field_32a.currency_code()
37    }
38}