Interface TaxRateDraft
- All Superinterfaces:
Draft<TaxRateDraft>
Example to create an instance using the builder pattern
TaxRateDraft taxRateDraft = TaxRateDraft.builder()
.name("{name}")
.includedInPrice(true)
.country("{country}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic TaxRateDraftBuilderbuilder()builder factory method for TaxRateDraftstatic TaxRateDraftBuilderbuilder(TaxRateDraft template) create builder for TaxRateDraft instancecopyDeep()static TaxRateDraftdeepCopy(TaxRateDraft template) factory method to create a deep copy of TaxRateDraftTax rate.@NotNull StringCountry in which the tax rate is applied in ISO 3166-1 alpha-2 format.@NotNull BooleanWhether tax is included in Embedded Prices or Standalone Prices, and thetaxedPriceis present on LineItems.getKey()User-defined identifier of the TaxRate.@NotNull StringgetName()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).Determines whether thetaxRoundingModeof the Cart or Order is applied to the net price or the tax amount when this TaxRate is included in the price.static TaxRateDraftof()factory methodstatic TaxRateDraftof(TaxRateDraft template) factory method to create a shallow copy TaxRateDraftvoidTax rate.voidsetCountry(String country) Country in which the tax rate is applied in ISO 3166-1 alpha-2 format.voidsetIncludedInPrice(Boolean includedInPrice) Whether tax is included in Embedded Prices or Standalone Prices, and thetaxedPriceis present on LineItems.voidUser-defined identifier of the TaxRate.voidName of the TaxRate.voidState within the country, such as Texas in the United States.voidsetSubRates(SubRate... subRates) Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).voidsetSubRates(List<SubRate> subRates) Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes).voidsetTaxRoundingTarget(TaxRoundingTarget taxRoundingTarget) Determines whether thetaxRoundingModeof the Cart or Order is applied to the net price or the tax amount when this TaxRate is included in the price.static tools.jackson.core.type.TypeReference<TaxRateDraft>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithTaxRateDraft(Function<TaxRateDraft, T> helper) accessor map function
-
Method Details
-
getName
Name of the TaxRate.
- Returns:
- name
-
getAmount
Double getAmount()Tax rate.
Either
amountorsubRatesmust be defined. If both are defined, the value of this field must be equal to the sum of thesubRatesamounts; otherwise, an InvalidOperation error is returned.- Returns:
- amount
-
getIncludedInPrice
Whether tax is included in Embedded Prices or Standalone Prices, and the
taxedPriceis 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.
If the provided combination of
countryandstateexists for the TaxCategory, a DuplicateField error is returned.- Returns:
- country
-
getState
String getState()State within the country, such as Texas in the United States. The value is case-sensitive and must use the same casing as the
statevalue in the CartshippingAddress. Empty strings are treated as ifstatewas omitted.If
stateis omitted, the resulting TaxRate does not act as a wildcard: it only matches a Cart whoseshippingAddressalso has nostatevalue. To apply the same rate across states, either define an individual TaxRate for each state, or use theregionfield or a Custom Field on the shipping address as described in Address matching.If the provided combination of
countryandstateexists for the TaxCategory, a DuplicateField error is returned.- Returns:
- state
-
getSubRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). If
amountis defined, the total of all subrates must equalamount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Returns:
- subRates
-
getKey
String getKey()User-defined identifier of the TaxRate.
If the provided key is used by another TaxRate in the TaxCategory, a DuplicateField error is returned.
- Returns:
- key
-
getTaxRoundingTarget
TaxRoundingTarget getTaxRoundingTarget()Determines whether the
taxRoundingModeof the Cart or Order is applied to the net price or the tax amount when this TaxRate is included in the price. The field is ignored ifincludedInPriceisfalse.- Returns:
- taxRoundingTarget
-
setName
Name of the TaxRate.
- Parameters:
name- value to be set
-
setAmount
Tax rate.
Either
amountorsubRatesmust be defined. If both are defined, the value of this field must be equal to the sum of thesubRatesamounts; otherwise, an InvalidOperation error is returned.- Parameters:
amount- value to be set
-
setIncludedInPrice
Whether tax is included in Embedded Prices or Standalone Prices, and the
taxedPriceis present on LineItems. In this case, thetotalNetprice 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.
If the provided combination of
countryandstateexists for the TaxCategory, a DuplicateField error is returned.- Parameters:
country- value to be set
-
setState
State within the country, such as Texas in the United States. The value is case-sensitive and must use the same casing as the
statevalue in the CartshippingAddress. Empty strings are treated as ifstatewas omitted.If
stateis omitted, the resulting TaxRate does not act as a wildcard: it only matches a Cart whoseshippingAddressalso has nostatevalue. To apply the same rate across states, either define an individual TaxRate for each state, or use theregionfield or a Custom Field on the shipping address as described in Address matching.If the provided combination of
countryandstateexists for the TaxCategory, a DuplicateField error is returned.- Parameters:
state- value to be set
-
setSubRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). If
amountis defined, the total of all subrates must equalamount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Parameters:
subRates- values to be set
-
setSubRates
Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). If
amountis defined, the total of all subrates must equalamount. These subrates are used to calculate thetaxPortionsfield of a Cart or Order and thetaxedPricefield of LineItems, CustomLineItems, and ShippingInfos.- Parameters:
subRates- values to be set
-
setKey
User-defined identifier of the TaxRate.
If the provided key is used by another TaxRate in the TaxCategory, a DuplicateField error is returned.
- Parameters:
key- value to be set
-
setTaxRoundingTarget
Determines whether the
taxRoundingModeof the Cart or Order is applied to the net price or the tax amount when this TaxRate is included in the price. The field is ignored ifincludedInPriceisfalse.- Parameters:
taxRoundingTarget- value to be set
-
of
factory method- Returns:
- instance of TaxRateDraft
-
of
factory method to create a shallow copy TaxRateDraft- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
TaxRateDraft copyDeep() -
deepCopy
factory method to create a deep copy of TaxRateDraft- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for TaxRateDraft- Returns:
- builder
-
builder
create builder for TaxRateDraft instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withTaxRateDraft
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
-