Interface TaxPortion

All Known Implementing Classes:
TaxPortionImpl

public interface TaxPortion

The tax portions are calculated from the TaxRates. If a Tax Rate has SubRates, they are used and can be identified by name. Tax portions from Line Items with the same rate and name are accumulated to the same tax portion.


Example to create an instance using the builder pattern

     TaxPortion taxPortion = TaxPortion.builder()
             .rate(0.3)
             .amount(amountBuilder -> amountBuilder)
             .build()
 
  • Method Details

    • getName

      Name of the tax portion.

      Returns:
      name
    • getRate

      @NotNull @NotNull Double getRate()

      A number in the range 0-1.

      Returns:
      rate
    • getAmount

      @NotNull @Valid @NotNull @Valid CentPrecisionMoney getAmount()

      Money value of the tax portion.

      Returns:
      amount
    • setName

      void setName(String name)

      Name of the tax portion.

      Parameters:
      name - value to be set
    • setRate

      void setRate(Double rate)

      A number in the range 0-1.

      Parameters:
      rate - value to be set
    • setAmount

      Money value of the tax portion.

      Parameters:
      amount - value to be set
    • of

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

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

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

      builder factory method for TaxPortion
      Returns:
      builder
    • builder

      create builder for TaxPortion instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withTaxPortion

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