Interface TaxRate


public interface TaxRate
TaxRate
Example to create an instance using the builder pattern

     TaxRate taxRate = TaxRate.builder()
             .name("{name}")
             .amount(0.3)
             .includedInPrice(true)
             .country("{country}")
             .build()
 
  • Method Details

    • getId

      String getId()

      Present if the TaxRate is part of a TaxCategory. Absent for external TaxRates in LineItem, CustomLineItem, and ShippingInfo.

      Returns:
      id
    • getKey

      String getKey()

      User-defined unique identifier of the TaxRate. Present when set using TaxRateDraft. Not available for external TaxRates created using ExternalTaxRateDraft.

      Returns:
      key
    • getName

      @NotNull @NotNull String getName()

      Name of the TaxRate.

      Returns:
      name
    • getAmount

      @NotNull @NotNull Double getAmount()

      Tax rate. If subrates are used, the amount is the sum of all rates in subRates.

      Returns:
      amount
    • getIncludedInPrice

      @NotNull @NotNull Boolean getIncludedInPrice()

      If true, tax is included in Embedded Prices or Standalone Prices, and the taxedPrice is present on LineItems. In this case, the totalNet price on TaxedPrice includes the TaxRate.

      Returns:
      includedInPrice
    • getCountry

      @NotNull @NotNull String getCountry()

      Country in which the tax rate is applied in ISO 3166-1 alpha-2 format.

      Returns:
      country
    • getState

      String getState()

      State within the country, such as Texas in the United States.

      Returns:
      state
    • getSubRates

      @Valid @Valid List<SubRate> 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 the taxPortions field of a Cart or Order and the taxedPrice field of LineItems, CustomLineItems, and ShippingInfos.

      Returns:
      subRates
    • setId

      void setId(String 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
    • setKey

      void setKey(String 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
    • setName

      void setName(String name)

      Name of the TaxRate.

      Parameters:
      name - value to be set
    • setAmount

      void setAmount(Double amount)

      Tax rate. If subrates are used, the amount is the sum of all rates in subRates.

      Parameters:
      amount - value to be set
    • setIncludedInPrice

      void setIncludedInPrice(Boolean includedInPrice)

      If true, tax is included in Embedded Prices or Standalone Prices, and the taxedPrice is present on LineItems. In this case, the totalNet price on TaxedPrice includes the TaxRate.

      Parameters:
      includedInPrice - value to be set
    • setCountry

      void setCountry(String country)

      Country in which the tax rate is applied in ISO 3166-1 alpha-2 format.

      Parameters:
      country - value to be set
    • setState

      void setState(String state)

      State within the country, such as Texas in the United States.

      Parameters:
      state - value to be set
    • setSubRates

      void setSubRates(SubRate... 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 the taxPortions field of a Cart or Order and the taxedPrice field of LineItems, CustomLineItems, and ShippingInfos.

      Parameters:
      subRates - values to be set
    • setSubRates

      void setSubRates(List<SubRate> 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 the taxPortions field of a Cart or Order and the taxedPrice field of LineItems, CustomLineItems, and ShippingInfos.

      Parameters:
      subRates - values to be set
    • of

      static TaxRate of()
      factory method
      Returns:
      instance of TaxRate
    • of

      static TaxRate of(TaxRate template)
      factory method to create a shallow copy TaxRate
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • copyDeep

      TaxRate copyDeep()
    • deepCopy

      @Nullable static TaxRate deepCopy(@Nullable TaxRate template)
      factory method to create a deep copy of TaxRate
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static TaxRateBuilder builder()
      builder factory method for TaxRate
      Returns:
      builder
    • builder

      static TaxRateBuilder builder(TaxRate template)
      create builder for TaxRate instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withTaxRate

      default <T> T withTaxRate(Function<TaxRate,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<TaxRate> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference