Class TaxRateBuilder
Example to create an instance using the builder pattern
TaxRate taxRate = TaxRate.builder()
.name("{name}")
.amount(0.3)
.includedInPrice(true)
.country("{country}")
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddSubRates(Function<SubRateBuilder, SubRate> builder) Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).Tax rate.build()builds TaxRate with checking for non-null required valuesbuilds TaxRate without checking for non-null required valuesCountry in which the tax rate is applied in ISO 3166-1 alpha-2 format.Tax rate.Country in which the tax rate is applied in ISO 3166-1 alpha-2 format.getId()Present if the TaxRate is part of a TaxCategory.Iftrue, tax is included in Embedded Prices or Standalone Prices, and thetaxedPriceis present on LineItems.getKey()User-defined unique identifier of the TaxRate.getName()Name of the TaxRate.getState()State within the country, such as Texas in the United States.Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).Present if the TaxRate is part of a TaxCategory.includedInPrice(Boolean includedInPrice) Iftrue, tax is included in Embedded Prices or Standalone Prices, and thetaxedPriceis present on LineItems.User-defined unique identifier of the TaxRate.Name of the TaxRate.static TaxRateBuilderof()factory method for an instance of TaxRateBuilderstatic TaxRateBuildercreate builder for TaxRate instanceplusSubRates(SubRate... subRates) Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).plusSubRates(Function<SubRateBuilder, SubRateBuilder> builder) Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).setSubRates(Function<SubRateBuilder, SubRate> builder) Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).State within the country, such as Texas in the United States.Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).withSubRates(Function<SubRateBuilder, SubRateBuilder> builder) Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).
-
Constructor Details
-
TaxRateBuilder
public TaxRateBuilder()
-
-
Method Details
-
id
Present if the TaxRate is part of a TaxCategory. Absent for external TaxRates in LineItem, CustomLineItem, and ShippingInfo.
- Parameters:
id- value to be set- Returns:
- Builder
-
key
User-defined unique identifier of the TaxRate. Present when set using TaxRateDraft. Not available for external TaxRates created using ExternalTaxRateDraft.
- Parameters:
key- value to be set- Returns:
- Builder
-
name
Name of the TaxRate.
- Parameters:
name- value to be set- Returns:
- Builder
-
amount
Tax rate. If subrates are used, the amount is the sum of all rates in
subRates.- Parameters:
amount- value to be set- Returns:
- Builder
-
includedInPrice
If
true, tax is included in Embedded Prices or Standalone Prices, and thetaxedPriceis present on LineItems. In this case, thetotalNetprice on TaxedPrice includes the TaxRate.- Parameters:
includedInPrice- value to be set- Returns:
- Builder
-
country
Country in which the tax rate is applied in ISO 3166-1 alpha-2 format.
- Parameters:
country- value to be set- Returns:
- Builder
-
state
State within the country, such as Texas in the United States.
- Parameters:
state- value to be set- Returns:
- Builder
-
subRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate
amount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Parameters:
subRates- value to be set- Returns:
- Builder
-
subRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate
amount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Parameters:
subRates- value to be set- Returns:
- Builder
-
plusSubRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate
amount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Parameters:
subRates- value to be set- Returns:
- Builder
-
plusSubRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate
amount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Parameters:
builder- function to build the subRates value- Returns:
- Builder
-
withSubRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate
amount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Parameters:
builder- function to build the subRates value- Returns:
- Builder
-
addSubRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate
amount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Parameters:
builder- function to build the subRates value- Returns:
- Builder
-
setSubRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate
amount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Parameters:
builder- function to build the subRates value- Returns:
- Builder
-
getId
Present if the TaxRate is part of a TaxCategory. Absent for external TaxRates in LineItem, CustomLineItem, and ShippingInfo.
- Returns:
- id
-
getKey
User-defined unique identifier of the TaxRate. Present when set using TaxRateDraft. Not available for external TaxRates created using ExternalTaxRateDraft.
- Returns:
- key
-
getName
Name of the TaxRate.
- Returns:
- name
-
getAmount
Tax rate. If subrates are used, the amount is the sum of all rates in
subRates.- Returns:
- amount
-
getIncludedInPrice
If
true, tax is included in Embedded Prices or Standalone Prices, and thetaxedPriceis present on LineItems. In this case, thetotalNetprice on TaxedPrice includes the TaxRate.- Returns:
- includedInPrice
-
getCountry
Country in which the tax rate is applied in ISO 3166-1 alpha-2 format.
- Returns:
- country
-
getState
State within the country, such as Texas in the United States.
- Returns:
- state
-
getSubRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate
amount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Returns:
- subRates
-
build
builds TaxRate with checking for non-null required values -
buildUnchecked
builds TaxRate without checking for non-null required values- Returns:
- TaxRate
-
of
factory method for an instance of TaxRateBuilder- Returns:
- builder
-
of
create builder for TaxRate instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-