Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Intuit api估计更新500错误_Php_Intuit Partner Platform_Quickbooks Online - Fatal编程技术网

Php Intuit api估计更新500错误

Php Intuit api估计更新500错误,php,intuit-partner-platform,quickbooks-online,Php,Intuit Partner Platform,Quickbooks Online,我正在尝试将我们的应用程序与intuit/quickbooks集成,并且到目前为止已经取得了巨大的成功。我正在使用以下库来帮助集成: (2.0稳定) 我不得不修改代码以使更新调用正常工作。基本上,它传递的是未设置的自定义字段,通过在QuickBooks\u IPP\u服务中取消设置这些字段::\u update,我能够让客户更新按预期工作。我为此项目向github repo发出了一个pull请求,显示了以下修复: github.com/consolibyte/quickbooks-php/pu

我正在尝试将我们的应用程序与intuit/quickbooks集成,并且到目前为止已经取得了巨大的成功。我正在使用以下库来帮助集成:

(2.0稳定)

我不得不修改代码以使更新调用正常工作。基本上,它传递的是未设置的自定义字段,通过在QuickBooks\u IPP\u服务中取消设置这些字段::\u update,我能够让客户更新按预期工作。我为此项目向github repo发出了一个pull请求,显示了以下修复: github.com/consolibyte/quickbooks-php/pull/6

我的下一个目标是将估计推送到Intuit。EstimateService对象看起来不完整,所以我添加了update函数,从CustomerService对象复制它。它们都依赖于父服务对象来实际执行操作,所以我希望它能正常工作

嗯,没有

有趣的是,我一辈子都不明白为什么,如果有人能帮助我,我将永远感激

当我捕获输出并将其放入“intuit api资源管理器”时,它就工作了!实际上,从Intuit端传递到服务器的相同xml会产生一条200的成功消息,但从我的角度来看,它会被500个内部服务器错误阻塞。不是最具描述性的错误消息:)

下面是一个示例调用(编辑以删除安全信息): 每个控制台字节请求的$Service->lastRequest()输出:

POST https://qbo.intuit.com/qbo27/resource/customer/v2/**realm**/1 HTTP/1.1
Content-Type: application/xml
Authorization: OAuth realm="", oauth_signature_method="HMAC-SHA1", oauth_signature="****", oauth_nonce="***", oauth_timestamp="1379677509", oauth_token="****", oauth_consumer_key="***", oauth_version="1.0"
Content-Length: 952

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Estimate xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:ns2="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:ns3="http://www.intuit.com/sb/cdm/qbo">
<Id idDomain="QBO">1</Id>
<SyncToken>4</SyncToken>
<Header>
    <DocNumber>1001</DocNumber>
    <TxnDate>2013-09-19-07:00</TxnDate>
    <Status>Pending</Status>
    <CustomerId idDomain="QBO">28</CustomerId>
    <SalesTaxCodeId idDomain="QBO">1</SalesTaxCodeId>
    <SalesTaxCodeName>IS_TAXABLE</SalesTaxCodeName>
    <SubTotalAmt>3.00</SubTotalAmt>
    <TaxAmt>0.21</TaxAmt>
    <TotalAmt>3.00</TotalAmt>
</Header>
<Line>
    <Desc>test 2</Desc>
    <Amount>2.00</Amount>
    <Taxable>true</Taxable>
    <UnitPrice>2.00</UnitPrice>
    <Qty>1</Qty>
</Line>
<Line>
    <Desc>TEst</Desc>
    <Amount>1.00</Amount>
    <Taxable>true</Taxable>
    <UnitPrice>1.00</UnitPrice>
    <Qty>1</Qty>
</Line>
<Synchronized>false</Synchronized>

应从您的请求中删除同步标记。QBO将数据直接同步到云,因此这是一个不正确的字段。它仅用于发出QBD请求。 在这里检查请求-

我同意它可能在API资源管理器上工作,因为资源管理器必须忽略它,并且只考虑必需的字段。API资源管理器不使用SDK。所以,你不会得到错误。
但是,当您使用SDK连接时,您传递了错误的请求xml,因此会出现错误。

基于请求的这一部分:

POST https://qbo.intuit.com/qbo27/resource/customer/v2/**realm**/1 HTTP/1.1
看起来您可能正在使用
QuickBooks\u IPP\u Service\u Customer
实例来尝试添加估算值

您确定使用的是正确的服务类实例吗


你能偶然发布一段代码吗?

你能发布print($Service->lastRequest())的输出吗;并打印($Service->lastResponse());?这将显示PHP DevKit发送给Intuit的内容,以及从Intuit得到的信息。使用它,我们应该能够找到问题所在。非常感谢您抽出时间!我在$Service->lastReesponse()输出中添加了$Service->lastReesponse()输出。我还有其他调用可以正常工作,所以我假设HTTP头已经设置好并且工作正常。我已经删除了Synchronized标记,它返回了相同的错误。啊,是在我从ServiceCustomer类复制更新函数时,我没有更新QuickBooks\u IPP\u ID::RESOURCE\u ESTIMATE,并将其保留为QuickBooks\u IPP\u IDS::RESOURCE\u CUSTOMER。非常感谢你!呜呼!如果你能给我发电子邮件,告诉我你所做的任何更改,那就太好了,我也可以把这些更改合并到我们的夜间版本中!
//login info/OAuth is setup before this and I know it works
//I use it elsewhere to successfully add the estimate in the same class
//also i'm able to add/edit/update customers with the same auth code
$this->EstimateService = new QuickBooks_IPP_Service_Estimate();
$Estimate = $this->EstimateService->findById($this->Context, $this->realm, $quickbooks_id);

$Header = $Estimate->getHeader();
$Header->setTaxAmt(number_format($tax_amount, 2));
$Header->setCustomerId($qb_customer_id);
$Header->setTotalAmt(number_format($total_amount, 2));

//this was added when I was trying to figure out what is going on
//Adding this section did not change the status returned from intuit
$Header->remove('BillAddr');
$Header->remove('ShipAddr');
$Header->remove('ToBePrinted');
$Header->remove('ToBeEmailed');
$Header->remove('DiscountTaxable');

$Estimate->setHeader($Header);
//remove all lines from the current estimate to re-add in updated ones  
$Estimate->remove('Line');
foreach($line_items as $item)
{
    $Line = new QuickBooks_IPP_Object_Line();
$Line->setDesc($item['description']);
    if($item['tax_percentage'])
{
        $Line->setTaxable('true');
    }
    $Line->setUnitPrice($item['price']);
    $Line->setQty($item['quantity']);
    $Line->setAmount(number_format(($item['price'] * $item['quantity']), 2));
    $Estimate->addLine($Line);
 }

 //$this->Context, $this->realm are set up properly and work
 $this->EstimateService->update($this->Context, $this->realm, $Estimate->getId(), $Estimate);
POST https://qbo.intuit.com/qbo27/resource/customer/v2/**realm**/1 HTTP/1.1