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

BN Paribas MT940 #10

Closed
krzcho opened this issue Jun 10, 2016 · 3 comments
Closed

BN Paribas MT940 #10

krzcho opened this issue Jun 10, 2016 · 3 comments

Comments

@krzcho
Copy link

krzcho commented Jun 10, 2016

they add some header lines in front of each statements
I am not sure I am allowed to attach file here
It is not possible to cover it by line parser as there is no :tag: here

1601 25V3241A1XAXXX00001
0000 30BMCIMAMCXXXX00001
940 02
:20:BMCI
...

first idea is to prefix file contents with "\r\n-\r\n" and use such /\r?\n-\r?\n([^:].*\r?\n)+/m statements separator which should consume this header but I still get wrong line format...

@bumi
Copy link
Contributor

bumi commented Jun 10, 2016

thanks for reporting that.
Do you know if these header lines are default SWIFT MT940 headers? they look actually different.
(for SWIFT headers I have created issue #9 )
What would you expect CMXL to do? are the headers somehow relevant information?

If not we could just strip everything before the first proper tag. This would also solve #8

What do you think?

@krzcho
Copy link
Author

krzcho commented Jun 10, 2016

I do not know whether they are default and I do not think they are relevant
I have solved it as mentioned above:
I prefix file with "\r\n-\r\n" and make /\r?\n-\r?\n(?:[^:].*\r?\n)+/m statements separator which consumes those header lines (reg exp should not contain matching groups so they are not returned from data.split)
(I am not totally sure whether \r? are needed in the regexp)

@krzcho krzcho closed this as completed Jun 10, 2016
@bumi
Copy link
Contributor

bumi commented Jun 10, 2016

from our experience the separator depends on the bank and that's why it is easily configurable with a default that matched most of the statements we have had so far. (including the \r)

so your regex basically ignores anything until the first real tag, right?
we could add this as an option - something like Cmxl.config[:strip_statement_headers] = true

A PR would be appreciated or if you want to add your solution as a note to the readme or wiki, that would be awesome and helps the next person.

thanks

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

No branches or pull requests

2 participants