NickvisionApps / Denaro

Manage your personal finances
https://flathub.org/apps/details/org.nickvision.money
MIT License
575 stars 38 forks source link

Ofx import fails #794

Open janopae opened 7 months ago

janopae commented 7 months ago

When I import an .ofx file created using csv2ofx, it says "nothing to import from this file". Using a qif file created with the same program for the same source file works.

All the exception says on the command line is the following:

System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.Load(TextReader txtReader)
   at OfxSharp.OFXDocumentParser.Parse(String ofxString)
   at OfxSharp.OFXDocumentParser.ParseOfxDocument(String ofxString)
   at OfxSharp.OFXDocumentParser.Import(String ofx)
   at NickvisionMoney.Shared.Models.Account.ImportFromOFXAsync(String path, String defaultTransactionRGBA) in /run/build/org.nickvision.money/NickvisionMoney.Shared/Models/Account.cs:line 1455

I can reproduce this using the following, simplified .ofx file example:

DATA:OFXSGML
ENCODING:UTF-8
<OFX>
    <SIGNONMSGSRSV1>
        <SONRS>
            <STATUS>
                <CODE>0</CODE>
                <SEVERITY>INFO</SEVERITY>
            </STATUS>
            <DTSERVER>20240303191311</DTSERVER>
            <LANGUAGE>ENG</LANGUAGE>
        </SONRS>
    </SIGNONMSGSRSV1>
    <BANKMSGSRSV1>
        <STMTTRNRS>
            <TRNUID></TRNUID>
            <STATUS>
                <CODE>0</CODE>
                <SEVERITY>INFO</SEVERITY>
            </STATUS>
            <STMTRS>
                <CURDEF>USD</CURDEF>
                <BANKACCTFROM>
                    <BANKID>4e35febee7b31708a1a684aa56bdd138</BANKID>
                    <ACCTID>551568e291660420b29e0bb0f6356e82</ACCTID>
                    <ACCTTYPE>CHECKING</ACCTTYPE>
                </BANKACCTFROM>
                <BANKTRANLIST>
                    <DTSTART>19700101</DTSTART>
                    <DTEND>20240303</DTEND>
                    <STMTTRN>
                        <TRNTYPE>DEBIT</TRNTYPE>
                        <DTPOSTED>20240301000000</DTPOSTED>
                        <TRNAMT>-0.00</TRNAMT>
                        <FITID>5104ca1953db7f888871994ded5ddd61</FITID>
                        <NAME>Test</NAME>
                        <MEMO>Test</MEMO>
                    </STMTTRN>
                </BANKTRANLIST>
            </STMTRS>
        </STMTTRNRS>
    </BANKMSGSRSV1>
</OFX>
nlogozzo commented 7 months ago

Denaro is currently in the process of a C++ rewrite with a new OFX import method...I will test it with that and make sure it works.

janopae commented 7 months ago

Thanks!