I'm working with the QuickBooks v3 PHP SDK 2.3.0. I used The PHP League's OAuth 1.0 client instead of going about it the SDK's way, because it's much simpler. That shouldn't really matter, though. I successfully authorized my app and saved the credentials.
However when I follow the examples in the docs, nothing seems to work properly.
In each example below, I use the following code to get set up:
require_once(Path::assemble(
$this->getDirectory(),
'vendor/QuickBooks/v3-php-sdk-2.3.0/',
'config.php'
));
require_once(PATH_SDK_ROOT . 'Core/ServiceContext.php');
require_once(PATH_SDK_ROOT . 'DataService/DataService.php');
require_once(PATH_SDK_ROOT . 'PlatformService/PlatformService.php');
require_once(PATH_SDK_ROOT . 'Utility/Configuration/ConfigurationManager.php');
$tokenCredentials = $this->storage->getYAML('quickbooks/token.yaml');
$consumerCredentials = [
'key' => $this->getConfig('oauth_consumer_key'),
'secret' => $this->getConfig('oauth_consumer_secret'),
];
$requestValidator = new \OAuthRequestValidator(
array_get($tokenCredentials, 'identifier'),
array_get($tokenCredentials, 'secret'),
array_get($consumerCredentials, 'key'),
array_get($consumerCredentials, 'secret')
);
$oauth_response = $this->storage->getYAML('quickbooks/response.yaml');
$realmId = array_get($oauth_response, 'realmId');
$serviceType = \IntuitServicesType::QBD;
$serviceContext = new \ServiceContext($realmId, $serviceType, $requestValidator);
$dataService = new \DataService($serviceContext);
If I dump and die $dataService
, I get my DataService
object. However any query I try to perform returns null
:
$dataService->Query('SELECT * FROM Customer');
$dataService->Query('SELECT count (*) FROM Vendor');
$dataService->FindAll('Customer', 1, 10);
$dataService->Query('SELECT * FROM *');
This final example is what throws the IdsException
:
$customerObj = new \IPPCustomer();
$customerObj->Name = "Name" . rand();
$customerObj->CompanyName = "CompanyName" . rand();
$customerObj->GivenName = "GivenName" . rand();
$customerObj->DisplayName = "DisplayName" . rand();
$resultingCustomerObj = $dataService->Add($customerObj);
error:
/DataService/DataService.php - 463 - CheckNullResponseAndThrowException - Response Null or Empty