Interface Transaction
- All Superinterfaces:
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 Summary
Modifier and TypeMethodDescriptionstatic TransactionBuilder
builder()
builder factory method for Transactionstatic TransactionBuilder
builder
(Transaction template) create builder for Transaction instancestatic Transaction
deepCopy
(Transaction template) factory method to create a deep copy of Transaction@NotNull @Valid CentPrecisionMoney
Money value of the Transaction.@Valid CustomFields
Custom Fields defined for the Transaction.@NotNull String
getId()
Unique identifier of the Transaction.Identifier used by the interface that manages the Transaction (usually the PSP).@NotNull TransactionState
getState()
State of the Transaction.Date and time (UTC) the Transaction took place.@NotNull TransactionType
getType()
Type of the Transaction.static Transaction
of()
factory methodstatic Transaction
of
(Transaction template) factory method to create a shallow copy Transactionvoid
setAmount
(CentPrecisionMoney amount) Money value of the Transaction.void
setCustom
(CustomFields custom) Custom Fields defined for the Transaction.void
Unique identifier of the Transaction.void
setInteractionId
(String interactionId) Identifier used by the interface that manages the Transaction (usually the PSP).void
setState
(TransactionState state) State of the Transaction.void
setTimestamp
(ZonedDateTime timestamp) Date and time (UTC) the Transaction took place.void
setType
(TransactionType type) Type of the Transaction.static com.fasterxml.jackson.core.type.TypeReference<Transaction>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withTransaction
(Function<Transaction, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.Customizable
unwrapCustomizable
-
Method Details
-
getId
Unique identifier of the Transaction.
- Returns:
- id
-
getTimestamp
ZonedDateTime getTimestamp()Date and time (UTC) the Transaction took place.
- Returns:
- timestamp
-
getType
Type of the Transaction. For example,
Authorization
.- Returns:
- type
-
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
State of the Transaction.
- Returns:
- state
-
getCustom
Custom Fields defined for the Transaction.
- Specified by:
getCustom
in interfaceCustomizable<Transaction>
- Returns:
- custom
-
setId
Unique identifier of the Transaction.
- Parameters:
id
- value to be set
-
setTimestamp
Date and time (UTC) the Transaction took place.
- Parameters:
timestamp
- value to be set
-
setType
Type of the Transaction. For example,
Authorization
.- Parameters:
type
- value to be set
-
setAmount
Money value of the Transaction.
- Parameters:
amount
- value to be set
-
setInteractionId
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
State of the Transaction.
- Parameters:
state
- value to be set
-
setCustom
Custom Fields defined for the Transaction.
- Specified by:
setCustom
in interfaceCustomizable<Transaction>
- Parameters:
custom
- value to be set
-
of
factory method- Returns:
- instance of Transaction
-
of
factory method to create a shallow copy Transaction- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of Transaction- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for Transaction- Returns:
- builder
-
builder
create builder for Transaction instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withTransaction
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-