[Bug]: OFX import has wrong amounts (adds 3 extra zeros) #960

Closed
opened 2026-02-28 19:26:27 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @keriati on GitHub (Mar 4, 2024).

Verified issue does not already exist?

  • I have searched and found no existing issue
  • I have checked my server logs and could not see any errors there
  • I will be attaching my server logs to this issue
  • I will be attaching my client-side (browser) logs to this issue
  • I understand that this issue will be automatically closed if insufficient information is provided

What happened?

Just updated to actual 24.3.0. Wanted to import my february spendings from OFX file, however this time all amounts are x1000 greater as the actual amount.

I tried to roll back to 24.1.0 but that also doesn't work because of some migration error.

What error did you receive?

No error, just wrong amounts when importing OFX in 24.3.0

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Firefox

Operating System

Mac OSX

Originally created by @keriati on GitHub (Mar 4, 2024). ### Verified issue does not already exist? - [X] I have searched and found no existing issue ### Is this related to GoCardless, Simplefin or another bank-sync provider? - [ ] I have checked my server logs and could not see any errors there - [ ] I will be attaching my server logs to this issue - [ ] I will be attaching my client-side (browser) logs to this issue - [ ] I understand that this issue will be automatically closed if insufficient information is provided ### What happened? Just updated to actual 24.3.0. Wanted to import my february spendings from OFX file, however this time all amounts are x1000 greater as the actual amount. I tried to roll back to 24.1.0 but that also doesn't work because of some migration error. ### What error did you receive? No error, just wrong amounts when importing OFX in 24.3.0 ### Where are you hosting Actual? Docker ### What browsers are you seeing the problem on? Firefox ### Operating System Mac OSX
GiteaMirror added the transaction importbug labels 2026-02-28 19:26:27 -06:00
Author
Owner

@keriati commented on GitHub (Mar 4, 2024):

OFX format is:

<?xml version="1.0" encoding="utf-8" ?><?OFX OFXHEADER="200" VERSION="202" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>

and the amounts look like this:

<TRNAMT>-8.95000</TRNAMT>

I tried to check the unit tests from parseOFX(), however as those are snapshot tests I am not really sure what output I should expect...

@keriati commented on GitHub (Mar 4, 2024): OFX format is: ```xml <?xml version="1.0" encoding="utf-8" ?><?OFX OFXHEADER="200" VERSION="202" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?> ``` and the amounts look like this: ```xml <TRNAMT>-8.95000</TRNAMT> ``` I tried to check the unit tests from parseOFX(), however as those are snapshot tests I am not really sure what output I should expect...
Author
Owner

@keriati commented on GitHub (Mar 4, 2024):

Okay, so I found this here:

66261641a0/packages/loot-core/src/shared/util.test.ts (L8)

@youngcw could this be the reason that the OFX import is right now broken?

@keriati commented on GitHub (Mar 4, 2024): Okay, so I found this here: https://github.com/actualbudget/actual/blob/66261641a028a14d7cdf117c2e1e93c4df0cabbf/packages/loot-core/src/shared/util.test.ts#L8 @youngcw could this be the reason that the OFX import is right now broken?
Author
Owner

@youngcw commented on GitHub (Mar 4, 2024):

@keriati Hmm. That change was to fix an issue someone else had where their bank only sometimes included decimal places in a csv. Im actually a little surprised that the ofx parser uses that same amount parsing.

@MatissJanis

@youngcw commented on GitHub (Mar 4, 2024): @keriati Hmm. That change was to fix an issue someone else had where their bank only sometimes included decimal places in a csv. Im actually a little surprised that the ofx parser uses that same amount parsing. @MatissJanis
Author
Owner

@keriati commented on GitHub (Mar 4, 2024):

@youngcw maybe it is not, I am trying to make sense of packages/desktop-client/src/components/modals/ImportTransactions.jsx however the number of responsibilities and logic mixed together is crazy 🥲

@keriati commented on GitHub (Mar 4, 2024): @youngcw maybe it is not, I am trying to make sense of packages/desktop-client/src/components/modals/ImportTransactions.jsx however the number of responsibilities and logic mixed together is crazy 🥲
Author
Owner

@keriati commented on GitHub (Mar 4, 2024):

@youngcw Okay I managed to track it down, there are a lot of indirections, but it is hitting looselyParseAmount at some point. As the OFX export I have from the bank is giving me all numbers with such format: -8.95000 it is breaking the imports sadly.

Can be reproduced with this data.ofx file from the test mocks (I adjusted the amounts with 3 extra zeros):

OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE

<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<DTSERVER>20190124212851.000[0:UTC]
<LANGUAGE>ENG
<DTACCTUP>20190124212851.000[0:UTC]
<FI>
<ORG>Bank of America
<FID>5959
</FI>
<INTU.BID>6526
<INTU.USERID>jlongster03
</SONRS>
</SIGNONMSGSRSV1>
<BANKMSGSRSV1>
<STMTTRNRS>
<TRNUID>0
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<STMTRS>
<CURDEF>USD
<BANKACCTFROM>
<BANKID>012345678
<ACCTID>123456789123
<ACCTTYPE>CHECKING
</BANKACCTFROM>
<BANKTRANLIST>
<DTSTART>20190119120000
<DTEND>20190124120000
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190123120000
<TRNAMT>-30.00000
<FITID>00092990122-30.00019012312798.01
<NAME>PATIENT FIRST TOKEN 01/22 PURCHA
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190123120000
<TRNAMT>-3.77000
<FITID>00092990121-3.77019012312828.01
<NAME>STARBUCKS STORE 07604 01/21 PURC
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190123120000
<TRNAMT>-9.62
<FITID>00092990121-9.62019012312831.78
<NAME>STARBUCKS STORE 07604 01/21 PURC
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190122120000
<TRNAMT>-115.99
<FITID>00090231800-115.99019012212841.40
<NAME>VERIZON DES:PAYMENTREC ID:XXXXX3
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190122120000
<TRNAMT>-10.34
<FITID>00092990120-10.34019012212957.39
<NAME>URBAN FARMHOUSE NO 2 01/19 PURCH
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190122120000
<TRNAMT>-22.53
<FITID>00092990120-22.53019012212967.73
<NAME>URBAN FARMHOUSE NO 2 01/19 PURCH
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190122120000
<TRNAMT>-108.71
<FITID>00092990119-108.71019012212990.26
<NAME>TMOBILE*AUTO PAY 01/19 PURCHASE 
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190122120000
<TRNAMT>-25.00
<FITID>00092990118-25.00019012213098.97
<NAME>COUNTY WASTE 01/18 PURCHASE 804-
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190122120000
<TRNAMT>-32.38
<FITID>00092990118-32.38019012213123.97
<NAME>REGENCY MART CITGO 01/18 PURCHAS
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190122120000
<TRNAMT>-6.07
<FITID>00092990117-6.07019012213156.35
<NAME>CHICK-FIL-A #01342 01/17 PURCHAS
</STMTTRN>
</BANKTRANLIST>
<LEDGERBAL>
<BALAMT>12798.01
<DTASOF>20190124212851
</LEDGERBAL>
</STMTRS>
</STMTTRNRS>
</BANKMSGSRSV1>
</OFX>
@keriati commented on GitHub (Mar 4, 2024): @youngcw Okay I managed to track it down, there are a lot of indirections, but it is hitting looselyParseAmount at some point. As the OFX export I have from the bank is giving me all numbers with such format: ```-8.95000``` it is breaking the imports sadly. Can be reproduced with this data.ofx file from the test mocks (I adjusted the amounts with 3 extra zeros): ``` OFXHEADER:100 DATA:OFXSGML VERSION:102 SECURITY:NONE ENCODING:USASCII CHARSET:1252 COMPRESSION:NONE OLDFILEUID:NONE NEWFILEUID:NONE <OFX> <SIGNONMSGSRSV1> <SONRS> <STATUS> <CODE>0 <SEVERITY>INFO </STATUS> <DTSERVER>20190124212851.000[0:UTC] <LANGUAGE>ENG <DTACCTUP>20190124212851.000[0:UTC] <FI> <ORG>Bank of America <FID>5959 </FI> <INTU.BID>6526 <INTU.USERID>jlongster03 </SONRS> </SIGNONMSGSRSV1> <BANKMSGSRSV1> <STMTTRNRS> <TRNUID>0 <STATUS> <CODE>0 <SEVERITY>INFO </STATUS> <STMTRS> <CURDEF>USD <BANKACCTFROM> <BANKID>012345678 <ACCTID>123456789123 <ACCTTYPE>CHECKING </BANKACCTFROM> <BANKTRANLIST> <DTSTART>20190119120000 <DTEND>20190124120000 <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190123120000 <TRNAMT>-30.00000 <FITID>00092990122-30.00019012312798.01 <NAME>PATIENT FIRST TOKEN 01/22 PURCHA </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190123120000 <TRNAMT>-3.77000 <FITID>00092990121-3.77019012312828.01 <NAME>STARBUCKS STORE 07604 01/21 PURC </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190123120000 <TRNAMT>-9.62 <FITID>00092990121-9.62019012312831.78 <NAME>STARBUCKS STORE 07604 01/21 PURC </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190122120000 <TRNAMT>-115.99 <FITID>00090231800-115.99019012212841.40 <NAME>VERIZON DES:PAYMENTREC ID:XXXXX3 </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190122120000 <TRNAMT>-10.34 <FITID>00092990120-10.34019012212957.39 <NAME>URBAN FARMHOUSE NO 2 01/19 PURCH </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190122120000 <TRNAMT>-22.53 <FITID>00092990120-22.53019012212967.73 <NAME>URBAN FARMHOUSE NO 2 01/19 PURCH </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190122120000 <TRNAMT>-108.71 <FITID>00092990119-108.71019012212990.26 <NAME>TMOBILE*AUTO PAY 01/19 PURCHASE </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190122120000 <TRNAMT>-25.00 <FITID>00092990118-25.00019012213098.97 <NAME>COUNTY WASTE 01/18 PURCHASE 804- </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190122120000 <TRNAMT>-32.38 <FITID>00092990118-32.38019012213123.97 <NAME>REGENCY MART CITGO 01/18 PURCHAS </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20190122120000 <TRNAMT>-6.07 <FITID>00092990117-6.07019012213156.35 <NAME>CHICK-FIL-A #01342 01/17 PURCHAS </STMTTRN> </BANKTRANLIST> <LEDGERBAL> <BALAMT>12798.01 <DTASOF>20190124212851 </LEDGERBAL> </STMTRS> </STMTTRNRS> </BANKMSGSRSV1> </OFX> ```
Author
Owner

@keriati commented on GitHub (Mar 4, 2024):

Well looking at the code, I would suggest to revert this: https://github.com/actualbudget/actual/pull/2399 as it is breaking now OFX import.

@keriati commented on GitHub (Mar 4, 2024): Well looking at the code, I would suggest to revert this: https://github.com/actualbudget/actual/pull/2399 as it is breaking now OFX import.
Author
Owner

@youngcw commented on GitHub (Mar 4, 2024):

Is OFX NA only? If so it could have its own parser that only allows decimal period where the loose parser is matching both decimal period and comma, that was part of the issue before

@youngcw commented on GitHub (Mar 4, 2024): Is OFX NA only? If so it could have its own parser that only allows decimal period where the loose parser is matching both decimal period and comma, that was part of the issue before
Author
Owner

@gschmidl commented on GitHub (Mar 5, 2024):

OFX is not NA only. Here's my bank in Austria doing the same:

<STMTTRN>
  <TRNTYPE>XFER</TRNTYPE>
  <DTPOSTED>...</DTPOSTED>
  <DTUSER>...</DTUSER>
  <DTAVAIL>...</DTAVAIL>
  <TRNAMT>-12.38000</TRNAMT>
  <FITID>...</FITID>
  <REFNUM>...</REFNUM>
  <BANKACCTTO>
    <BANKID>...</BANKID>
    <ACCTID>...</ACCTID>
    <ACCTTYPE>CHECKING</ACCTTYPE>
  </BANKACCTTO>
  <MEMO>...</MEMO>
</STMTTRN>
@gschmidl commented on GitHub (Mar 5, 2024): OFX is not NA only. Here's my bank in Austria doing the same: ``` <STMTTRN> <TRNTYPE>XFER</TRNTYPE> <DTPOSTED>...</DTPOSTED> <DTUSER>...</DTUSER> <DTAVAIL>...</DTAVAIL> <TRNAMT>-12.38000</TRNAMT> <FITID>...</FITID> <REFNUM>...</REFNUM> <BANKACCTTO> <BANKID>...</BANKID> <ACCTID>...</ACCTID> <ACCTTYPE>CHECKING</ACCTTYPE> </BANKACCTTO> <MEMO>...</MEMO> </STMTTRN> ```
Author
Owner

@keriati commented on GitHub (Mar 5, 2024):

Fix is provided in https://github.com/actualbudget/actual/pull/2421

@keriati commented on GitHub (Mar 5, 2024): Fix is provided in https://github.com/actualbudget/actual/pull/2421
Author
Owner

@youngcw commented on GitHub (Mar 5, 2024):

@gschmidl Can you try out #2421 and see if it fixes your issue?

@youngcw commented on GitHub (Mar 5, 2024): @gschmidl Can you try out #2421 and see if it fixes your issue?
Author
Owner

@keriati commented on GitHub (Apr 6, 2024):

Just tested it in 24.4.0 and it works now correctly

@keriati commented on GitHub (Apr 6, 2024): Just tested it in 24.4.0 and it works now correctly
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#960