Interface ExternalTaxRateDraft

All Superinterfaces:
Draft<ExternalTaxRateDraft>

public interface ExternalTaxRateDraft extends Draft<ExternalTaxRateDraft>

Controls calculation of taxed prices for Line Items, Custom Line Items, and Shipping Methods as explained in Cart tax calculation.


Example to create an instance using the builder pattern

     ExternalTaxRateDraft externalTaxRateDraft = ExternalTaxRateDraft.builder()
             .name("{name}")
             .country("{country}")
             .build()
 
  • Method Details

    • getName

      @NotNull @NotNull String getName()

      Name of the Tax Rate.

      Returns:
      name
    • getAmount

      Double getAmount()

      Percentage in the range of 0-1.

      • If no subRates are specified, a value must be defined.
      • If subRates are specified, this can be omitted or its value must be the sum of all subRates amounts.
      Returns:
      amount
    • getIncludedInPrice

      Boolean getIncludedInPrice()
      • If set to false, the related price is considered the net price and the provided amount is applied to calculate the gross price.
      • If set to true, the related price is considered the gross price, and the provided amount is applied to calculate the net price.
      Returns:
      includedInPrice
    • getCountry

      @NotNull @NotNull String getCountry()

      Country for which the tax applies.

      Returns:
      country
    • getState

      String getState()

      State within the specified country.

      Returns:
      state
    • getSubRates

      @Valid @Valid List<SubRate> getSubRates()

      For countries (such as the US) where the total tax is a combination of multiple taxes (such as state and local taxes). The total of all subrates must equal the TaxRate amount.

      Returns:
      subRates
    • setName

      void setName(String name)

      Name of the Tax Rate.

      Parameters:
      name - value to be set
    • setAmount

      void setAmount(Double amount)

      Percentage in the range of 0-1.

      • If no subRates are specified, a value must be defined.
      • If subRates are specified, this can be omitted or its value must be the sum of all subRates amounts.
      Parameters:
      amount - value to be set
    • setIncludedInPrice

      void setIncludedInPrice(Boolean includedInPrice)
      • If set to false, the related price is considered the net price and the provided amount is applied to calculate the gross price.
      • If set to true, the related price is considered the gross price, and the provided amount is applied to calculate the net price.
      Parameters:
      includedInPrice - value to be set
    • setCountry

      void setCountry(String country)

      Country for which the tax applies.

      Parameters:
      country - value to be set
    • setState

      void setState(String state)

      State within the specified country.

      Parameters:
      state - value to be set
    • setSubRates

      void setSubRates(SubRate... subRates)

      For countries (such as the US) where the total tax is a combination of multiple taxes (such as state and local taxes). The total of all subrates must equal the TaxRate amount.

      Parameters:
      subRates - values to be set
    • setSubRates

      void setSubRates(List<SubRate> subRates)

      For countries (such as the US) where the total tax is a combination of multiple taxes (such as state and local taxes). The total of all subrates must equal the TaxRate amount.

      Parameters:
      subRates - values to be set
    • of

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

      factory method to create a shallow copy ExternalTaxRateDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      factory method to create a deep copy of ExternalTaxRateDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static ExternalTaxRateDraftBuilder builder()
      builder factory method for ExternalTaxRateDraft
      Returns:
      builder
    • builder

      create builder for ExternalTaxRateDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withExternalTaxRateDraft

      default <T> T withExternalTaxRateDraft(Function<ExternalTaxRateDraft,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<ExternalTaxRateDraft> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference