Livo.MT940Parser 1.0.7

dotnet add package Livo.MT940Parser --version 1.0.7
NuGet\Install-Package Livo.MT940Parser -Version 1.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Livo.MT940Parser" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Livo.MT940Parser --version 1.0.7
#r "nuget: Livo.MT940Parser, 1.0.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Livo.MT940Parser as a Cake Addin
#addin nuget:?package=Livo.MT940Parser&version=1.0.7

// Install Livo.MT940Parser as a Cake Tool
#tool nuget:?package=Livo.MT940Parser&version=1.0.7

MT940 Parser

Parser for the SWIFT MT940 format that allows for adjustments for non-standard specificaitons of different banks.

Description

Project was created to be a part of another commercial application, LivoLink, and released as standalone open source library. We decided to do that, because no other open source parser was able to parse files from banks with specification slightly different then SWIFT specification and filling the details. This project tries to overcome that problem by implementing a library where users can provide their own logic of parsing particular tags and create parser for the whole file by mixing and matching parsers for particular tags.

How to use?

  1. Take an instance of class derived from Livo.MT940Parser.ReportParser.ReportParserBase.
  2. Call function Parse with string (mt940 file content) as an argument.
  3. Use collection of objects of type ReportStatement as you wish.

For example:

string mt940FileContent = File.ReadAllText("./report.txt");
var parser = new MBankCorporationParser(); // Implemented parser
ICollection<ReportStatement> statements = parser.Parse(mt940FileContent);

How to write my own parser?

  1. Create new class that inherits from Livo.MT940Parser.ReportParser.ReportParserBase.
  2. Override functions ContainsHeadersAndTrailers and SplitIntoSingleStatements (or leave default implementation, if header and trailer of the statement is simple constant string - thay are passed in the constructor).
  3. Override functions parsing particular tags: ParseTagX. All of those functions have 2 arguments - ReportCommand which contains tag and all te data, and ReportStatement which tag parser should modify.
  4. Not overrided tags by default do nothing.

Which tags can I override?

There are functions ParseTagX for tags (replace X with them): 20, 21, 25, 28, 28C, 60a, 60m, 60F, 60M, 61, 62a, 62m, 62F, 62M, 64, 65, 86.

Preimplemented elements

Report parsers:

  • Livo.MT940Parser.ReportParser.SWIFTReportParser - class derived from ReportParserBase with all tags matched to tags from SWIFTTagParser (all variations of a tag are using the same tag parser). It is a nice base for parsers that are generally following the standard but have only small differences or need additional work for example in tag 86.
  • Livo.MT940Parser.ReportParser.MBank.MBankCorporationParser - parser (derived from SWIFTReportParser) which implements MBank for corporations and MSP standard (ie. switches transaction type to concrete MBank defined type and fills details of the transaction from most of those types).
  • Livo.MT940Parser.ReportParser.PekaoBP.PekaoBPParser - parser (derived from SWIFTReportParser) which implements PKO BP standard (ie. fills details of the transaction). Note that this parser should work with multiple banks (at least in Poland) sice it does things in the most popular way.
  • Livo.MT940Parser.ReportParser.PekaoBP.INGParser - parser (derived from SWIFTReportParser) which implements ING standard (ie. fills details of the transaction).
  • Livo.MT940Parser.ReportParser.NestBank.NestBankParser - parser (derived from SWIFTReportParser) which fills details of the transaction based on analyzed statements (no documentation was found).
  • Livo.MT940Parser.ReportParser.PekaoSA.PekaoSAParser - parser (derived from SWIFTReportParser) which fills details of the transaction based on analyzed statements (found documentation did not match statements that we received to analyze).

Tag parsers:

  • Livo.MT940Parser.ReportParser.TagParser.SWIFTTagParser - static class containing parsers for tags 20, 21, 25, 28, 60, 61, 62, 64, 65, 86 according to this description of SWIFT format.

Additional elements:

  • Livo.MT940Parser.UtilityParser.BalanceParser - static class containing parsers to class Balance, with purpose of being used in tags 60, 62, 64 and 65.
  • Livo.MT940Parser.UtilityParser.TransactionParser - static class containing parsers to class Transaction, with purpose of being used in tag 61.

Changelog

  • 1.0.0 to 1.0.2 - Initial release and hot fixes.
  • 1.0.3 - Added PKO BP parser.
  • 1.0.4 - Added ING parser.
  • 1.0.5 - Added Nest Bank parser.
  • 1.0.6 - Fixed leap year bug.
  • 1.0.7 - Added PekaoSA parser.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.7 528 4/4/2024