Code Monkey home page Code Monkey logo

mjebrahimi / sharpmt940lib.core Goto Github PK

View Code? Open in Web Editor NEW
25.0 5.0 18.0 1.37 MB

SharpMT940Lib implements the MT940 format in C# and is based on specifications of multiple banks. You can use it as a base for financial software or for conversions to other formats like CSV or OFX.

License: MIT License

PowerShell 3.52% C# 88.95% Smalltalk 4.05% Batchfile 0.23% F# 3.25%
mt940 statement rabobank abnamro financial finance accounting bank banks banking

sharpmt940lib.core's Introduction

NuGet License: MIT Build Status

SharpMT940Lib.Core

SharpMt940Lib.Core is an unofficial port of the Raptorious.Finance.Swift.Mt940 library to .NET Core.

What is it?

SharpMT940Lib implements the MT940 format in C# based on specifications by ABN AMRO. You can use it as a base for financial software or for conversions to other formats like CSV or OFX.

Like many other banks ABN AMRO gives customers the possibility to download financial transactions to this format. I wanted to use this export format to manage my personal finance. So I search for different solutions to import this file format. Most (free) software I evaluated couldn’t directly import the format, you had to convert it to something else first, such as OFX.

Since I couldn’t find an application that didn’t precisely do what I wanted I decided to write my own. But first I needed a library to read the MT940 format.

MT940 Customer Statement Message is a plain text financial format standardized by SWIFT. Banks use this format to export to financial packages can use this for their process.

You can find more information (in dutch) at the following places:

Download

You can get the prerelease package by using nuget. For changes checkout the changelog

Are you missing a feature or is it broken?

Please contact me or leave a reply if you are missing a feature or when you run into a bug. If I know about it, then I can fix it. You can report them at the issue tracker. Please note I work alone at this project, so fixes sometimes might take some time.

Also I do not have access to every MT940 format. Different banks can have different headers and footers, the AbnAmro class might work for your file also. If it does or does not, please let me know so I can improve the code.

Author

Jaco Adriaansen (@raptux)

Momamad Javad Ebrahimi

License

SharpMT940Lib has been given an MIT license. This is an open source approved license. You can use the library freely in both open source software and commercial software.

sharpmt940lib.core's People

Contributors

dependabot-preview[bot] avatar mjebrahimi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sharpmt940lib.core's Issues

The last transaction is not added when the file is ended with :62M

We are using the library to parse multiple MT950 files. Each file contains one AccountStatement. The last transaction is not added to the list when the file is ended with :62M. The last transaction is added to the list wien the file is ended with :62F.

We think that the problem is in the Mt940Parser.cs row number 291. The addAndNullTransactionIfPresent() is not being called for :62M.

Is it possible to fix this and create a new NuGet package? thank you.

Write mt940?

Can this library also be used to write mt940 files?

I am trying to convert from a CSV -> .940

Unix LF to Windows LF

There are banks that export the file from a unix based system which exports the file with Unix LF instead of Windows LF.

There is a fix of course to replace the line endings from \n to \r\n before putting it into the parser but maybe there is or could be a better way?

Parser fails when transaction string contains amount without decimal separator

Given statement with the following line
:61:2012031203CR20NMSCVS0015060871
the parser throws
System.Data.InvalidExpressionException: '2012031203CR20NMSCVS0015060871'

I narrowed it down to the fact that the amount in this case does not contain the decimal separator.

As seen in the regex, the decimal separator is expected. (?<ammount>\d*[,.]\d{0,2})

var regex = new Regex(@"^(?<valuedate>(?<year>\d{2})(?<month>\d{2})(?<day>\d{2}))(?<entrydate>(?<entrymonth>\d{2})(?<entryday>\d{2}))?(?<creditdebit>C|D|RC|RD)(?<fundscode>[A-z]{0,1}?)(?<ammount>\d*[,.]\d{0,2})(?<transactiontype>[\w\s]{4})(?<reference>[\s\w]{0,16})(?:(?<servicingreference>//[\s\w]{0,16}))*(?<supplementary>\r\n[\s\w]{0,34})*");

In the PR, you can see two changes to the regex:

  1. removed '?' from the 'fundscode' group
  2. added {0,1} to the 'ammount' group

Simply adding {0,1} to the 'ammount' group did not help, I also had to remove the '?' from the 'fundscode' group.

#11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.