Quickbooks错误:业务验证错误:此帐号已存在于QuickBooks帐户图表中

时间:2017-01-31 21:29:57

标签: php quickbooks quickbooks-online

我使用Quickbooks PHP DevKit库在Quickbooks中创建发票。 我正在使用法国沙盒公司,我有这样的错误消息: 业务验证错误:此帐号已存在于QuickBooks帐户图表中。输入另一个号码。

我认为发票数据中缺少某些内容,但我找不到内容!

下面是我的代码(我使用DevKit中提供的示例作为基础):

$customerRef = '16'; 
$itemRef = '1';
$taxCodeRef = '31';

$InvoiceService = new QuickBooks_IPP_Service_Invoice();

$Invoice = new QuickBooks_IPP_Object_Invoice();

$Line = new QuickBooks_IPP_Object_Line();
$Line->setDetailType('SalesItemLineDetail');
$Line->setAmount(20.0000 * 1.0000 * 0.516129);
$Line->setDescription('Test description goes here.');

$SalesItemLineDetail = new QuickBooks_IPP_Object_SalesItemLineDetail();
$SalesItemLineDetail->setItemRef( $itemRef );
$SalesItemLineDetail->setUnitPrice(20 * 0.516129);
$SalesItemLineDetail->setQty(1.00000);
$SalesItemLineDetail->setTaxCodeRef( $taxCodeRef );

$Line->addSalesItemLineDetail($SalesItemLineDetail);

$Invoice->addLine($Line);

$Invoice->setCustomerRef( $customerRef );


if ($resp = $InvoiceService->add($Context, $realm, $Invoice))
{
    print('Our new Invoice ID is: [' . $resp . ']');
}
else
{
    print($InvoiceService->lastError());
}

这里可能缺少什么?

我添加了发送给Quickbooks的请求和收到的回复:

请求:

<Invoice xmlns="http://schema.intuit.com/finance/v3">
    <Line xmlns="http://schema.intuit.com/finance/v3">
        <Amount>10.32258</Amount>
        <DetailType>SalesItemLineDetail</DetailType>
        <Description>Test description goes here.</Description>
        <SalesItemLineDetail xmlns="http://schema.intuit.com/finance/v3">
            <ItemRef>1</ItemRef>
            <UnitPrice>10.32258</UnitPrice>
            <Qty>1</Qty>
            <TaxCodeRef>31</TaxCodeRef>
        </SalesItemLineDetail>
    </Line>
    <CustomerRef>16</CustomerRef>
</Invoice>

响应:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2017-02-01T02:08:16.198-08:00">
    <Fault type="ValidationFault">
        <Error code="6000" element="">
            <Message>A business validation error has occurred while processing your request</Message>
            <Detail>Business Validation Error: Ce numéro de compte existe déjà dans le plan comptable de QuickBooks. Entrez un autre numéro.</Detail>
        </Error>
    </Fault>
</IntuitResponse>

Item id = 1

的响应
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2017-02-01T09:28:05.599-08:00">
    <QueryResponse startPosition="1" maxResults="1">
        <Item domain="QBO" sparse="false">
            <Id>1</Id>
            <SyncToken>1</SyncToken>
            <MetaData>
                <CreateTime>2017-01-10T23:31:30-08:00</CreateTime>
                <LastUpdatedTime>2017-01-18T07:00:19-08:00</LastUpdatedTime>
            </MetaData>
            <Name>Ventes bonbons</Name>
            <Description>Frandises 100g</Description>
            <Active>true</Active>
            <FullyQualifiedName>Ventes bonbons</FullyQualifiedName>
            <Taxable>false</Taxable>
            <SalesTaxIncluded>false</SalesTaxIncluded>
            <UnitPrice>10</UnitPrice>
            <Type>Service</Type>
            <IncomeAccountRef name="701100 Ventes de Produits finis (ou groupe) A 20%">71</IncomeAccountRef>
            <PurchaseTaxIncluded>false</PurchaseTaxIncluded>
            <PurchaseCost>5</PurchaseCost>
            <ExpenseAccountRef name="607100 Achats de Marchandises (ou groupe) A">29</ExpenseAccountRef>
            <TrackQtyOnHand>false</TrackQtyOnHand>
            <SalesTaxCodeRef name="SalesTaxCodeRef">31</SalesTaxCodeRef>
            <PurchaseTaxCodeRef name="PurchaseTaxCodeRef">31</PurchaseTaxCodeRef>
            <ItemCategoryType>Product</ItemCategoryType>
        </Item>
    </QueryResponse>
</IntuitResponse>

提前感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

最后,我从QuickBooks得到了一个沙盒法国公司的错误。在生产模式下使用试用帐户,我没有问题。