Expand description
ISO 20022 financial message toolkit.
mx20022 is an umbrella crate that re-exports the four workspace
components needed to read, write, validate, and translate
ISO 20022 messages and SWIFT MT messages:
model— strongly-typed message structs generated from the official XSD schemas (pacs,pain,camt,head).parse— XML deserialization, serialization, and envelope message-type detection.validate— field-level rule, schema, and scheme (FedNow/ SEPA / CBPR+) validation.translate— bidirectional MT ↔ MX translation for the supported message pairs (MT103 ↔ pacs.008, MT202 ↔ pacs.009, MT940 ↔ camt.053).
See the per-crate docs for full API surface; the prelude re-exports
the items most users need for typical workflows.
§Quick start: parse an ISO 20022 XML message
use mx20022::prelude::*;
use mx20022::model::generated::pacs::pacs_008_001_13::Document;
let xml = r#"<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.13"></Document>"#;
let id = detect_message_type(xml).unwrap();
assert_eq!(id.family, "pacs");
assert_eq!(id.msg_id, "008");
assert_eq!(id.version, "13");§Quick start: translate MT103 to pacs.008
use mx20022::prelude::*;
let raw = "\
{1:F01BANKBEBBAXXX0000000000}\
{2:I103BANKDEFFXXXXN}\
{3:{108:MYREF}}\
{4:\n\
:20:REF123\n\
:23B:CRED\n\
:32A:230615EUR1000,00\n\
:50K:ACME CORP\n\
:59:JANE SMITH\n\
:71A:SHA\n\
-}\
{5:{CHK:ABCDEF1234}}";
let mt = mt::parse(raw).unwrap();
let mt103 = mt::fields::mt103::parse_mt103(&mt.block4).unwrap();
let result = mt103_to_pacs008(&mt103, "MSG-1", "2023-06-15T10:00:00").unwrap();
assert!(result.warnings.is_empty() || !result.warnings.is_empty());§Quick start: validate a single field
use mx20022::prelude::*;
let registry = RuleRegistry::with_defaults();
let errors = registry.validate_field(
"GB82WEST12345698765432",
"/Document/CdtTrfTxInf/CdtrAcct/Id/IBAN",
&["IBAN_CHECK"],
);
assert!(errors.is_empty());Re-exports§
pub use mx20022_model as model;pub use mx20022_parse as parse;pub use mx20022_translate as translate;pub use mx20022_validate as validate;
Modules§
- prelude
- Curated re-exports for typical workflows.