/// <summary> /// This method adds a tax rule associated with a zip code pattern. /// </summary> /// <param name="ZipPattern">The zip pattern.</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> public void AddZipTaxRule(string ZipPattern, double TaxRate) { if (!CheckoutShoppingCartRequest.IsValidZipPattern(ZipPattern)) { throw new ApplicationException( CheckoutShoppingCartRequest.ZIP_CODE_PATTERN_EXCEPTION ); } AutoGen.AlternateTaxRule rule = new AutoGen.AlternateTaxRule(); rule.rateSpecified = true; rule.rate = TaxRate; rule.taxarea = new AutoGen.AlternateTaxRuleTaxarea(); AutoGen.USZipArea Area = new AutoGen.USZipArea(); rule.taxarea.Item = Area; Area.zippattern = ZipPattern; _taxRules.Add(rule); }
/// <summary> /// This method adds a tax rule associated with a zip code pattern. /// </summary> /// <param name="ZipPattern">The zip pattern.</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> public void AddZipTaxRule(string ZipPattern, double TaxRate, bool ShippingTaxed) { if (!IsValidZipPattern(ZipPattern)) { throw new ApplicationException("Zip code patterns must be five " + "numeric characters, or zero to 4 numeric characters followed by " + "a single asterisk as a wildcard character."); } AutoGen.DefaultTaxRule Rule = new AutoGen.DefaultTaxRule(); Rule.rate = TaxRate; Rule.shippingtaxedSpecified = true; Rule.shippingtaxed = ShippingTaxed; Rule.taxarea = new AutoGen.DefaultTaxRuleTaxarea(); AutoGen.USZipArea Area = new AutoGen.USZipArea(); Rule.taxarea.Item = Area; Area.zippattern = ZipPattern; AddNewTaxRule(Rule); }
/// <summary> /// This method adds a tax rule associated with a zip code pattern. /// </summary> /// <param name="ZipPattern">The zip pattern.</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> public void AddZipTaxRule(string ZipPattern, double TaxRate, bool ShippingTaxed) { if (!IsValidZipPattern(ZipPattern)) { throw new ApplicationException(ZIP_CODE_PATTERN_EXCEPTION); } AutoGen.DefaultTaxRule Rule = new AutoGen.DefaultTaxRule(); Rule.rateSpecified = true; Rule.rate = TaxRate; Rule.shippingtaxedSpecified = true; Rule.shippingtaxed = ShippingTaxed; Rule.taxarea = new AutoGen.DefaultTaxRuleTaxarea(); AutoGen.USZipArea Area = new AutoGen.USZipArea(); Rule.taxarea.Item = Area; Area.zippattern = ZipPattern; AddNewTaxRule(Rule); }
/// <summary> /// This method adds an excluded zip code pattern to a /// <us-zip-area> element. The <us-zip-area> element, /// in turn, appears as a subelement of <excluded-areas>. /// </summary> /// <param name="ZipPattern">The zip pattern.</param> public void AddExcludedZipPattern(string ZipPattern) { AutoGen.USZipArea NewArea = new AutoGen.USZipArea(); NewArea.zippattern = ZipPattern; AddNewExcludedArea(NewArea); }