QuickBooks-V3-DotNET-SDK icon indicating copy to clipboard operation
QuickBooks-V3-DotNET-SDK copied to clipboard

Does the library take into account that the API can return an Fault with 200 OK code?

Open pavel-dushkov-am opened this issue 3 years ago • 0 comments

Preface:

We got an error because the method DataService.Upload https://github.com/intuit/QuickBooks-V3-DotNET-SDK/blob/c0ea9ad9efe82ee15324a8e799b4815a410210ef/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.DataService/DataService.cs#L1931 returned null.

It turned out that this is due to the fact that the API returned an error with a 200 OK code.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2022-09-28T14:52:37.164-07:00">
    <AttachableResponse>
        <Fault type="ValidationFault">
            <Error code="6000" element="">
                <Message>A business validation error has occurred while processing your request</Message>
                <Detail>Business Validation Error: Unexpected Internal Error. (-30000)</Detail>
            </Error>
        </Fault>
    </AttachableResponse>
</IntuitResponse>

(error that was returned by API)

And since the DataService.Upload doesn't handle cases where the response is Fault, https://github.com/intuit/QuickBooks-V3-DotNET-SDK/blob/c0ea9ad9efe82ee15324a8e799b4815a410210ef/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.DataService/DataService.cs#L2030-L2036 it returned null, and didn't provide any information about error.

Question:

Given that returning an error with a 200 OK code is normal for an API (docs), image

the question arises: is this behavior of the library intentional, or is it a bug? Just for example - why we don't do something like this - https://github.com/intuit/QuickBooks-V3-DotNET-SDK/pull/260
https://github.com/intuit/QuickBooks-V3-DotNET-SDK/blob/031b7633def74905a49db95520908171f8d3b2ec/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.DataService/DataService.cs#L1991-L2013

(Similar case from PHP library - https://github.com/intuit/QuickBooks-V3-PHP-SDK/issues/413)

pavel-dushkov-am avatar Oct 04 '22 08:10 pavel-dushkov-am