/// <summary> /// This method adds a new tax rule to the <default-tax-table>. /// This method is called by the methods that create the XML blocks /// for flat-rate shipping, merchant-calculated shipping and instore-pickup /// shipping methods. /// </summary> /// <param name="NewRule">This parameter contains an object representing /// a default tax rule.</param> private void AddNewTaxRule(AutoGen.DefaultTaxRule NewRule) { AutoGen.DefaultTaxTable NewTable = new AutoGen.DefaultTaxTable(); NewTable.taxrules = new AutoGen.DefaultTaxRule [_TaxTables.defaulttaxtable.taxrules.Length + 1]; for (int i = 0; i < NewTable.taxrules.Length - 1; i++) { NewTable.taxrules[i] = _TaxTables.defaulttaxtable.taxrules[i]; } NewTable.taxrules[NewTable.taxrules.Length - 1] = NewRule; _TaxTables.defaulttaxtable = NewTable; }
/// <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 a tax rule associated with a particular state. /// </summary> /// <param name="StateCode">This parameter contains a two-letter U.S. state /// code associated with a tax rule.</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 AddStateTaxRule(string StateCode, 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.USStateArea Area = new AutoGen.USStateArea(); Rule.taxarea.Item = Area; Area.state = StateCode; 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 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> /// 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.rateSpecified = true; 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 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> /// Adds the country tax rule. /// This method adds a tax rule associated with a particular state. /// </summary> /// <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 AddWorldAreaTaxRule(double TaxRate, bool ShippingTaxed) { AutoGen.DefaultTaxRule Rule = new AutoGen.DefaultTaxRule(); Rule.rateSpecified = true; Rule.rate = TaxRate; Rule.shippingtaxedSpecified = true; Rule.shippingtaxed = ShippingTaxed; Rule.taxarea = new AutoGen.DefaultTaxRuleTaxarea(); AutoGen.WorldArea ThisArea = new AutoGen.WorldArea(); Rule.taxarea.Item = ThisArea; AddNewTaxRule(Rule); }
/// <summary> /// This method adds a tax rule associated with a particular state. /// </summary> /// <param name="StateCode">This parameter contains a two-letter U.S. state /// code associated with a tax rule.</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 AddStateTaxRule(string StateCode, double TaxRate, bool ShippingTaxed) { AutoGen.DefaultTaxRule Rule = new AutoGen.DefaultTaxRule(); Rule.rateSpecified = true; Rule.rate = TaxRate; Rule.shippingtaxedSpecified = true; Rule.shippingtaxed = ShippingTaxed; Rule.taxarea = new AutoGen.DefaultTaxRuleTaxarea(); AutoGen.USStateArea Area = new AutoGen.USStateArea(); Rule.taxarea.Item = Area; Area.state = StateCode; AddNewTaxRule(Rule); }
/// <summary> /// Adds the country tax rule. /// This method adds a tax rule associated with a particular state. /// </summary> /// <param name="countryCode">Required. This tag contains the /// two-letter /// <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO 3166-1</a> /// country code for the postal area.</param> /// <param name="postalCodePattern">Optional. This tag identifies a postal /// code or a range of postal codes for the postal area. To specify a /// range of postal codes, use an asterisk as a wildcard operator in the /// tag's value. For example, you can specify that a shipping option is /// available for all postal codes beginning with "SW" by entering SW* /// as the <postal-code-pattern> value.</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 AddPostalAreaTaxRule(string countryCode, string postalCodePattern, double TaxRate, bool ShippingTaxed) { AutoGen.DefaultTaxRule Rule = new AutoGen.DefaultTaxRule(); Rule.rateSpecified = true; Rule.rate = TaxRate; Rule.shippingtaxedSpecified = true; Rule.shippingtaxed = ShippingTaxed; Rule.taxarea = new AutoGen.DefaultTaxRuleTaxarea(); AutoGen.PostalArea ThisArea = new AutoGen.PostalArea(); Rule.taxarea.Item = ThisArea; ThisArea.countrycode = countryCode; if (postalCodePattern != null && postalCodePattern != string.Empty) { ThisArea.postalcodepattern = postalCodePattern; } 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 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); }