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

Property JournalEntry does not exist. Class IPPRecurringTransaction

Open gmariani opened this issue 3 years ago • 4 comments

Trying to retrieve a list of RecurringTransactions and I get this error.

$dataService->Query("select * from RecurringTransaction");

I am getting the following exception in PhpObjFromXml in /src/Core/Http/Serialization/XmlObjectSerializer.php of the SDK. I"m using version 6.0.1 of the SDK.

Property JournalEntry does not exist. Class QuickBooksOnline\API\Data\IPPRecurringTransaction

gmariani avatar Jul 04 '21 15:07 gmariani

Managed to patch this by adding this to /src/Data/IPPRecurringTransaction.php

    /**
     * @xmlType element
     * @xmlName JournalEntry
     * @varz com\intuit\schema\finance\v3\JournalEntry
     * @var IPPJournalEntry
     */
    public $JournalEntry;

    /**
     * @xmlType element
     * @xmlName Purchase
     * @varz com\intuit\schema\finance\v3\Purchase
     * @var IPPPurchase
     */
    public $Purchase;

    /**
     * @xmlType element
     * @xmlName Invoice
     * @varz com\intuit\schema\finance\v3\Invoice
     * @var IPPInvoice
     */
    public $Invoice;

gmariani avatar Jul 04 '21 16:07 gmariani

Had to also add this:

    /**
     * @xmlType element
     * @xmlName SalesReceipt
     * @varz com\intuit\schema\finance\v3\SalesReceipt
     * @var IPPSalesReceipt
     */
    public $SalesReceipt;

In order to get the correct error message, I have to modify error message in /src/DataService/DataService.php with this in order to get the actual error message:

try {
    $responseXmlObj = simplexml_load_string($responseBody);
    if ($responseXmlObj && $responseXmlObj->QueryResponse) {
        $tmpXML = $responseXmlObj->QueryResponse->asXML();
        $parsedResponseBody = $this->responseSerializer->Deserialize($tmpXML, false);
        $this->serviceContext->IppConfiguration->Logger->CustomLogger->Log(TraceLevel::Info, $parsedResponseBody);
    }
} catch (\Exception $e) {
    throw new \Exception("Exception appears in converting Response to XML.");
}

to

try {
    $responseXmlObj = simplexml_load_string($responseBody);
    if ($responseXmlObj && $responseXmlObj->QueryResponse) {
        $tmpXML = $responseXmlObj->QueryResponse->asXML();
        $parsedResponseBody = $this->responseSerializer->Deserialize($tmpXML, false);
        $this->serviceContext->IppConfiguration->Logger->CustomLogger->Log(TraceLevel::Info, $parsedResponseBody);
    }
} catch (\Exception $e) {
    echo print_r($e);
    throw new \Exception("Exception appears in converting Response to XML.");
}

gmariani avatar Jul 05 '21 04:07 gmariani

Looks like this is the complete list of types that should probably be added to support: Bill, Purchase, CreditMemo, Deposit, Estimate, Invoice, JournalEntry, RefundReceipt, SalesReceipt, Transfer, VendorCredit, and PurchaseOrder

gmariani avatar Jul 05 '21 05:07 gmariani