在GitHub上更新开源QuickBooks PHP DevKit中的付款

时间:2014-06-12 10:27:45

标签: quickbooks

我在GitHub上使用开源QuickBooks PHP DevKit。我正在尝试更新付款。但是我收到错误“ERROR!2030:[ID无效,Id应该是有效数字。提供的值:{ - 17}]”

我给出的代码如下所示 首先在Quickbooks / IPP / Service / Payment.php中添加了更新功能的代码,如下所示:

public function update($Context, $realm, $IDType, $Object)
{
    return parent::_update($Context, $realm, QuickBooks_IPP_IDS::RESOURCE_PAYMENT, $Object, $IDType);
}

之后在payment_update.php页面中,我添加了以下代码:

$IPP->version(QuickBooks_IPP_IDS::VERSION_3);

$PaymentService = new QuickBooks_IPP_Service_Payment();

$payments = $PaymentService->query($Context, $realm, "SELECT * FROM Payment where Id='27'");
$Payment = $payments[0];        
$Payment->setPaymentRefNum("5Update");



if ($resp = $PaymentService->update($Context, $realm, $Payment->getId(), $Payment))
{
    print('Updated the item name to ' . $Payment->getTotalAmt());
}
else
{
    print('ERROR!');
    print($PaymentService->lastError($Context));
}

我是否需要在类文件中添加任何其他更改以更新付款。请告知我如何更新付款和线。

请求:

POST https://quickbooks.api.intuit.com/v3/company/1214054285/payment HTTP/1.1
Content-Type: application/xml
Authorization: OAuth realm="", oauth_signature_method="HMAC-SHA1", oauth_signature="XXXX",  oauth_nonce="zVYx5", oauth_timestamp="1402573818", oauth_token="XXXX", oauth_consumer_key="XXXXX", oauth_version="1.0"
Content-Length: 1023

<Payment xmlns="http://schema.intuit.com/finance/v3">
    <Id>27</Id>
    <SyncToken>1</SyncToken>
    <MetaData xmlns="http://schema.intuit.com/finance/v3">
        <CreateTime>2014-06-12T00:36:12-07:00</CreateTime>
        <LastUpdatedTime>2014-06-12T00:37:44-07:00</LastUpdatedTime>
    </MetaData>
    <Line xmlns="http://schema.intuit.com/finance/v3">
        <Amount>12.00</Amount>
        <LinkedTxn xmlns="http://schema.intuit.com/finance/v3">
            <TxnId>{-17}</TxnId>
            <TxnType>Invoice</TxnType>
        </LinkedTxn>
    </Line>
    <Line xmlns="http://schema.intuit.com/finance/v3">
        <Amount>5.00</Amount>
        <LinkedTxn xmlns="http://schema.intuit.com/finance/v3">
            <TxnId>{-13}</TxnId>
            <TxnType>Invoice</TxnType>
        </LinkedTxn>
    </Line>
    <TxnDate>2014-05-11</TxnDate>
    <CurrencyRef>USD</CurrencyRef>
    <CustomerRef>12</CustomerRef>
    <DepositToAccountRef>18</DepositToAccountRef>
    <PaymentRefNum>5Update</PaymentRefNum>
    <TotalAmt>17.00</TotalAmt>
    <UnappliedAmt>0</UnappliedAmt>
    <ProcessPayment>false</ProcessPayment>
</Payment>

响应:

HTTP/1.1 400 Bad Request
Date: Thu, 12 Jun 2014 11:49:09 GMT
Content-Type: application/xml
Content-Length: 285
intuit_tid: ae570ca6-4f46-4132-978d-f12f394c50d2
Content-Encoding: gzip
Via: 1.1 ipp-gateway-.net
Vary: Accept-Encoding
Connection: close

1 个答案:

答案 0 :(得分:0)

这在几个月前的更新中得到修复。

请使用GitHub的最新代码,您应该全部设置: