Open spencerwasden opened 2 years ago
I fixed this by editing the CDC function in DataService.php Find the following for block:
for($i = 0; $i < sizeof($responseArray); $i++){ $currentResponse = $responseArray[$i]; $currentEntityName = $entityList[$i]; $entities = $this->responseSerializer->Deserialize($currentResponse->asXML(), false); $entityName = $currentEntityName; //If we find the actual name, update it. foreach ($currentResponse->children() as $currentResponseChild) { $entityName = (string)$currentResponseChild->getName(); break; } $returnValue->entities[$entityName] = $entities; }
Add:
$j = 0; foreach($currentResponse as $item){ if($item->attributes()->status == "Deleted"){ $entities[$j]->status = "Deleted"; } $j++; }
Result:
for($i = 0; $i < sizeof($responseArray); $i++){ $currentResponse = $responseArray[$i]; $currentEntityName = $entityList[$i]; $entities = $this->responseSerializer->Deserialize($currentResponse->asXML(), false); $entityName = $currentEntityName; $j = 0; foreach($currentResponse as $item){ if($item->attributes()->status == "Deleted"){ $entities[$j]->status = "Deleted"; } $j++; } //If we find the actual name, update it. foreach ($currentResponse->children() as $currentResponseChild) { $entityName = (string)$currentResponseChild->getName(); break; } $returnValue->entities[$entityName] = $entities; }
Hope this helps
I have a deleted payment in QBO. When I query for modified payments since a certain date with DataService::CDC, the response XML indicates the deleted status (see
status="Deleted"
inPayment
element):However, the
status
member in the corresponding returned object of DataService::CDC is null (see print_r results of CDC's$returnValue
below). Should it not reflect the status attribute in the XML above? I would like to be able to query for payments (possibly other types as well) using the CDC function and, while iterating through them, know explicitly which are deleted (without having to use webhooks). The docs say "Deleted entities return a Deleted value for the status field." (https://developer.intuit.com/app/developer/qbo/docs/learn/explore-the-quickbooks-online-api/change-data-capture)