Beispiel #1
0
        protected virtual TaxSubTotal GetTaxSubTotal(TaxLine taxLine, TaxJurisdiction taxJurisdiction, string currencyCode)
        {
            Assert.ArgumentNotNull(taxLine, "taxLine");
            Assert.ArgumentNotNull(taxJurisdiction, "taxJurisdiction");
            Assert.ArgumentNotNullOrEmpty(currencyCode, "currencyCode");

            var total = OrderFactory.CreateTaxSubTotal();

            total.TaxableAmount = OrderFactory.CreateAmount(taxLine.TaxedAmount, currencyCode);
            total.TaxAmount     = OrderFactory.CreateAmount(taxJurisdiction.Tax, currencyCode);
            total.TransactionCurrencyTaxAmount = OrderFactory.CreateAmount(taxJurisdiction.Tax, currencyCode);

            var category = OrderFactory.CreateTaxCategory();

            category.ID              = taxLine.ProductCode; // This will be either the actual product code for product tax, "SHIPPING" for shipping tax, or "HANDLING" for handling tax
            category.Name            = taxLine.Type;        // This will be populated for VAT, blank for North America tax
            category.Percent         = taxJurisdiction.Rate * 100;
            category.BaseUnitMeasure = OrderFactory.CreateMeasure();
            category.PerUnitAmount   = OrderFactory.CreateAmount(0M, currencyCode);

            var scheme = OrderFactory.CreateTaxScheme();

            scheme.CurrencyCode = currencyCode;
            scheme.ID           = taxJurisdiction.Name;
            scheme.Name         = taxJurisdiction.Name;
            scheme.TaxTypeCode  = taxJurisdiction.Type;

            category.TaxScheme = scheme;
            total.TaxCategory  = category;

            return(total);
        }