public void CreateSupplierInvoice()
        {
            var supplierId = 0;
            var itemId = 0;
            var taxTypeId = 0;

            SupplierInvoice po = new SupplierInvoice();
            var supplier = Api.SupplierRequest.Get(supplierId);

            po.SupplierId = supplierId;
            po.SupplierName = supplier.Name;
            po.Date = DateTime.Now;
            po.DueDate = DateTime.Now.AddDays(7);

            po.Lines = new List<CommercialDocumentLine>();
            var line1 = new CommercialDocumentLine
            {
                SelectionId = itemId, // This must be an item or account id
                TaxTypeId = taxTypeId, // Use TaxTypeRequest to get list of Tax Types
                LineType = 0, // 0=Item/1=Account -> See Enums.CommercialDocumentLineType
                Quantity = 1,
                UnitPriceExclusive = 390,
                UnitPriceInclusive = 390,
                DiscountPercentage = 0
            };

            po.Lines.Add(line1);

            var newSupplierInvoice = supplierInvoiceRequest.Save(po);
            Assert.IsTrue(supplierInvoiceRequest.StatusCode == HttpStatusCode.Created);
        }
 public SupplierInvoice Calculate(SupplierInvoice invoice)
 {
     var url = string.Format("SupplierInvoice/Calculate?apikey={0}&companyid={1}", _apiKey, _companyId);
     var request = new RestRequest(url, Method.POST) { JsonSerializer = new JsonSerializer() };
     request.RequestFormat = DataFormat.Json;
     request.AddBody(invoice);
     var response = _client.Execute<SupplierInvoice>(request);
     StatusDescription = response.StatusDescription;
     StatusCode = response.StatusCode;
     return response.Data;
 }