Comments (6)
@wolph These are the tests reproducing this error: sq9mev@0209467
I'm not sure, but seems like empty transaction is unconditionally appended in https://github.com/WoLpH/mt940/blob/develop/mt940/models.py#L338
Removing that line causes many tests fails.
Seems like the same error is present v 4.3.
from mt940.
@wolph, here's proposed solution: sq9mev@f1896f6#diff-505920b44ddd6be1f840afac6c9c5f8a
It requires some tests to be changed (excess transaction is absent now, so must be removed in expected), but i have a problem with one of them:
sq9mev@f1896f6#diff-e1163247336b0e8a403f42a707358166
Single 86 line will not be parsed, because of https://github.com/sq9mev/mt940/blob/f1896f6001c8451c40f7edddb658dd7246d8cf1b/mt940/models.py#L372. Test data could be extended with some 61 line, but this raises further questions: how much loose should the parsing be? It probably depends on usecase…
What do you think?
from mt940.
They state 61 is optional, but 86 requires 61 (rule C1):
C1
If field 86 is present in any occurrence of the repetitive sequence, it must be preceded by a field 61. In addition, if field 86 is present, it must be present on the same page (message) of the statement as the related field 61 (Error code(s): C24)
https://www2.swift.com/uhbonline/books/public/en_uk/us9m_20160722/htframe.htm →
MT 940 Customer Statement Message → MT 940 Network Validated Rules
From this perspective, my solutions seems to be correct (at least for mt940), but I'm not sure whether it is consistent with the assumptions of the library.
Meaning of 86 in mt942 is conditional:
C3
If field 86 is present in any occurrence of the repetitive sequence, it must be preceded by a field 61 except if that field 86 is the last field in the message, then field 61 is optional. In addition, if field 86 is present, it must be on the same page (message) of the statement as the related field 61 (Error code(s): C24).
If the field 86 is the last field in the message and it is immediately preceded by field 61, then that field 86 is considered to provide information about the preceding field 61; otherwise the field 86 is considered to provide information about the message as a whole.
https://www2.swift.com/uhbonline/books/public/en_uk/us9m_20160722/htframe.htm →
MT 942 Interim Transaction Report → MT 942 Network Validated Rules
I feel like I've opened Pandora's box.
from mt940.
The proposed solution looks like a good solution but I'm not really sure if there is a good solution for this problem. Since I initially created this library I have noticed that few banks actually adhere to the standard and most simply approximate it.
The currently defined scopes (Transaction
and Transactions
) are too limited for full mt942 support and we'd need at least a 3rd level (page) in between. I'm just not sure if it's worth the effort :P
from mt940.
I think it's not worth effort ;), however if you think its goot solution for excess transaction problem i'll make PR - one may depend on len transactions.transactions when processin parsed transactions, this was my case.
from mt940.
It's really a matter of opinion with this issue, some will like the new solution and others won't. I personally think the new version is better :)
Thanks for the fix!
from mt940.
Related Issues (20)
- AttributeError: module 'mt940' has no attribute 'parse' HOT 5
- Transaction Reference Number is not returned by the parser HOT 5
- Missing essential documentation for Transaction fields. HOT 2
- Dropping Transaction Data? HOT 1
- Don't install `tests` as a global python package HOT 4
- Parse GV codes when purpose does not start with GV codes HOT 2
- Encoding issue HOT 2
- The ASN bank MT940 file can not be parsed for tag 61 HOT 1
- Opening Balance HOT 4
- Parsing transactions : key 64 HOT 8
- Multiple accounts in one file HOT 7
- Parser doesn't show running balance or opening/closing balance at transaction level HOT 2
- Status and Fund code , when Currency ends with a D HOT 2
- Getting only single account data instead of multiple accounts HOT 1
- Non-numeric statement number HOT 2
- Exporting to tabular format HOT 1
- cannot run for citibank? HOT 1
- Single "account_identification" field HOT 2
- Statement line is parsed incorrectly for customer/bank reference HOT 2
- MT940 Issues parsing with :61: HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mt940.