我很難弄清楚到底發生了什麼錯誤 - 我沒有從錯誤中得到很多信息 - 錯誤的請求 - 這裏是我的代碼:用於QuickBooks v3.0的IPP .NET SDK創建發票錯誤 - 錯誤的請求
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerSecret);
ServiceContext context = new ServiceContext(appToken, companyID, IntuitServicesType.QBO, oauthValidator);
DataService service = new DataService(context);
Customer customer = new Customer();
customer.GivenName = "Mary " + DateTime.Now.Second;
customer.Title = "Ms.";
customer.MiddleName = "Jayne";
customer.FamilyName = "Cooper";
customer.CompanyName = "Mary " + DateTime.Now.Second;
Customer resultCustomer = service.Add(customer) as Customer;
Invoice invoice = new Invoice();
//Mandatory fields
invoice.DocNumber = Guid.NewGuid().ToString("N").Substring(0, 10);
invoice.TxnDate = DateTime.Today.Date;
invoice.TxnDateSpecified = true;
invoice.CustomerRef = new ReferenceType()
{
Value = resultCustomer.Id
};
Line invLine = new Line();
invLine.Amount = 10000;
invLine.DetailType = LineDetailTypeEnum.SalesItemLineDetail;
invLine.Description = "Test Product";
invoice.Line = new Line[] { invLine };
Invoice resutlInvoice = service.Add(invoice) as Invoice;
var invId = resutlInvoice.Id;
基本上我產生一個新的客戶(其中正常工作),然後我想爲他們創造上有一個單一的項目的發票。
看什麼XML文檔指出這裏: http://ippdocs.intuit.com/0025_QuickBooksAPI/0050_Data_Services/V3/030_Entity_Services_Reference/Invoice
的NuGet包丟失了一些東西,我知道不能是真實的 - 形成文檔:
<Invoice xmlns="http://schema.intuit.com/finance/v3">
<Line>
<Amount>15</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef>1</ItemRef>
</SalesItemLineDetail>
</Line>
<CustomerRef>67</CustomerRef>
</Invoice>
的Line
對象我從此SDK獲取沒有SalesItemLineDetail或ItemRef的屬性。
任何人都有這樣的工作示例?
你也必須標記這被設置爲像AmountSpecified和DetailTypeSpecified必須設置爲真 - 奇怪,但它工作 – Slee
@Slee:我看不到DetailTypeSpecified屬性?您使用的是哪個版本的SDK? –
我使用通過NuGet引用的V3:https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v3 – Slee