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 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?