Livo.MT940Parser
1.0.9
dotnet add package Livo.MT940Parser --version 1.0.9
NuGet\Install-Package Livo.MT940Parser -Version 1.0.9
<PackageReference Include="Livo.MT940Parser" Version="1.0.9" />
paket add Livo.MT940Parser --version 1.0.9
#r "nuget: Livo.MT940Parser, 1.0.9"
// Install Livo.MT940Parser as a Cake Addin #addin nuget:?package=Livo.MT940Parser&version=1.0.9 // Install Livo.MT940Parser as a Cake Tool #tool nuget:?package=Livo.MT940Parser&version=1.0.9
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?
- Take an instance of class derived from
Livo.MT940Parser.ReportParser.ReportParserBase
. - Call function
Parse
with string (mt940 file content) as an argument. - 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?
- Create new class that inherits from
Livo.MT940Parser.ReportParser.ReportParserBase
. - Override functions
ContainsHeadersAndTrailers
andSplitIntoSingleStatements
(or leave default implementation, if header and trailer of the statement is simple constant string - thay are passed in the constructor). - Override functions parsing particular tags:
ParseTagX
. All of those functions have 2 arguments -ReportCommand
which contains tag and all te data, andReportStatement
which tag parser should modify. - 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 fromReportParserBase
with all tags matched to tags fromSWIFTTagParser
(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 fromSWIFTReportParser
) 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 fromSWIFTReportParser
) 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 fromSWIFTReportParser
) which implements ING standard (ie. fills details of the transaction).Livo.MT940Parser.ReportParser.NestBank.NestBankParser
- parser (derived fromSWIFTReportParser
) which fills details of the transaction based on analyzed statements (no documentation was found).Livo.MT940Parser.ReportParser.PekaoSA.PekaoSAParser
- parser (derived fromSWIFTReportParser
) 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 tags20, 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 classBalance
, with purpose of being used in tags60
,62
,64
and65
.Livo.MT940Parser.UtilityParser.TransactionParser
- static class containing parsers to classTransaction
, with purpose of being used in tag61
.
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.
- 1.0.8 - Allow non-standard tag 61 transaction parser, fixed Nest Bank parser which uses non-standard tag 61 transactions sometimes.
Product | Versions 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. |
-
.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.9 | 1,602 | 5/9/2024 |