Interface TaxRate
- All Known Implementing Classes:
TaxRateImpl
Example to create an instance using the builder pattern
TaxRate taxRate = TaxRate.builder()
.name("{name}")
.amount(0.3)
.includedInPrice(true)
.country("{country}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic TaxRateBuilder
builder()
builder factory method for TaxRatestatic TaxRateBuilder
create builder for TaxRate instancestatic TaxRate
factory method to create a deep copy of TaxRate@NotNull Double
Tax rate.@NotNull String
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.@NotNull Boolean
Iftrue
, tax is included in Embedded Prices or Standalone Prices, and thetaxedPrice
is present on LineItems.getKey()
User-defined unique identifier of the TaxRate.@NotNull String
getName()
Name of the TaxRate.getState()
State within the country, such as Texas in the United States.Used to calculate the taxPortions field in a Cart or Order.static TaxRate
of()
factory methodstatic TaxRate
factory method to create a shallow copy TaxRatevoid
Tax rate.void
setCountry
(String country) Country in which the tax rate is applied in ISO 3166-1 alpha-2 format.void
Present if the TaxRate is part of a TaxCategory.void
setIncludedInPrice
(Boolean includedInPrice) Iftrue
, tax is included in Embedded Prices or Standalone Prices, and thetaxedPrice
is present on LineItems.void
User-defined unique identifier of the TaxRate.void
Name of the TaxRate.void
State within the country, such as Texas in the United States.void
setSubRates
(SubRate... subRates) Used to calculate the taxPortions field in a Cart or Order.void
setSubRates
(List<SubRate> subRates) Used to calculate the taxPortions field in a Cart or Order.static com.fasterxml.jackson.core.type.TypeReference<TaxRate>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withTaxRate
(Function<TaxRate, T> helper) accessor map function
-
Method Details
-
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 must be the sum of all subrates.
- Returns:
- amount
-
getIncludedInPrice
If
true
, tax is included in Embedded Prices or Standalone Prices, and thetaxedPrice
is present on LineItems. In this case, thetotalNet
price 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 to calculate the taxPortions field in a Cart or Order. It is useful if the total tax of a country (such as the US) is a combination of multiple taxes (such as state and local taxes).
- Returns:
- subRates
-
setId
Present if the TaxRate is part of a TaxCategory. Absent for external TaxRates in LineItem, CustomLineItem, and ShippingInfo.
- Parameters:
id
- value to be set
-
setKey
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
-
setName
Name of the TaxRate.
- Parameters:
name
- value to be set
-
setAmount
Tax rate. If subrates are used, the amount must be the sum of all subrates.
- Parameters:
amount
- value to be set
-
setIncludedInPrice
If
true
, tax is included in Embedded Prices or Standalone Prices, and thetaxedPrice
is present on LineItems. In this case, thetotalNet
price on TaxedPrice includes the TaxRate.- Parameters:
includedInPrice
- value to be set
-
setCountry
Country in which the tax rate is applied in ISO 3166-1 alpha-2 format.
- Parameters:
country
- value to be set
-
setState
State within the country, such as Texas in the United States.
- Parameters:
state
- value to be set
-
setSubRates
Used to calculate the taxPortions field in a Cart or Order. It is useful if the total tax of a country (such as the US) is a combination of multiple taxes (such as state and local taxes).
- Parameters:
subRates
- values to be set
-
setSubRates
Used to calculate the taxPortions field in a Cart or Order. It is useful if the total tax of a country (such as the US) is a combination of multiple taxes (such as state and local taxes).
- Parameters:
subRates
- values to be set
-
of
factory method- Returns:
- instance of TaxRate
-
of
factory method to create a shallow copy TaxRate- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of TaxRate- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for TaxRate- Returns:
- builder
-
builder
create builder for TaxRate instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withTaxRate
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-