创建Quickbooks的API检查(Create Checks with Quickbooks A

2019-10-18 07:03发布

请帮我写上使用QuickBooks的在线(QBO)API检查。 我想这样做,但我一直都想与一个错误说“错误验证详图线:至少需要一个详细的路线” 示例代码在下面。我应该如何添加对检查线路。

                    Dim existingChk = New Qbo.Check()
                    Dim existingChks = commonService.FindAll(existingChk, 1, 10).ToList()

                    Dim payment = New Qbo.Payment()
                    Dim payments = commonService.FindAll(payment, 1, 10).ToList()

                    Dim qboCheck = New Intuit.Ipp.Data.Qbo.CheckHeader()
                    Dim bank = New Intuit.Ipp.Data.Qbo.Account()
                    bank.Type = Intuit.Ipp.Data.Qbo.AccountTypeEnum.Asset
                    Dim Banks = commonService.FindAll(bank, 1, 100).ToList()
                    Dim accountId As New Qbo.IdType
                    For Each bnk As Intuit.Ipp.Data.Qbo.Account In Banks
                        If bnk.Name = "Test Bank" Then
                            accountId = bnk.Id
                        End If
                    Next
                    qboCheck.BankAccountId = accountId
                    qboCheck.BankAccountName = "Test Bank"
                    qboCheck.TotalAmt = 20.0
                    qboCheck.Currency = Intuit.Ipp.Data.Qbo.currencyCode.USD
                    qboCheck.TxnId = payments(0).Id
                    Dim qboCustomer = New Intuit.Ipp.Data.Qbo.Customer()
                    Dim qboCustomers = commonService.FindAll(qboCustomer, 1, 10).ToList()
                    For Each cus As Intuit.Ipp.Data.Qbo.Customer In qboCustomers
                        If cus.Name.Contains("Customer1") Then
                            qboCheck.EntityId = cus.Id
                        End If
                    Next
                    qboCheck.EntityType = Qbo.EntityTypeEnum.Customer

                    Dim check = New Intuit.Ipp.Data.Qbo.Check()
                    check.Header = qboCheck
                    check.Id = New Qbo.IdType
                    check.Id.idDomain = existingChks(0).Id.idDomain
                    check.Id.Value = CInt(existingChks(0).Id.Value) + 1

                    Dim resultCheck As Qbo.Check = TryCast(commonService.Add(check), Qbo.Check)

Answer 1:

看起来它是在.NET的devkit(我不是100%确定)的错误。 JavaDoc中说帐户ID和的itemId两者都从LinePurchase(PFB快照)继承。 但是在.NET的devkit,我没有看到无论是在LinePurchase也不LineBase这些领域。

JavaDoc的文献- http://developer-static.intuit.com/SDKDocs/QBV2Doc/ipp-java-devkit-2.0.10-SNAPSHOT-javadoc/

API端点工作的罚款。

https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0400_quickbooks_online/check#Sample_Create_Request_XML

<?xml version="1.0" encoding="utf-8" ?>
<Check xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://www.intuit.com/sb/cdm/v2">
    <Header>
        <TxnDate>2013-08-09</TxnDate>
        <BankAccountId>44</BankAccountId>
        <EntityId>2</EntityId>
    </Header>
    <Line>
        <Desc>Hard Disks</Desc>
        <Amount>500</Amount>
        <BillableStatus>NotBillable</BillableStatus>
        <ItemId>4</ItemId>
        <Qty>10</Qty>
        <UnitPrice>50</UnitPrice>
    </Line>
</Check>

PN -

<BankAccountId>此帐户应该是“检查”类型。

<ItemId>项目应该有一个“ExpenseAccountRef”标记。

您可以测试这个用例,使用ApiExplorer工具。

链接- https://developer.intuit.com/apiexplorer?apiname=V2QBO

如果可能的话我会尝试在周一这个使用.NET的devkit,并确认它是否在.net中的devkit的错误。

谢谢



Answer 2:

添加的伪码C#进行BillpaymentHeader。

同样,你可以用它来CheckLine:

   billheader.ItemsElementName = new ItemsChoiceType[1];
   billheader.ItemsElementName[0] = ItemsChoiceType.BankAccountId;
   billheader.Items = new object[1];
   billheader.Items[0] = new Intuit.Ipp.Data.Qbo.IdType() { idDomain = Intuit.Ipp.Data.Qbo.idDomainEnum.QBO, Value = "1" };

Refer- 如何添加帐户ID或项目ID QuickBooks中创建检查时



Answer 3:

如果你有法案已经那么你可以简单地使用billpayment API来创建检查。 网址: https://quickbooks.api.intuit.com/v3/company/111111111111/billpayment?minorversion=4

请求JSON数据:

{
  "VendorRef": {
    "value": "1",
    "name": "vendor_name"
  },
  "PayType": "Check",
  "CheckPayment": {
    "BankAccountRef": {
      "value": "1",
      "name": "Test Account"
    }
  },
  "TotalAmt": 100.00,
  "PrivateNote": "Acct. 1JK90",
  "Line": [
    {
      "Amount": 100.00,
      "LinkedTxn": [
        {
          "TxnId": "1",
          "TxnType": "Bill"
        }
      ]
    }
  ]
}


文章来源: Create Checks with Quickbooks API