Class ExternalTaxRateDraftBuilder

java.lang.Object
com.commercetools.api.models.cart.ExternalTaxRateDraftBuilder
All Implemented Interfaces:
Builder<ExternalTaxRateDraft>

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

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

    • ExternalTaxRateDraftBuilder

      public ExternalTaxRateDraftBuilder()
  • Method Details

    • name

      public ExternalTaxRateDraftBuilder name(String name)

      Name of the Tax Rate.

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

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

      public ExternalTaxRateDraftBuilder country(String country)

      Country for which the tax applies.

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

      State within the specified country.

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

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

      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

      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
    • getName

      public String getName()

      Name of the Tax Rate.

      Returns:
      name
    • getAmount

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

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

      public String getCountry()

      Country for which the tax applies.

      Returns:
      country
    • getState

      @Nullable public String getState()

      State within the specified country.

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

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

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

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

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