ofxparser icon indicating copy to clipboard operation
ofxparser copied to clipboard

Additional metadata on transactions

Open troygilbert opened this issue 7 years ago • 8 comments

The OFX file includes some additional details for each transaction that are not captured when parsing. Would it be possible to extract those fields or include a SimpleXMLElement referencing the whole transaction so that other tools could pluck them out as needed? This seems to be the most straightforward way to extend the library without having to build a more extensive system.

troygilbert avatar Jul 26 '18 16:07 troygilbert

What does the metadata look like exactly please?

asgrim avatar Jul 27 '18 05:07 asgrim

Unfortunately OFX/SGML files are not valid xml, so simply delegating to SimpleXML doesn't work. I do wish there were an SGML parser we could piggyback off of.

mkopinsky avatar Aug 05 '18 12:08 mkopinsky

This library does use SimpleXML, after bodging it up a bit, so it may be possible; though I'd rather have an explicit API for capturing metadata like this.

Do you have some anonymised sample data to show the structure of this metadata at all please?

asgrim avatar Aug 06 '18 07:08 asgrim

This is what I added to Ofx.php:231:

$transaction->cardNumber = (string)$t->CCACCTTO->ACCTID;

This represents the card number of the credit/debit card used for a specific transaction for accounts with multiple credit/debit cards.

I've not looked it up in any specifications, I just browsed the OFX file directly curious if the information was in there. ;-)

troygilbert avatar Aug 07 '18 15:08 troygilbert

Hmm - does the ACCTID in the (non-immediate) parent "credit account" node not already provide what you're looking for? - $creditAccount->accountNumber on L210 here

https://github.com/asgrim/ofxparser/blob/11f64bd269bc0842d89fba1a23833e0c56121a45/lib/OfxParser/Ofx.php#L200-L210

asgrim avatar Aug 07 '18 15:08 asgrim

It shows up there, but each transaction has the ID specified and they appear to be a mixture (as far as I can tell inspecting the resulting parsed data). (Wish I could provide some anonymized data, but I don't have the time to prepare that for you at the moment.)

troygilbert avatar Aug 07 '18 16:08 troygilbert

Hi James, I'm gonna send you some anonymized data via email -- not posting here in case I did a bad job of anonymizing! ;-)

troygilbert avatar Aug 07 '18 16:08 troygilbert

Thanks, received it; I'm not gonna be able to look at this for at least a couple months probably tho, got a lot of conferences/trips coming up I'm afraid :/

asgrim avatar Aug 08 '18 09:08 asgrim