Class TransactionBuilder
- All Implemented Interfaces:
Builder<Transaction>
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()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionamount
(CentPrecisionMoney amount) Money value of the Transaction.Money value of the Transaction.build()
builds Transaction with checking for non-null required valuesbuilds Transaction without checking for non-null required valuescustom
(CustomFields custom) Custom Fields defined for the Transaction.custom
(Function<CustomFieldsBuilder, CustomFieldsBuilder> builder) Custom Fields defined for the Transaction.Money value of the Transaction.Custom Fields defined for the Transaction.getId()
Unique identifier of the Transaction.Identifier used by the interface that manages the Transaction (usually the PSP).getState()
State of the Transaction.Date and time (UTC) the Transaction took place.getType()
Type of the Transaction.Unique identifier of the Transaction.interactionId
(String interactionId) Identifier used by the interface that manages the Transaction (usually the PSP).static TransactionBuilder
of()
factory method for an instance of TransactionBuilderstatic TransactionBuilder
of
(Transaction template) create builder for Transaction instancestate
(TransactionState state) State of the Transaction.timestamp
(ZonedDateTime timestamp) Date and time (UTC) the Transaction took place.type
(TransactionType type) Type of the Transaction.Money value of the Transaction.withCustom
(Function<CustomFieldsBuilder, CustomFields> builder) Custom Fields defined for the Transaction.
-
Constructor Details
-
TransactionBuilder
public TransactionBuilder()
-
-
Method Details
-
id
Unique identifier of the Transaction.
- Parameters:
id
- value to be set- Returns:
- Builder
-
timestamp
Date and time (UTC) the Transaction took place.
- Parameters:
timestamp
- value to be set- Returns:
- Builder
-
type
Type of the Transaction. For example,
Authorization
.- Parameters:
type
- value to be set- Returns:
- Builder
-
amount
public TransactionBuilder amount(Function<CentPrecisionMoneyBuilder, CentPrecisionMoneyBuilder> builder) Money value of the Transaction.
- Parameters:
builder
- function to build the amount value- Returns:
- Builder
-
withAmount
public TransactionBuilder withAmount(Function<CentPrecisionMoneyBuilder, CentPrecisionMoney> builder) Money value of the Transaction.
- Parameters:
builder
- function to build the amount value- Returns:
- Builder
-
amount
Money value of the Transaction.
- Parameters:
amount
- value to be set- Returns:
- Builder
-
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- Returns:
- Builder
-
state
State of the Transaction.
- Parameters:
state
- value to be set- Returns:
- Builder
-
custom
Custom Fields defined for the Transaction.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
withCustom
Custom Fields defined for the Transaction.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields defined for the Transaction.
- Parameters:
custom
- value to be set- Returns:
- Builder
-
getId
Unique identifier of the Transaction.
- Returns:
- id
-
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
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.
- Returns:
- custom
-
build
builds Transaction with checking for non-null required values- Specified by:
build
in interfaceBuilder<Transaction>
- Returns:
- Transaction
-
buildUnchecked
builds Transaction without checking for non-null required values- Returns:
- Transaction
-
of
factory method for an instance of TransactionBuilder- Returns:
- builder
-
of
create builder for Transaction instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-