【发布时间】:2017-05-09 23:56:18
【问题描述】:
首先:我正在使用https://github.com/consolibyte/quickbooks-php
我不小心断开了应用程序与“应用程序”页面的连接以尝试重新连接(获取新的身份验证凭据),但似乎这是一个错误。
所以现在我正在尝试再次完成授权过程,但是当我单击“docs/example_app_ipp_v3/”页面上的“连接到 QuickBooks”按钮时出现错误,如快速入门指南中所述.
这里有什么我遗漏的吗?我仍然可以通过 API 资源管理器进行查询,但是当我在代码中使用 $InvoiceService->query 时似乎无法取回任何数据(只是返回 false)。
//get invoice info
require_once '../includes/quickbooks-php/config.php';
// Set up the IPP instance
$IPP = new QuickBooks_IPP($dsn);
// Get our OAuth credentials from the database
$creds = $IntuitAnywhere->load($the_username, $the_tenant);
//error_reporting(0);
//ini_set('display_errors', 1);
// Tell the framework to load some data from the OAuth store
$IPP->authMode(
QuickBooks_IPP::AUTHMODE_OAUTH,
$the_username,
$creds);
// This is our current realm
$realm = $creds['qb_realm'];
// Load the OAuth information from the database
if ($Context = $IPP->context())
{
// Set the IPP version to v3
$IPP->version(QuickBooks_IPP_IDS::VERSION_3);
$CustomerService = new QuickBooks_IPP_Service_Customer();
$InvoiceService = new QuickBooks_IPP_Service_Invoice();
$ItemService = new QuickBooks_IPP_Service_Item();
$PaymentService = new QuickBooks_IPP_Service_Payment();
$invoice_query = $InvoiceService->query($Context, $realm, "SELECT *, Line.* FROM Invoice WHERE Id = '" .QuickBooks_IPP_IDS::usableIDType($main_invoice['qb_invoice_id']). "'");
$this_invoice = array();
var_dump($invoice_query);
if (count($invoice_query)){
foreach ($invoice_query as $Invoice){
//do stuff with invoice here
}
}
}
我从 var_dump($invoice_query) 得到 bool(false),即使它通过了 if($Context = $IPP->context())
然后,当我访问“docs/example_app_ipp_v3/”页面时,除了将配置更新为我当前的身份验证凭据之外什么都没有,“连接到 Quickbooks”按钮(下面的 html)会将我带到 404 页面。
<ipp:connecttointuit><a href="javascript:void(0)" class="intuitPlatformConnectButton">Connect with QuickBooks</a></ipp:connecttointuit>
【问题讨论】:
-
但是您没有发布任何代码,所以我们无法帮助您。发布您的代码。
-
@KeithPalmerJr。抱歉,已更新。
标签: php api quickbooks