Interface TaxRateDraft

All Superinterfaces:
Draft<TaxRateDraft>

public interface TaxRateDraft extends Draft<TaxRateDraft>
TaxRateDraft
Example to create an instance using the builder pattern

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

    • getName

      @NotNull @NotNull String getName()

      Name of the TaxRate.

      Returns:
      name
    • getAmount

      Double getAmount()

      Tax rate.

      Either amount or subRates must be defined. If both are defined, the value of this field must be equal to the sum of the subRates amounts; otherwise, an InvalidOperation error is returned.

      Returns:
      amount
    • getIncludedInPrice

      @NotNull @NotNull Boolean getIncludedInPrice()

      Whether 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.

      If the provided combination of country and state exists for the TaxCategory, a DuplicateField error is returned.

      Returns:
      country
    • getState

      String getState()

      State within the country, such as Texas in the United States. The value is case-sensitive and must use the same casing as the state value in the Cart shippingAddress. Empty strings are treated as if state was omitted.

      If state is omitted, the resulting TaxRate does not act as a wildcard: it only matches a Cart whose shippingAddress also has no state value. To apply the same rate across states, either define an individual TaxRate for each state, or use the region field or a Custom Field on the shipping address as described in Address matching.

      If the provided combination of country and state exists for the TaxCategory, a DuplicateField error is returned.

      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). If amount is defined, the total of all subrates must equal 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

      String getKey()

      User-defined identifier of the TaxRate.

      If the provided key is used by another TaxRate in the TaxCategory, a DuplicateField error is returned.

      Returns:
      key
    • getTaxRoundingTarget

      TaxRoundingTarget getTaxRoundingTarget()

      Determines whether the taxRoundingMode of the Cart or Order is applied to the net price or the tax amount when this TaxRate is included in the price. The field is ignored if includedInPrice is false.

      Returns:
      taxRoundingTarget
    • setName

      void setName(String name)

      Name of the TaxRate.

      Parameters:
      name - value to be set
    • setAmount

      void setAmount(Double amount)

      Tax rate.

      Either amount or subRates must be defined. If both are defined, the value of this field must be equal to the sum of the subRates amounts; otherwise, an InvalidOperation error is returned.

      Parameters:
      amount - value to be set
    • setIncludedInPrice

      void setIncludedInPrice(Boolean includedInPrice)

      Whether 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.

      If the provided combination of country and state exists for the TaxCategory, a DuplicateField error is returned.

      Parameters:
      country - value to be set
    • setState

      void setState(String state)

      State within the country, such as Texas in the United States. The value is case-sensitive and must use the same casing as the state value in the Cart shippingAddress. Empty strings are treated as if state was omitted.

      If state is omitted, the resulting TaxRate does not act as a wildcard: it only matches a Cart whose shippingAddress also has no state value. To apply the same rate across states, either define an individual TaxRate for each state, or use the region field or a Custom Field on the shipping address as described in Address matching.

      If the provided combination of country and state exists for the TaxCategory, a DuplicateField error is returned.

      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). If amount is defined, the total of all subrates must equal 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). If amount is defined, the total of all subrates must equal 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
    • setKey

      void setKey(String key)

      User-defined identifier of the TaxRate.

      If the provided key is used by another TaxRate in the TaxCategory, a DuplicateField error is returned.

      Parameters:
      key - value to be set
    • setTaxRoundingTarget

      void setTaxRoundingTarget(TaxRoundingTarget taxRoundingTarget)

      Determines whether the taxRoundingMode of the Cart or Order is applied to the net price or the tax amount when this TaxRate is included in the price. The field is ignored if includedInPrice is false.

      Parameters:
      taxRoundingTarget - value to be set
    • of

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

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

      TaxRateDraft copyDeep()
    • deepCopy

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

      static TaxRateDraftBuilder builder()
      builder factory method for TaxRateDraft
      Returns:
      builder
    • builder

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

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

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