Class TaxRateBuilder

java.lang.Object
com.commercetools.api.models.tax_category.TaxRateBuilder
All Implemented Interfaces:
io.vrap.rmf.base.client.Builder<TaxRate>

public class TaxRateBuilder extends Object implements io.vrap.rmf.base.client.Builder<TaxRate>
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 Details

  • 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

      public TaxRateBuilder name(String name)

      Name of the TaxRate.

      Parameters:
      name - value to be set
      Returns:
      Builder
    • amount

      public TaxRateBuilder amount(Double amount)

      Tax rate. If subrates are used, the amount must be the sum of all subrates.

      Parameters:
      amount - value to be set
      Returns:
      Builder
    • includedInPrice

      public TaxRateBuilder includedInPrice(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
      Returns:
      Builder
    • country

      public TaxRateBuilder country(String 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

      public TaxRateBuilder subRates(@Nullable SubRate... subRates)

      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 - value to be set
      Returns:
      Builder
    • subRates

      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 - value to be set
      Returns:
      Builder
    • plusSubRates

      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 - value to be set
      Returns:
      Builder
    • plusSubRates

      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:
      builder - function to build the subRates value
      Returns:
      Builder
    • withSubRates

      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:
      builder - function to build the subRates value
      Returns:
      Builder
    • addSubRates

      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:
      builder - function to build the subRates value
      Returns:
      Builder
    • 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:
      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

      public String getName()

      Name of the TaxRate.

      Returns:
      name
    • getAmount

      public Double 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 the taxedPrice is present on LineItems. In this case, the totalNet price on TaxedPrice includes the TaxRate.

      Returns:
      includedInPrice
    • getCountry

      public String 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
    • build

      public TaxRate build()
      builds TaxRate with checking for non-null required values
      Specified by:
      build in interface io.vrap.rmf.base.client.Builder<TaxRate>
      Returns:
      TaxRate
    • buildUnchecked

      builds TaxRate without checking for non-null required values
      Returns:
      TaxRate
    • of

      public static TaxRateBuilder of()
      factory method for an instance of TaxRateBuilder
      Returns:
      builder
    • of

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