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

Field 61: Statement Line cannot parse transactions of type 'S' #38

Closed
bkues3 opened this issue Nov 26, 2019 · 2 comments
Closed

Field 61: Statement Line cannot parse transactions of type 'S' #38

bkues3 opened this issue Nov 26, 2019 · 2 comments

Comments

@bkues3
Copy link
Contributor

bkues3 commented Nov 26, 2019

There are three acceptable codes for transaction type ('S', 'N', and 'F') in Field 61 of MT940, but the parser in Cmxl::Fields::Transaction only handles two of them ('N' and 'F').

See this link for more information about the acceptable codes.

I believe this issue can be resolved simply by adding this missing third letter to the swift_code group of the regex, so that it becomes as follows.

%r{^(?<date>\d{6})(?<entry_date>\d{4})?(?<storno_flag>R?)(?<funds_code>[CD]{1})(?<currency_letter>[a-zA-Z])?(?<amount>\d{1,12},\d{0,2})(?<swift_code>(?:S|N|F).{3})(?<reference>NONREF|(.(?!\/\/)){,16}([^\/]){,1})((?:\/\/)(?<bank_reference>[^\n]{,16}))?((?:\n)(?<supplementary>.{,34}))?$}

Here is an example line that is not currently handled correctly.

:61:1911181118CR653,00S445328556-76501096
@bumi
Copy link
Contributor

bumi commented Dec 17, 2019

Thanks for reporting this and the link.
A pull request for this is very welcome. Can you add the suggested change and include a test case with the example data that you've seen?

@bkues3
Copy link
Contributor Author

bkues3 commented Jan 7, 2020

Pull request #42 has been created to resolve this issue.

@bumi bumi closed this as completed Jul 10, 2020
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