Interface TaxPortionDraft

All Superinterfaces:
Draft<TaxPortionDraft>

public interface TaxPortionDraft extends Draft<TaxPortionDraft>

Represents the portions that sum up to the totalGross field of a TaxedPrice.

The 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 will be accumulated to the same tax portion.


Example to create an instance using the builder pattern

     TaxPortionDraft taxPortionDraft = TaxPortionDraft.builder()
             .rate(0.3)
             .amount(amountBuilder -> amountBuilder)
             .build()
 
  • Method Details

    • getName

      String 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 Money getAmount()

      Money value for 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

      void setAmount(Money amount)

      Money value for the tax portion.

      Parameters:
      amount - value to be set
    • of

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

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

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

      static TaxPortionDraftBuilder builder()
      builder factory method for TaxPortionDraft
      Returns:
      builder
    • builder

      static TaxPortionDraftBuilder builder(TaxPortionDraft template)
      create builder for TaxPortionDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withTaxPortionDraft

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