Crate mt940

source ·
Expand description

A fast and strict MT940 parser.

Example

extern crate mt940;
use mt940::parse_mt940;

fn main() {
    let input = "\
        :20:3996-11-11111111\r\n\
        :25:DABADKKK/111111-11111111\r\n\
        :28C:00001/001\r\n\
        :60F:C090924EUR54484,04\r\n\
        :61:0909250925DR583,92NMSC1110030403010139//1234\r\n\
        :86:11100304030101391234\r\n\
        Beneficiary name\r\n\
        Something else\r\n\
        :61:0910010930DR62,60NCHGcustomer id//bank id\r\n\
        :86:Fees according to advice\r\n\
        :62F:C090930EUR53126,94\r\n\
        :64:C090930EUR53189,31\r\n\
        \r\n";

    let input_parsed = parse_mt940(input).unwrap();
    assert_eq!(input_parsed[0].transaction_ref_no, "3996-11-11111111");
}

Structs

Represents the currently available balance of an account.
Represents a balance of an account in between statements or at the start of a statement.
This is a generic struct that serves as a container for the first pass of the parser.
A pest parser for parsing a MT940 structure and fields.
A single, parsed MT940 message.
Error thrown if a required tag was not found.
A StatementLine holds information contained in tag :61: and tag :86:.
Error thrown when an unexpected tag was found.

Enums

Indiciates whether a transaction was Debit or Credit.
Like DebitOrCredit with additional reverse variants.
Error thrown when parsing fails.
Enum containing every SEPA-specified transaction type identification code.

Functions

Parse a MT940 statement to a list of its fields.
Parse and validate a MT940 statement.