Bug 333522

Summary: in online account update, deposit changed to payment
Product: [Applications] kmymoney Reporter: Swj <swj>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: onet.cristian, swj
Priority: NOR    
Version: 4.6.4   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: ofxlog
Imported transactions
screenshot of ledger showing $.01 deposit registering as a payment

Description Swj 2014-04-17 02:21:12 UTC
When I click on update to do an online account update, a couple of transactions, which should have been deposits, showed up as payments instead.  One was .01 and one was .02 (2 US cents)  . The transactions were money market interest payments on my TD Ameritrade account.

Reproducible: Always

Steps to Reproduce:
1.click on update to do an online account update,
2.
3.
Actual Results:  
.01 payment

Expected Results:  
.01 deposit
Comment 1 allan 2014-04-17 10:32:46 UTC
On 17/04/14 03:21, Swj wrote:
> https://bugs.kde.org/show_bug.cgi?id=333522
>
>              Bug ID: 333522

> When I click on update to do an online account update, a couple of
> transactions, which should have been deposits, showed up as payments instead.
> One was .01 and one was .02 (2 US cents)  . The transactions were money market
> interest payments on my TD Ameritrade account.
>


Do we know if the received data is correct?

Would you create an empty file in your home directory named "ofxlog.txt" 
and then do the import again.

See if that sheds any light on the matter.

If you want to add that to the bug report, change any sensitive data.

Allan
Comment 2 Swj 2014-04-20 16:34:39 UTC
I believe this is the relevant portion of ofxlog.txt.  It shows up as a .01 payment instead of a .01 deposit:

<INVTRANLIST>
<DTSTART>20140321000000</DTSTART>
<DTEND>20140417000000</DTEND>
<INCOME>
<INVTRAN>
<FITID>11402508877</FITID>
<DTTRADE>20140331232354</DTTRADE>
<MEMO>MONEY MARKET INTEREST</MEMO>
</INVTRAN>
<SECID>
<UNIQUEID>9ZZZFD104</UNIQUEID>
<UNIQUEIDTYPE>CUSIP</UNIQUEIDTYPE>
</SECID>
<INCOMETYPE>DIV</INCOMETYPE>
<TOTAL>0.01</TOTAL>
<SUBACCTSEC>CASH</SUBACCTSEC>
<SUBACCTFUND>CASH</SUBACCTFUND>
</INCOME>
<INVBANKTRAN>
<STMTTRN>
Comment 3 Swj 2014-08-20 22:08:16 UTC
Created attachment 88340 [details]
ofxlog

Here is the ofxlog.txt file.  It includes a transaction that shows on the account ledger as a .01 payment, when actually it is a .01 deposit.
Comment 4 Cristian Oneț 2014-08-22 07:08:39 UTC
TODO: use the attached test file to fix this
Comment 5 Cristian Oneț 2014-09-08 21:04:09 UTC
Created attachment 88620 [details]
Imported transactions

Screenshot with the imported transactions using the current version.
Comment 6 Cristian Oneț 2014-09-08 21:07:11 UTC
I've tried to import the OFX response using the current development version and (as it can bee seen in the attached screenshot) the 0.01 transaction was correctly imported as a deposit. On 4.6.4 it didn't got imported.

You could try the latest version of the live installer to see if it fixes this problem http://www.kmymoney.org/news.php#itemKMyMoneyLiveWindowsinstalleravailable.
Comment 7 Swj 2014-09-08 22:06:08 UTC
I used your link to install Version 4.6.90-cdd451fe35 and it still has the bug, showing as a payment not a deposit.
Comment 8 Cristian Oneț 2014-09-09 09:58:33 UTC
Do you import this in the investment or in the brokerage account?
Comment 9 Cristian Oneț 2014-09-11 08:25:13 UTC
Could you please add a screenshot or more details, in which account (investments or brokerage) does the transaction show as a payment? Until we can't reproduce it we can't fix it.
Comment 10 Swj 2014-09-11 17:39:21 UTC
Created attachment 88660 [details]
screenshot of ledger showing $.01 deposit registering as a payment
Comment 11 Swj 2014-09-11 17:40:01 UTC
Its a checking account
Comment 12 Cristian Oneț 2014-09-12 05:52:52 UTC
(In reply to Swj from comment #11)
> Its a checking account

That was the essential information. Based on the OFX I thought all along that it's an investment account.
Comment 13 Cristian Oneț 2014-09-12 06:26:28 UTC
Found the cause of the bug, created a fix at https://git.reviewboard.kde.org/r/120153/ but it needs to be reviewed since I don't really have knowledge about investment transactions.
Comment 14 Cristian Oneț 2014-09-21 09:33:25 UTC
Git commit 5c54aafef7aa8a39ffd3b5e2dcb6538301652ee5 by Cristian Oneț.
Committed on 12/09/2014 at 06:15.
Pushed by conet into branch 'master'.

Remove the OFX investment transactions amount sign inversion hack.

As the author of the hack states he's not sure why this was necessary.
This hack also caused a lot of workarounds in MyMoneyStatementReader
so it definitely should be removed. I've tried to keep the current
behaviour in MyMoneyStatementReader but since I'm not familiar with
investment transaction these should be double checked.
REVIEW: 120153

M  +8    -24   kmymoney/converter/mymoneystatementreader.cpp
M  +0    -4    kmymoney/plugins/ofximport/ofximporterplugin.cpp

http://commits.kde.org/kmymoney/5c54aafef7aa8a39ffd3b5e2dcb6538301652ee5