public ITaxProviderResult GetTax(DocumentType docType, string companyCode, string docCode, BaseAddress originationAddress, BaseAddress destinationAddress, List <Line> items, decimal orderDiscount, string customerCode, string currencyCode, bool taxExempt, string taxExemptionNumber, bool applyVATRules) { var result = new MyTaxProviderResult(); // Write down business logic here to get the tax. var suceed = false; if (!suceed) { result.Success = false; result.Messages.Add("Get Tax Failed"); // end user can add more messages whatever returned from tax provider as messages variable is list of string } else { result.Success = true; result.DocCode = "123"; result.TotalAmount = 50; result.TotalTax = 5; // shipping line is always present ( even if 0 ) // so the last item is shipping for (var i = 0; i < 2; i++) { if (i < 2) { var lineResult = new MyTaxProviderLineResult { No = "abc", TaxRate = 10, TaxValue = 20 }; result.Items.Add(lineResult); } else { result.ShippingTax = 10; result.ShippingTaxRate = 20; } } result.ItemsTax = result.TotalTax - result.ShippingTax; } return(result); }
public ITaxProviderResult TestConnection() { var result = new MyTaxProviderResult(); // Write down business logic here to test the tax provider settings . var suceed = false; if (!suceed) { result.Success = false; result.Messages.Add("Test connection Failed"); // end user can add more messages whatever returned from tax provider as messages variable is list of string } else { result.Success = true; } return(result); }
public ITaxProviderResult CommitTax(string companyCode, string docCode, DocumentType docType) { var result = new MyTaxProviderResult(); // Write down business logic here to commit the tax. var suceed = false; if (!suceed) { result.Success = false; result.Messages.Add("CommitTax Failed"); // end user can add more messages whatever returned from tax provider as messages variable is list of string } else { result.Success = true; } return(result); }
public ITaxProviderResult PostTax(string companyCode, string docCode, DocumentType docType, decimal totalAmount, decimal totalTax) { var result = new MyTaxProviderResult(); // Write down business logic here to post the tax . var suceed = false; if (!suceed) { result.Success = false; result.Messages.Add("Post Tax Failed"); // end user can add more messages whatever returned from tax provider as messages variable is list of string } else { result.DocCode = "123"; result.TotalAmount = 123; result.TotalTax = 10; } return(result); }