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 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计