Support brain-damaged OFX usage of NAME and MEMO

Lucas Bergman's Avatar

Lucas Bergman

21 Jun, 2012 12:22 AM

My bank (JPMorgan Chase) gives me OFX files that contain stanzas like this:

<NAME>Online Payment NNNNNNNNNN To Ban
<MEMO>k of America

The NAME field contains the first 32 characters of data, and the MEMO field contains the rest (presumably up to 255 characters or whatever asinine, arbitrary limit was imposed by the OFX pseudo-standard).

Really these two fields, concatenated, contain the same data: the payee plus some opaque gobbledygook; there is no reliable way to pull them apart. I googled around and found similar bugs reported against other finance software, so it seems that Chase isn't the only bank that uses this hack to get around the 32-character limit on NAME.

Would it be possible to have an option to mark a bank as being this type so that downloaded transactions will just consider NAME+MEMO as one field? I am a programmer by day, so if this is possible through the extension API, let me know, and I can make it happen.

  1. 2 Posted by Ric Werme on 21 Jun, 2012 01:15 AM

    Ric Werme's Avatar

    [FOO]Wow, ju [BAR]st, wow.

    I'm amused, sort of, at the ridiculous things banks do with these files, I sure these are done by junior people who are not allowed to touch the real database. Or maybe this is where the mortgage writers have wound up.

    The Digital Credit Union does some ugly things with their .ofx files for online banking done at their site. E.g. for a utility payment:

    <NAME>WITHDRAW  
    <MEMO>COMCAST - CHELMSBILL PAYMT120525
    

    So I'm left with a whole bunch of payees named Withdraw.

    I recently got their credit card. And it gives me a whole bunch of payees named Purchase. Sigh.

    Instead of fixing things with the Python extension, I wrote a converter program that reads in the DCU brain-damaged format, shuffles stuff around, and writes out something much closer to what I wanted.

    I've used the program exactly twice - for last month's data. Seemed to work. :-)

    It's completely unpolished and has crud from the boilerplate program I start everything from. It's too ugly to attach until I clean it up a bit. If you can run a Python program, there's a decent chance you can figure out what to tweak to work with your files. If you use Python, you'll think I'm an idiot for not using regular expressions.

    The central part (and a test to see what happens to Python code posted here):

    SCAN, INSTMNTRN = range(2)  # States, hardly necessary.
    
    state = SCAN
    for line in fi:
        if verbose:
            print state, line,
        if state == SCAN:
            fo.write(line)
            if '<STMTTRN>' in line:
                keylist = []
                trndict = {}
                state = INSTMNTRN
        elif state == INSTMNTRN:
            if not '</STMTTRN>' in line:
                try:        # There are lines of white space to ignore
                    key_raw, val = line.split('>', 1)
                except:
                    continue
                key = key_raw.split('<')[1]
                keylist.append(key)
                trndict[key] = [key_raw, val.strip()]
            else:
                do_trans(trndict)
                for key in keylist:
                    print '%s>%s' % tuple(trndict[key])
                    fo.write('%s>%s\n' % tuple(trndict[key]))
                print line
                fo.write(line)
                temp = raw_input('More? ')
                state = SCAN
        else:
            print 'Unknown state'
    

    The do_trans() call is what rearranges the transaction, you'd want one for JPMC.

    If you want it, drop me a note at http://wermenh.com/contact.html . I'll be away for a few days though.

  2. 3 Posted by Lucas Bergman on 21 Jun, 2012 01:17 AM

    Lucas Bergman's Avatar

    I should have mentioned, the net result as currently implemented is that I enter my payment to Bank of America, then merge with the downloaded transaction and end up with the memo field set to "k of America." A far better outcome would be to have the memo field set to NAME+MEMO.

  3. Support Staff 4 Posted by Jessica Little on 21 Jun, 2012 12:02 PM

    Jessica Little's Avatar

    Hi Lucas,

    Unfortunately, banks seem all incorrectly implement OFX in different ways, which makes it hard for us to work around each for them. We probably won't add a flag for this particular broken-ness unless it becomes a more widespread issue.

    We do have an extension API, which you can find on our website at: http://moneydance.com/developer. Also, we have a Python interpreter extension that you can use to write Jython scripts to run in Moneydance. There's a link to Ric's Moneydance and Jython primer on the developer page.

    Hope that helps, and sorry for the trouble.

    Jessica Little
    Moneydance Support

  4. 5 Posted by Lucas Bergman on 21 Jun, 2012 12:51 PM

    Lucas Bergman's Avatar

    Hi, folks, thanks for weighing in.

    The documentation is scant, but it looks like OnlineTxnListener might be what I want? Does that give me a chance to munge transactions as they come in from the OFX gateway? (I'm ambivalent about Java vs. Python; I'm comfortable with both.)

  5. Support Staff 6 Posted by Jessica Little on 25 Jun, 2012 12:34 PM

    Jessica Little's Avatar

    Hi Lucas,

    The OnlineTxnListener actually won't be of any help in this case. You should listen for changes using the normal transaction-modified events and then edit the payee/description for transactions that return true for .isNew(). That should achieve what you want.

    Jessica Little
    Moneydance Support

  6. 7 Posted by Lucas Bergman on 25 Jun, 2012 01:16 PM

    Lucas Bergman's Avatar

    Brilliant, Jessica. Thanks. I'll see if I can hack something together.

  7. 8 Posted by Kniniaacusara on 28 Nov, 2012 12:30 AM

    Kniniaacusara's Avatar

    Individuals prone to gastric distress may want to avoid wild edible plants, and those with sensitivity to poison ivy shouldn't eat plants like mangoes and cashews that are in the same family. It dries quickly upon exiting the water of the swim leg. No longer is a flag carefully hand woven and respectfully tailored, never touching the ground and burned with respect after years of flying.
    Constitution). I think the reason English is subject to more rapid change (towards regularity) (in comparison with other languages) is that we all have to learn English and we all have different mother-tongues. I tend to buy shirts, t-shirts and an occasional outdoor jacket or sweater from them.
    SnowboardsThe lightweight design of the snowboard can adapt to numerous riding terrains. This is especially important for children. Arc'teryx also makes insulated waterproof shells, water resistant soft shells and mid weight shells. For some reason, 5 men are behind me in the aisles, playing along to the organ with trumpets, a tuba, trombone, clarinet and banjo, competing with the shouts of the Bleacher Bums and the hoots of Ronnie Woo Woo up front..
    Ice SportsIce skating provides a good aerobic workout while improving coordination, posture and flexibility. who purchase groceries worth $200 or more will receive a discount of 25 cents off a litre, and those who buy $100 or more will receive 10 cents off a litre.
    That why producers have to often adapt and walk a fine line between avoiding looking characters looking too silly, but also not straying too far from the source material. The scout convinced Catrinel Menghia that she belonged on the catwalk and, with her parents permission, she relocated to the Romanian capital several months later to begin her career in earnest..
    Between that place and my bus stop was a cool, eclectic little shop that specialized in funky handicrafts from all around the world, especially Mexico. Kowalewski received a bachelor's degree with honors in economics from Harvard University, and an MBA from the University of Chicago Graduate School of Business..
    Choose the kind that fits snug over your ears, and a major source of discomfort is eliminated. a Mr Chas, who played honkey tonk piano, and a Mr Dave, who played bass. The start button accesses the journal and "X" (Xbox 360) or "square" (PS3) enters the local map.
    He is spotted by fellow American soldiers flying away in helicopters. volleyball coach Hugh McCutcheon. LIVESTRONG is a registered trademark of the Lance Armstrong Foundation. Kennedy's staff went to work converting the bottom floors to office space, and encouraging the use of the upper floors as furniture showrooms.
    You will need a map of the area where you will be hiking and a compass. They score points only with a strike with the tip. Avoid wearing long pants that can restrict movement. That is to say, your bestest best friend.. The sidewalks aren't too comfortable, so wear good shoes.

  8. 9 Posted by Ric Werme on 28 Nov, 2012 02:15 AM

    Ric Werme's Avatar

    [Individuals prone to gastric distress may want to avoid] Jython and parsing .OFX files.

  9. 10 Posted by Lucas Bergman on 29 Nov, 2012 02:13 PM

    Lucas Bergman's Avatar

    [Individuals prone to gastric distress may want to avoid] Jython and parsing .OFX files.

    Well played. For what it's worth, Chase's OFX files have not improved, and I still have this project backburnered.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.