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

IPPAttachable.AttachableRef.EntityRef.type is stripped out by DataService in query response

Open simplimation opened this issue 1 year ago • 3 comments

When querying Attachable objects, in the response the XML "type" attribute of EntityRef is not parse by DataService.php:1027 and so the IPPAttachable.AttachableRef.EntityRef.type is not defined. There is no way to see from the query results what type of object the EntityRef ID refers to. It parses the entity's ID but not the type.

Raw XML response ($responseBody at DataService:1019)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2023-03-07T09:35:47.705-08:00">
    <QueryResponse startPosition="1" maxResults="10">
        <Attachable domain="QBO" sparse="false">
            <Id>5000000000001184365</Id>
            <SyncToken>0</SyncToken>
            <MetaData>
                <CreateTime>2023-02-28T14:23:35-08:00</CreateTime>
                <LastUpdatedTime>2023-02-28T14:23:35-08:00</LastUpdatedTime>
            </MetaData>
            <AttachableRef>
                <EntityRef type="Customer">1</EntityRef>
                <IncludeOnSend>false</IncludeOnSend>
            </AttachableRef>
            <FileName>Sample-1677623013.pdf</FileName>
            <FileAccessUri>/v3/company/4620816365162761880/download/5000000000001184365
            </FileAccessUri>
            <TempDownloadUri>
                https://intuit-qbo-prod-19.s3.amazonaws.com/4620816365162761880/attachments/46b44f48-df7a-45cb-8222-67b959b8cadcSample-1677623013.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Date=20230307T173547Z&amp;X-Amz-SignedHeaders=host&amp;X-Amz-Expires=900&amp;X-Amz-Credential=AKIA3V3MBG4KEF3MXKGR%2F20230307%2Fus-east-1%2Fs3%2Faws4_request&amp;X-Amz-Signature=85be92b2b49e2244c399b57550b7c590b96c1230ce8e29014b26a790418c6085
            </TempDownloadUri>
            <Size>2729</Size>
            <ContentType>application/pdf</ContentType>
        </Attachable>
        ...

Parsed XML object ($responseXmlObj DataService: 1028)

SimpleXMLElement::__set_state(array(
   '@attributes' => 
  array (
    'time' => '2023-03-07T09:41:54.383-08:00',
  ),
   'QueryResponse' => 
  SimpleXMLElement::__set_state(array(
     '@attributes' => 
    array (
      'startPosition' => '1',
      'maxResults' => '10',
    ),
     'Attachable' => 
    array (
      0 => 
      SimpleXMLElement::__set_state(array(
         '@attributes' => 
        array (
          'domain' => 'QBO',
          'sparse' => 'false',
        ),
         'Id' => '5000000000001184365',
         'SyncToken' => '0',
         'MetaData' => 
        SimpleXMLElement::__set_state(array(
           'CreateTime' => '2023-02-28T14:23:35-08:00',
           'LastUpdatedTime' => '2023-02-28T14:23:35-08:00',
        )),
         'AttachableRef' => 
        SimpleXMLElement::__set_state(array(
           'EntityRef' => '1',
           'IncludeOnSend' => 'false',
        )),
         'FileName' => 'Sample-1677623013.pdf',
         'FileAccessUri' => '/v3/company/4620816365162761880/download/5000000000001184365',
         'TempDownloadUri' => 'https://intuit-qbo-prod-19.s3.amazonaws.com/4620816365162761880/attachments/46b44f48-df7a-45cb-8222-67b959b8cadcSample-1677623013.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230307T174154Z&X-Amz-SignedHeaders=host&X-Amz-Expires=900&X-Amz-Credential=AKIA3V3MBG4KEF3MXKGR%2F20230307%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=6bb60622c95d73b80649709e4e59ffbd91567a1935a2101ef2fbc90150ff1ba7',
         'Size' => '2729',
         'ContentType' => 'application/pdf',
      )),
      ...

IPPAttachable object ($parsedResponseBody DataService:1031)

array (
  0 => 
  QuickBooksOnline\API\Data\IPPAttachable::__set_state(array(
     'FileName' => 'Sample-1677623013.pdf',
     'FileAccessUri' => '/v3/company/4620816365162761880/download/5000000000001184365',
     'TempDownloadUri' => 'https://intuit-qbo-prod-19.s3.amazonaws.com/4620816365162761880/attachments/46b44f48-df7a-45cb-8222-67b959b8cadcSample-1677623013.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230307T173547Z&X-Amz-SignedHeaders=host&X-Amz-Expires=900&X-Amz-Credential=AKIA3V3MBG4KEF3MXKGR%2F20230307%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=85be92b2b49e2244c399b57550b7c590b96c1230ce8e29014b26a790418c6085',
     'Size' => '2729',
     'ContentType' => 'application/pdf',
     'Category' => NULL,
     'Lat' => NULL,
     'Long' => NULL,
     'PlaceName' => NULL,
     'Note' => NULL,
     'Tag' => NULL,
     'ThumbnailFileAccessUri' => NULL,
     'ThumbnailTempDownloadUri' => NULL,
     'AttachableEx' => NULL,
     'Id' => '5000000000001184365',
     'SyncToken' => '0',
     'MetaData' => 
    QuickBooksOnline\API\Data\IPPModificationMetaData::__set_state(array(
       'CreatedByRef' => NULL,
       'CreateTime' => '2023-02-28T14:23:35-08:00',
       'LastModifiedByRef' => NULL,
       'LastUpdatedTime' => '2023-02-28T14:23:35-08:00',
       'LastChangedInQB' => NULL,
       'Synchronized' => NULL,
    )),
     'CustomField' => NULL,
     'AttachableRef' => 
    QuickBooksOnline\API\Data\IPPAttachableRef::__set_state(array(
       'EntityRef' => '1',
       'LineInfo' => NULL,
       'IncludeOnSend' => 'false',
       'CustomField' => NULL,
       'AttachableRefEx' => NULL,
    )),
     'domain' => NULL,
     'status' => NULL,
     'sparse' => NULL,
  )),
 ...

simplimation avatar Mar 07 '23 17:03 simplimation