我很难弄清楚这里到底出了什么问题-我没有从错误的错误请求中获得很多见解-这是我的代码:
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 的属性。
有人有这方面的工作示例吗?