Interface Transaction

All Superinterfaces:
Customizable<Transaction>

public interface Transaction extends Customizable<Transaction>

Represents a financial transaction typically created as a result of a notification from the payment service.


Example to create an instance using the builder pattern

     Transaction transaction = Transaction.builder()
             .id("{id}")
             .type(TransactionType.AUTHORIZATION)
             .amount(amountBuilder -> amountBuilder)
             .state(TransactionState.INITIAL)
             .build()
 
  • Method Details

    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the Transaction.

      Returns:
      id
    • getTimestamp

      ZonedDateTime getTimestamp()

      Date and time (UTC) the Transaction took place.

      Returns:
      timestamp
    • getType

      @NotNull @NotNull TransactionType getType()

      Type of the Transaction. For example, Authorization.

      Returns:
      type
    • getAmount

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

      Money value of the Transaction.

      Returns:
      amount
    • getInteractionId

      String getInteractionId()

      Identifier used by the interface that manages the Transaction (usually the PSP). If a matching interaction was logged in the interfaceInteractions array, the corresponding interaction can be found with this ID.

      Returns:
      interactionId
    • getState

      @NotNull @NotNull TransactionState getState()

      State of the Transaction.

      Returns:
      state
    • getCustom

      @Valid @Valid CustomFields getCustom()

      Custom Fields defined for the Transaction.

      Specified by:
      getCustom in interface Customizable<Transaction>
      Returns:
      custom
    • setId

      void setId(String id)

      Unique identifier of the Transaction.

      Parameters:
      id - value to be set
    • setTimestamp

      void setTimestamp(ZonedDateTime timestamp)

      Date and time (UTC) the Transaction took place.

      Parameters:
      timestamp - value to be set
    • setType

      void setType(TransactionType type)

      Type of the Transaction. For example, Authorization.

      Parameters:
      type - value to be set
    • setAmount

      void setAmount(CentPrecisionMoney amount)

      Money value of the Transaction.

      Parameters:
      amount - value to be set
    • setInteractionId

      void setInteractionId(String interactionId)

      Identifier used by the interface that manages the Transaction (usually the PSP). If a matching interaction was logged in the interfaceInteractions array, the corresponding interaction can be found with this ID.

      Parameters:
      interactionId - value to be set
    • setState

      void setState(TransactionState state)

      State of the Transaction.

      Parameters:
      state - value to be set
    • setCustom

      void setCustom(CustomFields custom)

      Custom Fields defined for the Transaction.

      Specified by:
      setCustom in interface Customizable<Transaction>
      Parameters:
      custom - value to be set
    • of

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

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

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

      static TransactionBuilder builder()
      builder factory method for Transaction
      Returns:
      builder
    • builder

      static TransactionBuilder builder(Transaction template)
      create builder for Transaction instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withTransaction

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