MX Message - ISO20022 Parser Library
A Rust library for parsing, validating, and serializing ISO20022 financial messages, with initial support for pacs.008 (FI to FI Customer Credit Transfer) messages.
Features
- Full pacs.008.001.13 Support: Complete implementation of the FI to FI Customer Credit Transfer message format
- Validation: Built-in validation for all message fields according to ISO20022 specifications
- Serialization: Support for JSON and XML serialization/deserialization using serde
- Type Safety: Strongly typed Rust structures for all message components
- Error Handling: Comprehensive error reporting with specific validation codes
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
= "1.0" # For JSON serialization
= { = "0.31", = ["serialize"] } # For XML serialization
Quick Start
Creating a pacs.008 Message
use Document;
use *;
Validation
use Document;
JSON Serialization
use serde_json;
XML Serialization
use to_string as xml_to_string;
use from_str as xml_from_str;
Examples
Run the included examples to see the library in action:
# Basic pacs.008 message creation and validation
# XML serialization demonstration
Validation
The library provides comprehensive validation including:
- Field Length Validation: Ensures all fields meet minimum and maximum length requirements
- Pattern Validation: Validates formats like IBAN, BIC codes, and numeric patterns
- Required Field Validation: Ensures all mandatory fields are present
- Business Rule Validation: Implements ISO20022 business rules
Validation Error Codes
1001: Field is shorter than minimum length1002: Field exceeds maximum length1005: Field does not match required pattern9999: Unknown document type
Testing
Run the test suite:
# Run all tests
# Run with output
# Run specific test
Supported Message Types
Currently supported:
- pacs.008.001.13: FI to FI Customer Credit Transfer
Planned support:
- pacs.002: FI to FI Payment Status Report
- pacs.004: Payment Return
- pain.001: Customer Credit Transfer Initiation
- pain.002: Customer Payment Status Report
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Acknowledgments
This library implements the ISO20022 standard as defined by the International Organization for Standardization (ISO).