Class TransactionDraftBuilder

java.lang.Object
com.commercetools.api.models.payment.TransactionDraftBuilder
All Implemented Interfaces:
Builder<TransactionDraft>

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

     TransactionDraft transactionDraft = TransactionDraft.builder()
             .type(TransactionType.AUTHORIZATION)
             .amount(amountBuilder -> amountBuilder)
             .build()
 
  • Constructor Details

    • TransactionDraftBuilder

      public TransactionDraftBuilder()
  • Method Details

    • timestamp

      public TransactionDraftBuilder timestamp(@Nullable ZonedDateTime timestamp)

      Date and time (UTC) the Transaction took place.

      Parameters:
      timestamp - value to be set
      Returns:
      Builder
    • type

      Type of the Transaction.

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

      Money value for the Transaction.

      Parameters:
      builder - function to build the amount value
      Returns:
      Builder
    • withAmount

      public TransactionDraftBuilder withAmount(Function<MoneyBuilder,Money> builder)

      Money value for the Transaction.

      Parameters:
      builder - function to build the amount value
      Returns:
      Builder
    • amount

      public TransactionDraftBuilder amount(Money amount)

      Money value for the Transaction.

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

      public TransactionDraftBuilder interactionId(@Nullable String interactionId)

      Identifier used by the payment service that manages the Transaction. Can be used to correlate the Transaction to an interface interaction.

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

      public TransactionDraftBuilder state(@Nullable TransactionState state)

      State of the Transaction.

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

      Custom Fields of the Transaction.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • withCustom

      Custom Fields of the Transaction.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • custom

      public TransactionDraftBuilder custom(@Nullable CustomFieldsDraft custom)

      Custom Fields of the Transaction.

      Parameters:
      custom - value to be set
      Returns:
      Builder
    • getTimestamp

      @Nullable public ZonedDateTime getTimestamp()

      Date and time (UTC) the Transaction took place.

      Returns:
      timestamp
    • getType

      public TransactionType getType()

      Type of the Transaction.

      Returns:
      type
    • getAmount

      public Money getAmount()

      Money value for the Transaction.

      Returns:
      amount
    • getInteractionId

      @Nullable public String getInteractionId()

      Identifier used by the payment service that manages the Transaction. Can be used to correlate the Transaction to an interface interaction.

      Returns:
      interactionId
    • getState

      @Nullable public TransactionState getState()

      State of the Transaction.

      Returns:
      state
    • getCustom

      @Nullable public CustomFieldsDraft getCustom()

      Custom Fields of the Transaction.

      Returns:
      custom
    • build

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

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

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

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