Closed nickidk4 closed 5 years ago
Could you give another example. Seems this is obfuscated too much. e.g. the 3rd tag 61 has "X" in place of Debit/credit marker. And the total of transactions does not match the whole statement turnover. Sorry I just don't have time for deciphering of over-edited examples ;)
The best if you can give an example which can be copy pasted to a text file and then check with cli (node cli.js <path to file>
) and it gives the error you mention
Hey a-fas, is there any way I can send a less obfuscated version to you directly instead of posting it here online? :)
I updated the swift message in previous post, and it seems to be able to throw expected error. Hope you can look into this :)
This should be something with 86 field structure ... Can you post here a couple of 86 tags from the above statement. You can obfuscate the data but keep the tags ! e.g this one
:86: /XXXX//100924006010 XXXXXXXXXXXXX XXXXXXXX XXXXXX XX (XXXX)
/XXXX/XXXXXXXXXXXXX XXXXXXXX XXXXXX XX (XXXX) (XXXXXX: XXX X
/XXXX/XXXXXXXXXXX XXX XXX: 03MT181012182288
XXXX XXX: 181012671 M CA O/XXXXXX22
BIC:XXXXXX22
Keep the values in /xxxx/
and all other which look like meta data, e.g. very strange that some parts look like XXX:
- they are supposed to be tags ? but the structure must be in /xxxx/
... probably they are not supposed to be parseable in standard.
So please give some samples of those, but try to pad only sensitive info keeping the meta data
I tried making a less obfuscated version of one of the above tags, so you can see the structure. Will try pasting more examples that fails.
:86: /XXXX//100924006010 XXXXXXXXXXXXX XXXXXXXX XXXXXX AB (PUBL)
/ORDP/XXXXXXXXXXXXX XXXXXXXX BANKEN AB (PUBL) (FORMER: SXB A
/REMI/XXXXXXXXXXX OUR REF: 03MT181012182288
YOUR REF: 181012671 M CA O/XXXXDK22
BIC:XXXXDK22
These transactions fail too
:61:181024C7020,26NTRFP6363103 240 1//03MT181024144353
:86: /XXXX//100924006010 XXXXXXXXXXXXX XXXXXXXX XXXXXX AB (PUBL)
/ORDP/XX XXXXXX XXXXX XXXX N.A.25 XXXX XXXXX, CANARY WHARF
/REMI/UBERWEISUNG OUR REF: 03MT181024144353
YOUR REF: P6363103 240 1 M CA O/XXXXGB2L
/ACC/INST/XXXXGB2L /6231400604
BIC:XXXXGB2L
:61:180924C6966,40NTRFP2917104 240 1//03MT180924148962
:86: /XXXX//100924006010 XXXXXXXXXXXXX XXXXXXXX XXXXXX AB (PUBL)
/ORDP/XX XXXXXX XXXXX BANK N.A.25 XXXX XXXXX, XXXXXX XXXXX
/REMI/XXXXXXXXXXX OUR REF: 03MT180924148962
YOUR REF: P2917104 240 1 M CA O/XXXXGB2L
/ACC/INST/CHASGB2L /6231400604
BIC:XXXXGB2L
I don't really know what the function _detectDetailStructure(transaction) does, but I tried returning transaction imediately as first line in function, and I get no errors, and it looks like i get the tag 86 field returned as I require. So maybe this is the solution for me? :)
it tries to find the structure tags and parse them ... your first example actually works for me (hmm??) but the second does not, let's focus on it
/XXXX//100924006010 XXXXXXXXXXXXX XXXXXXXX XXXXXX AB (PUBL)
/ORDP/XX XXXXXX XXXXX XXXX N.A.25 XXXX XXXXX, CANARY WHARF
/REMI/UBERWEISUNG OUR REF: 03MT181024144353
YOUR REF: P6363103 240 1 M CA O/XXXXGB2L
/ACC/INST/XXXXGB2L /6231400604
BIC:XXXXGB2L
So the issue is in this part /ACC/INST/
. Both are identified as internal structure tags, but the first one is incomplete. So there is some bug with regex. But now I have a question: do I understand correctly that the real tag is ACC
? And the rest INST/XXXXGB2L /6231400604\nBIC:XXXXGB2L
is actually it's content ? At least that is how I would understand it from spec perspective
I don't really know. I'm no swift expert :D
I don't need to destructure tag 86, I only need to save everything in tag 86 in a database. So this is why returning transactions immediately works fine for me.
I thought tag 86 was just additional content and could be 6 lines at 65 chars each with no restrictions.
I see, well this a subject for a feature :)
I added a constructor param no86Structure
so you can disable structure parsing. See the commit above.
pls check the latest master.
But I'll publish later, I want to fix the issue with that tag first, at least in my understanding
should be fixed now in master, pls try, if OK, I'll publish
Works great!
published 1.3.1 :)
I have a swift that fails in _detectDetailStructure(transaction) with the error Cannot read property '1' of null
Error happens in this line: parser.js:343 .map(m => [ m[1].replace(stripPrefixRe, ''), m[2] ]) // remove prefix symbols from tag
I don't know how to fix this, and have included swift below. Hope you can recreate the same error ::)
parser.js:313
Edited swift