/// <summary> /// Adds the country tax rule. /// This method adds a tax rule associated with a particular state. /// </summary> /// <param name="Area">The area.</param> /// <param name="TaxRate">The tax rate associated with a tax rule. Tax /// rates are expressed as decimal values. For example, a value of 0.0825 /// specifies a tax rate of 8.25%.</param> /// <example> /// <code> /// // We assume Req is a CheckoutShoppingCartRequest object. /// // Charge the 50 states 8% tax. /// Req.AddCountryTaxRule(AutoGen.USAreas.FULL_50_STATES, 0.08); /// // Charge the 48 continental states 5% tax. /// Req.AddCountryTaxRule(AutoGen.USAreas.CONTINENTAL_48, 0.05); /// // Charge all states (incl territories) 9% tax. /// Req.AddCountryTaxRule(AutoGen.USAreas.ALL, 0.09); /// </code> /// </example> public void AddCountryTaxRule(AutoGen.USAreas Area, double TaxRate) { AutoGen.AlternateTaxRule rule = new AutoGen.AlternateTaxRule(); rule.rateSpecified = true; rule.rate = TaxRate; rule.taxarea = new AutoGen.AlternateTaxRuleTaxarea(); AutoGen.USCountryArea ThisArea = new AutoGen.USCountryArea(); rule.taxarea.Item = ThisArea; ThisArea.countryarea = Area; _taxRules.Add(rule); }
/// <summary> /// Adds the country tax rule. /// This method adds a tax rule associated with a particular state. /// </summary> /// <param name="Area">The area.</param> /// <param name="TaxRate">The tax rate associated with a tax rule. Tax /// rates are expressed as decimal values. For example, a value of 0.0825 /// specifies a tax rate of 8.25%.</param> /// <param name="ShippingTaxed"> /// If this parameter has a value of <b>true</b>, then shipping costs will /// be taxed for items that use the associated tax rule. /// </param> /// <example> /// <code> /// // We assume Req is a CheckoutShoppingCartRequest object. /// // Charge the 50 states 8% tax and do not tax shipping. /// Req.AddCountryTaxRule(AutoGen.USAreas.FULL_50_STATES, 0.08, false); /// // Charge the 48 continental states 5% tax and do tax shipping. /// Req.AddCountryTaxRule(AutoGen.USAreas.CONTINENTAL_48, 0.05, true); /// // Charge all states (incl territories) 9% tax, don't tax shipping. /// Req.AddCountryTaxRule(AutoGen.USAreas.ALL, 0.09, false); /// </code> /// </example> public void AddCountryTaxRule(AutoGen.USAreas Area, double TaxRate, bool ShippingTaxed) { AutoGen.DefaultTaxRule Rule = new AutoGen.DefaultTaxRule(); Rule.rate = TaxRate; Rule.shippingtaxedSpecified = true; Rule.shippingtaxed = ShippingTaxed; Rule.taxarea = new AutoGen.DefaultTaxRuleTaxarea(); AutoGen.USCountryArea ThisArea = new AutoGen.USCountryArea(); Rule.taxarea.Item = ThisArea; ThisArea.countryarea = Area; AddNewTaxRule(Rule); }
/// <summary> /// This method adds an excluded U.S. country area to a /// <us-country-area> element. The <us-country-area> element, /// in turn, appears as a subelement of <excluded-areas>. /// </summary> /// <param name="CountryArea">The country area.</param> public void AddExcludedCountryArea(AutoGen.USAreas CountryArea) { AutoGen.USCountryArea NewArea = new AutoGen.USCountryArea(); NewArea.countryarea = CountryArea; AddNewExcludedArea(NewArea); }