aboutsummaryrefslogtreecommitdiffstats
path: root/lib/warden-core/src/iso20022.rs
blob: 436ee2f576595f6fa155cb3491a90d6f3da2bba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#[derive(Debug)]
pub enum TransactionType {
    PACS008,
    PACS002,
}

impl std::fmt::Display for TransactionType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "{}",
            match self {
                TransactionType::PACS002 => "pacs.002.001.12",
                TransactionType::PACS008 => "pacs.008.001.12",
            }
        )
    }
}

/// pacs.008.001.12
pub mod pacs008 {
    tonic::include_proto!("iso20022.pacs008");
}

/// pacs.002.001.12
pub mod pacs002 {
    tonic::include_proto!("iso20022.pacs002");
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn display_pacs008() {
        let t = TransactionType::PACS008;
        assert_eq!(t.to_string(), "pacs.008.001.12");
    }

    #[test]
    fn display_pacs002() {
        let t = TransactionType::PACS002;
        assert_eq!(t.to_string(), "pacs.002.001.12");
    }
}