NickvisionApps / Denaro

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

Nothing to import from the file #762

Closed bennypowers closed 6 months ago

bennypowers commented 6 months ago

I've generated .ofx exports from toshl finance. Here's a redacted minimal repro:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?OFX OFXHEADER="200" VERSION="220" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>
<OFX>
    <BANKMSGSRSV1>
        <STMTTRNRS>
            <CURDEF>ILS</CURDEF>
            <BANKACCTFROM>
                <BANKID>000</BANKID>
                <ACCTID>000</ACCTID>
                <ACCTTYPE>CHECKING</ACCTTYPE>
            </BANKACCTFROM>
            <BANKTRANLIST>
                <DTSTART>20130615000000.000[+0000]</DTSTART>
                <DTEND>20231220000000.000[+0000]</DTEND>
                <STMTTRN>
                    <TRNTYPE>OTHER</TRNTYPE>
                    <DTPOSTED>20130501000000.000[+0000]</DTPOSTED>
                    <TRNAMT>-47.00</TRNAMT>
                    <FITID>17100-0</FITID>
                    <MEMO>Kupat Holim</MEMO>
                    <SIC>🏥 Health &amp; Personal Care;Health Insurance 💳, insurance</SIC>
                </STMTTRN>
            </BANKTRANLIST>
        </STMTTRNRS>
    </BANKMSGSRSV1>
</OFX>

If I remove the emoji and hebrew glyphs, and the tags from the <SIC> tag (the ; and everything to the right), it's the same result. Same thing if I change the <CURDEF> to USD

JoseBritto commented 6 months ago

I'm not sure what is there to be signed into here but the exception is thrown is this:

 OfxSharp.OFXParseException: Sign On information not found
   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) 

  NickvisionMoney.Shared/Models/Account.cs:line 1428

At this line: https://github.com/NickvisionApps/Denaro/blob/0b68871e86cce8de1b080d18f8de159e92c05a81/NickvisionMoney.Shared/Models/Account.cs#L1428

JoseBritto commented 6 months ago

We're not logging the error to the terminal here. Need to fix that as well.

JoseBritto commented 6 months ago

@bennypowers If possible can you try #763 and see if that is the actual exception being thrown?

bennypowers commented 6 months ago

image I used Builder's "Run Project" button to get this screenshot

JoseBritto commented 6 months ago

Its the same error. Thanks. Just wanted to confirm that the error isn't caused due to trimming the file.

nlogozzo commented 6 months ago

See the OFX specifications: https://financialdataexchange.org/common/Uploaded%20files/OFX%20files/OFX%20Banking%20Specification%20v2.3.pdf

Your document is missing the SIGNON section which is required per the specifications. I'm going to have Denaro insert a dummy SIGNON section to an OFX document if it isn't present and avoid crashing...but this is an issue with Toshl and the way they generate OFX docs.

nlogozzo commented 6 months ago

Your account is also missing the LEDGERBAL section...I've added a dummy one too as it's not used by Denaro but is required as per the ofx spec.

nlogozzo commented 6 months ago

image

nlogozzo commented 6 months ago

https://github.com/NickvisionApps/Denaro/releases/tag/2024.1.0

bennypowers commented 6 months ago

Thank you! I was able to import transactions from Toshl.

However, we've noted that Toshl's ofx exports don't always fit the spec. It also appears from a cursory search of the spec PDF that there's no standard way to assign taxonomy like categories(groups) or tags. The transactions I imported did not retain their taxonomy in Money.

Toshl stores category and tag in the <SIC> tag in this format: Category;TagA,TagB,TagC. It seems to me the correct way to address this is to transform the .ofx file myself before importing. Is there documentation available for Denaro's expected format for things like categories, tags, notes, receipts, etc?

nlogozzo commented 6 months ago

As you said yourself, there's no specification in the OFX standard for a standard way of storing groups/categories, tags, etc...

Therefore, when reading OFX files, Denaro will only import transactions.

You could use a CSV file to import more types of data, however that requires a specific format to the CSV which can be found here on Denaro's docs: https://htmlpreview.github.io/?https://raw.githubusercontent.com/NickvisionApps/Denaro/main/NickvisionMoney.Shared/Docs/html/C/import-export.html