dongxie8906 2015-12-14 06:14
浏览 51
已采纳

CoreHelper.php第95行中的QuickBooks IdsException

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
  • 写回答

1条回答 默认 最新

  • dongshan8953 2015-12-14 06:33
    关注

    My problem was that I hadn't updated sdk.config to use the Sandbox URL.

    <baseUrl qbd="https://sandbox-quickbooks.api.intuit.com/" qbo="https://sandbox-quickbooks.api.intuit.com/" ipp="https://appcenter.intuit.com/api/" />
    

    Now I'll just have to figure out a way to automatically use the appropriate URL based on the environment…

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?