Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple statements in a single MT940 #52

Closed
AlexandreGalois opened this issue Nov 17, 2017 · 8 comments
Closed

Multiple statements in a single MT940 #52

AlexandreGalois opened this issue Nov 17, 2017 · 8 comments

Comments

@AlexandreGalois
Copy link

Potentially not an issue: when exporting mt940 from several business accounts it will deliver blocks separated by an empty line with just '-'. Using mt940.parse(file) on these exported files will correctly yield a list of all transactions, but only the opening and closing balance of the last statement.

I am not sure if this was intentional, but ideally a list of MT940 statements, each containing opening/closing balance and transactions is produced (e.g. similar to in the CAMT.053 format).

Is this desirable?

@wolph
Copy link
Owner

wolph commented Nov 17, 2017

To be honest, I wasn't aware that the empty line with the - meant a different account.

Modifying the parser to yield multiple transaction collections isn't all that trivial but it shouldn't be too hard to wrap it so the lines are parsed separately. I currently don't have the time to implement it so I'll leave it open until I have time to dig into it :)

@AlexandreGalois
Copy link
Author

AlexandreGalois commented Nov 17, 2017

As far as I can tell from the files I have here; the '-; separates statements. Each statement has an opening/closing (or intermediate opening/closing) balance and could technically have a different account. I will verify whether the latter happens in practice. I know that CAMT.053 files with ING Bank can contain multiple account statements in a single file, and that RABO MT940 used to contain multiple accounts.

I think the solution would be to:

  • split the mt940 file along the '\n-\n' first
  • parse each statement separately (works fine)
  • merge statements that are split over multiple records (?)
  • ensure statements of different accounts do not get mixed up

If I have some spare time I'll pick up on this; I can share some example files once I have fully anonymised them.

@p-baum
Copy link

p-baum commented Sep 30, 2018

I also have this problem. Hows the fix coming on?

For now I have inserted the following at line 449 in models.py as a fixup:

if 'final_opening_balance' in self.data and 'final_opening_balance' in result:
    del result['final_opening_balance']

Statements all begin with:

:20:STARTUMS
:25:12345678/12345
:28C:0
:60F:C180927EUR4094,22

and end with:

:62F:C180926EUR4094,22
-

the - doesnt mean a new account. The bank just splits the statement into multiple parts for some reason. Completely unnecessary in my opinion and think it would be fine to just join them in your code somehow while preserving the first opening balance. Maybe even a preliminary parse to strip out the unnecessary separations.

@p-baum
Copy link

p-baum commented Sep 30, 2018

I also speak a bit of german so if you need help with the specifications at https://hbci-zka.de/spec/3_0.htm , let me know.

@jcpsantiago
Copy link

is this still being worked on? I have to parse some statements with this format

@wolph
Copy link
Owner

wolph commented Dec 6, 2018

I guess Alexandre is not working on it anymore. If anyone has an example file for me with a bit of explanation what kind of results they're expecting, I can see if I can fix it.

It will take a few weeks for me to get started though, I've been really busy lately.

@stale
Copy link

stale bot commented Feb 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 15, 2019
@stale stale bot closed this as completed Feb 22, 2019
@Saivivek-Peddi
Copy link

I guess Alexandre is not working on it anymore. If anyone has an example file for me with a bit of explanation what kind of results they're expecting, I can see if I can fix it.

It will take a few weeks for me to get started though, I've been really busy lately.

In a single MT940 file there are multiple statements.
For Eg. See the following rpt file -: The first 25 tag has 447000333333, but the second 25 tag has 447009999739. So, ideally, the output of the file should have two "Account_Identification" tags. But it takes only the latest as the tag, i.e. 447009999739.
The ideally expected output is with two different transactions with different "Account_Identification" tags

{1:F0XXXXXXXXXXXXXXXX}{2:OXXXXXXXXXXXXXXX}{3:{108:00000000002170}}{4:
:20:19071103fr407579
:25:44700333333
:28C:51
:60F:D190710HKD0,39
:62F:D190710HKD0,39
:64:D190710HKD0,39
-}{5:{C:eeeee}{MAC:MccD}}
{1:F01SCBLHKHHXXXX0039100003}{2:O9400800190711SCBLHKHHXX33445500031907110800N}{3:{108:00000000002170}}{4:
:20:19071103fr407579
:25:447009999739
:28C:51
:60F:D190710USD4,34
:61:1907100720CD4,33N207NONREF
:86:STS- MNssddtt
:62F:D190710USD0,01
:64:D190710USD0,01
-}{5:{C:eeeee}{MAC:MccD}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants