Open shawncrigger opened 3 years ago
Since no one has any clue, I found the SDK is not stable in any fashion. However, you can get around this lovely undocumented feature by inserting TaxAgency in batch, but not TaxRate/TaxCode those only work in a single entry. You can send a batch, and it won't error out, but it won't generate anything either. Quality code
What I did to get around adding 1 TaxAgency was send a freaking batch with just one entry, and it worked. The below code is some of my prototype code. I'm sure you can sort out how to make it work in your application.
Also, I am using QBO SDK 5.4.4 when I upgraded to the latest stable, the log file stopped working along with a host of other bugs.
<?php
// Agency does not exist
if (!is_numeric($AgencyID)) {
// Create new batch service
$batch = $this->dataService->CreateNewBatch();
// My agent name
$agent = $obj['taxable_agency'];
$taxAgency = TaxAgency::create(array(
'DisplayName' => $agent,
));
// Add to the batch
$batch->AddEntity($taxAgency, "agency-1", "create");
// Execute batch API request
$batch->ExecuteWithRequestID("batch-number-1");
// Fetch API response
$temp = $batch->intuitBatchItemResponses["agency-1"];
if ($temp->isSuccess()) {
UTIL::out("Create TaxAgency {$agent} success!:");
// Get the results
$result = $temp->getResult();
// Set the Agent Id
$AgencyID = $result->Id;
// Insert it into my database.
$this->insertTaxAgency($obj, $result->Id);
}
}
If you need help with your QBO API, I don't have time to help right now, maybe in the future.
The logging issue is now fixed with the release v5.4.7. We will look into the taxAgency
endpoint and update the documentation/sample accordingly.
Can you explain to me why when I send tax information it doesn't show up in the sandbox but does in the JSON request/response?
Hello, I am having constant issues when adding TaxAgencies, I got around it the first time by inserting them in Batches but I am at a point where I have to be able to create a single agency when creating a TaxCode, when I attempt to add the agency using code like
I get the following error, which is strange because according to the API Explorer for TaxAgency XML is not supported, and according to the request log a JSON object was sent but the response is looking for a XML response. Is there another way to do this besides insert them in batch that hasn't been documented?
Here are the log files for the request and the response
Request Log File
Response Log File