jsgoupil / quickbooks-sync

Sync Quickbooks Desktop
MIT License
87 stars 40 forks source link

Payment receipt template returns `true` for template type #52

Open rogerfar opened 3 years ago

rogerfar commented 3 years ago

I was using a sample company today and noticed that all the templates of type Payment Receipt return a TemplateType of true.

Very strange behaviour, but breaks XML deserialization because it's expecting an enum.

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="continueOnError">
        <TemplateQueryRq requestID="10a28a0a-526d-4dac-9282-5e87db89cbb7" />
    </QBXMLMsgsRq>
</QBXML>
<QBXML>
    <QBXMLMsgsRs>
        <TemplateQueryRs requestID="10a28a0a-526d-4dac-9282-5e87db89cbb7"
                        statusCode="0"
                        statusSeverity="Info"
                        statusMessage="Status OK">
            <TemplateRet>
                <ListID>A0000-1193777333</ListID>
                <TimeCreated>2007-10-30T14:48:53-07:00</TimeCreated>
                <TimeModified>2008-01-01T15:40:55-07:00</TimeModified>
                <EditSequence>1199227255</EditSequence>
                <Name>Work Order</Name>
                <IsActive>true</IsActive>
                <TemplateType>SalesOrder</TemplateType>
            </TemplateRet>
            <TemplateRet>
                <ListID>80000028-1924956754</ListID>
                <TimeCreated>2030-12-31T07:12:34-07:00</TimeCreated>
                <TimeModified>2030-12-31T07:12:34-07:00</TimeModified>
                <EditSequence>1924956754</EditSequence>
                <Name>Intuit Standard Payment Receipt</Name>
                <IsActive>true</IsActive>
                <TemplateType>true</TemplateType>
            </TemplateRet>
            <TemplateRet>
                <ListID>8000002A-1988119998</ListID>
                <TimeCreated>2032-12-31T08:33:18-07:00</TimeCreated>
                <TimeModified>2032-12-31T08:33:18-07:00</TimeModified>
                <EditSequence>1988119998</EditSequence>
                <Name>New Payment Receipt Template</Name>
                <IsActive>true</IsActive>
                <TemplateType>true</TemplateType>
            </TemplateRet>
        </TemplateQueryRs>
    </QBXMLMsgsRs>
</QBXML>

This seems a new type of template introduced in QB 2021 (https://www.intuitiveaccountant.com/accounting-tech/general-ledger/quickbooks-desktop-2021-customize-payment-receipts/).

I'm not sure if this something we should fix in the parser, or address with Intuit, but doing the latter will 99% result in a, works as intended, or we don't really care response.

jsgoupil commented 3 years ago

I doubt Intuit moves about these things. You can raise it on their developer community forum and see what people say about this. Wait a few days if you get an answer, but in the end, we should probably fix the qbxml130_modified.xsd then regenerate the Objects.cs

<xsd:element name="TemplateRet">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:group ref="ListCore"/>
            <xsd:element name="Name" minOccurs="0">
                <xsd:simpleType>
                    <xsd:restriction base="STRTYPE">
                        <xsd:maxLength value="31"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element ref="IsActive" minOccurs="0"/>
            <xsd:element ref="TemplateType" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>

Also, to note, that the XSD says minOccurs="0" but here it says it's mandatory: image

rogerfar commented 3 years ago

So I received an answer from the development group, they weren't aware of the new template and they're looking into it... So maybe a fix in 2029 from Intuit?

rogerfar commented 1 year ago

Unfortunately found another example, VendorQueryRs has a field ReportingPeriod which can return Annual, but according to the XML:

image

Contacting support about these kind of issues got me nowhere, so I manually filter the responses before parsing the XML:

xml = xml.Replace("<TemplateType>true</TemplateType>", "<TemplateType>PurchaseOrder</TemplateType>");
xml = xml.Replace("<ReportingPeriod>Annual</ReportingPeriod>", "<ReportingPeriod>Monthly</ReportingPeriod>");
jsgoupil commented 1 year ago

I think for those, I am fully open to edit the XML and generate new Objects.cs But I think based on the other bug we should move towards QbXML 16.

I think though, when I use this quickbooks-sync package, I know I will not be using QbXML 16 features and still need to support some QuickBooks v19, but I would still like to be able to update. In this case, we should be able to say which QBXML do we want to send to the wire.