ofxparser icon indicating copy to clipboard operation
ofxparser copied to clipboard

Needs to be able to handle multiple items on one line in the xml

Open jacques opened this issue 8 years ago • 9 comments

FNB seem to lump transactions items onto one line which only passes the memo to the buildTransactions function.

Snippet from the OFX file:

 <STMTTRN>
<TRNTYPE>CREDIT<DTPOSTED>20170106<TRNAMT>10.00<FITID>201701063<CHECKNUM>0000000000<MEMO>ADT CASH DEPOSIT      49120010998 JM       49120010998 JM
 </STMTTRN>
 <STMTTRN>
<TRNTYPE>CREDIT<DTPOSTED>20170106<TRNAMT>10.00<FITID>201701064<CHECKNUM>0000000000<MEMO>CASH DEPOSIT LONG ST  4912001098 JM TEST 2 4912001098 JM TEST 2
 </STMTTRN>

jacques avatar Jan 06 '17 17:01 jacques

Pull request arriving shortly for this.

jacques avatar Jan 06 '17 17:01 jacques

Pushed a pull request for this. This fixes the issue I have but two more files in the test suite fails. Is there a better way of detecting this and performing the fix if only one element is showing in the xml for a statement transaction?

jacques avatar Jan 06 '17 21:01 jacques

Most likely need to support multiple different versions of the OFX spec?

It may be useful to borrow the fixtures from the python ofxparse library and test against them all? See https://github.com/jseutter/ofxparse/blob/master/tests/fixtures/

jacques avatar Jan 16 '17 20:01 jacques

I'm running into either this or a similar issue. My OFX file (from Ally Bank) had only a single line of SGML, and with 1.2.1 of ofxparser, it looks like \OfxParser\Parser::loadFromString() is adding extra closing tags when trying to convert to XML.

Looking at the first part of the SGML only: $this->conditionallyAddNewlines($ofxContent); turns the SGML into

<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
</CODE>
<SEVERITY>INFO
</SEVERITY>
</STATUS>

, and then convertSgmlToXml() adds a closing tag to line 5 and 7 so it becomes

<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0</CODE>
</CODE>
<SEVERITY>INFO</SEVERITY>
</SEVERITY>
</STATUS>

mkopinsky avatar Feb 12 '18 02:02 mkopinsky

Dang, it amazes me how different they all are >.< Thanks for the report; being brutally honest, this probably isn't going to be something I can look into for a bit; I don't have any current projects depending on this so I can't really rework it. I did have a potential client who this library would've been useful for, but sadly it fell through. If I find time... :)

asgrim avatar Feb 13 '18 09:02 asgrim

I have a personal dream of building a personal finance app, replacing my janky Excel pivot table process. I assumed I'd be importing CSV files from the banks, but if I can import the Quicken files that would be better. I tried to hack at this a bit last night, but didn't find a solution. I still hope to find a solution and open a PR. The good news is that the tests are good, so I can fairly confidently change things.

mkopinsky avatar Feb 13 '18 16:02 mkopinsky

PRs with tests are more than welcome! I really do want to find time to update this, fix the weird janky cases to have some kind of expected consistency. Also min PHP 7.2, things like that so we can use new language features etc.

asgrim avatar Feb 13 '18 17:02 asgrim

I was trying to solve this issue too and have progress today. I'm testing a bit more and soon open a PR.

beroso avatar Feb 14 '18 00:02 beroso

cat you review and merge this PR ?? very annoying bug :-/

olaulau avatar Aug 27 '19 00:08 olaulau