Class TaxRateDraftBuilder

java.lang.Object
com.commercetools.api.models.tax_category.TaxRateDraftBuilder
All Implemented Interfaces:
Builder<TaxRateDraft>

public class TaxRateDraftBuilder extends Object implements Builder<TaxRateDraft>
TaxRateDraftBuilder
Example to create an instance using the builder pattern

     TaxRateDraft taxRateDraft = TaxRateDraft.builder()
             .name("{name}")
             .includedInPrice(true)
             .country("{country}")
             .build()
 
  • Constructor Details

    • TaxRateDraftBuilder

      public TaxRateDraftBuilder()
  • Method Details

    • name

      public TaxRateDraftBuilder name(String name)

      Name of the TaxRate.

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

      public TaxRateDraftBuilder amount(@Nullable Double amount)

      Tax rate. Must be supplied if no subRates are specified. If subRates are specified, this field can be omitted or it must be the sum of amounts of all subRates.

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

      public TaxRateDraftBuilder 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 TaxRateDraftBuilder 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

      public TaxRateDraftBuilder state(@Nullable String state)

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

      Parameters:
      state - value to be set
      Returns:
      Builder
    • subRates

      public TaxRateDraftBuilder subRates(@Nullable 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 - value to be set
      Returns:
      Builder
    • subRates

      public TaxRateDraftBuilder subRates(@Nullable 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 - value to be set
      Returns:
      Builder
    • plusSubRates

      public TaxRateDraftBuilder plusSubRates(@Nullable 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 - value to be set
      Returns:
      Builder
    • plusSubRates

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

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

      public TaxRateDraftBuilder addSubRates(Function<SubRateBuilder,SubRate> builder)

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

      public TaxRateDraftBuilder setSubRates(Function<SubRateBuilder,SubRate> builder)

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

      User-defined unique identifier of the TaxRate.

      Parameters:
      key - value to be set
      Returns:
      Builder
    • getName

      public String getName()

      Name of the TaxRate.

      Returns:
      name
    • getAmount

      @Nullable public Double getAmount()

      Tax rate. Must be supplied if no subRates are specified. If subRates are specified, this field can be omitted or it must be the sum of amounts of all subRates.

      Returns:
      amount
    • getIncludedInPrice

      public 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

      public String getCountry()

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

      Returns:
      country
    • getState

      @Nullable public String getState()

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

      Returns:
      state
    • getSubRates

      @Nullable public 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
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the TaxRate.

      Returns:
      key
    • build

      public TaxRateDraft build()
      builds TaxRateDraft with checking for non-null required values
      Specified by:
      build in interface Builder<TaxRateDraft>
      Returns:
      TaxRateDraft
    • buildUnchecked

      public TaxRateDraft buildUnchecked()
      builds TaxRateDraft without checking for non-null required values
      Returns:
      TaxRateDraft
    • of

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

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