Interface TransactionExecutionUtil
- All Known Implementing Classes:
DefaultTransactionExecutionUtil
TransactionExecutionDetail
, based on a
TransactionExecutionRequest
, a Payment
, and a PaymentTransaction
.- Author:
- Chris Kittrell (ckittrell)
-
Method Summary
Modifier and TypeMethodDescriptionbuildTransactionExecutionDetail
(Payment payment, PaymentTransaction transaction, com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) Builds aTransactionExecutionDetail
based on the providedTransactionExecutionRequest
andPaymentTransaction
.default TransactionExecutionResponse
buildTransactionExecutionResponse
(Payment payment, PaymentTransaction transaction) buildTransactionExecutionResponse
(Payment payment, PaymentTransaction transaction, com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) default TransactionExecutionResponse
buildTransactionExecutionResponse
(TransactionExecutionRequest request, TransactionExecutionDetail transactionExecutionDetail, Payment payment) buildTransactionExecutionResponse
(TransactionExecutionRequest request, List<TransactionExecutionDetail> transactionExecutionDetails, Payment payment) getParentTransactionWithExecutableAmounts
(Payment payment, TransactionExecutionRequest request) Gets a list ofTransactionWithExecutableAmounts
representing the parent transactions of the givenTransactionExecutionRequest
.
-
Method Details
-
buildTransactionExecutionResponse
default TransactionExecutionResponse buildTransactionExecutionResponse(TransactionExecutionRequest request, TransactionExecutionDetail transactionExecutionDetail, @Nullable Payment payment) Builds aTransactionExecutionResponse
for a singleTransactionExecutionDetail
andPayment
.This is useful for
TransactionExecutionRequest
that doesn't require a parent transaction, such asDefaultTransactionTypes.AUTHORIZE
andDefaultTransactionTypes.AUTHORIZE_AND_CAPTURE
.- Parameters:
request
- theTransactionExecutionRequest
describing the desired details of the executiontransactionExecutionDetail
- theTransactionExecutionDetail
that was executedpayment
- the relatedPayment
that the transactions acted against- Returns:
- a
TransactionExecutionResponse
for a singleTransactionExecutionDetail
andPayment
-
buildTransactionExecutionResponse
TransactionExecutionResponse buildTransactionExecutionResponse(TransactionExecutionRequest request, List<TransactionExecutionDetail> transactionExecutionDetails, @Nullable Payment payment) Builds aTransactionExecutionResponse
based on the givenTransactionExecutionDetails
andPayment
.This is used when multiple transactions were executed for a single
TransactionExecutionRequest
, which can happen when theTransactionExecutionRequest.getTransactionType()
requires one or more proceeding parent transactions to act against, such asDefaultTransactionTypes.REFUND
.For example, let's say we have 2 capture transactions, one for $10 and one for $5, and the
TransactionExecutionRequest
wants to execute a refund for $15. In this case, one refund transaction is needed for each parent capture transaction to cover the whole $15, one refund for $10 and one for $5.Note that out-of-box, the scenario of having multiple parent transactions is very unlikely and not expected, however it is supported.
- Parameters:
request
- theTransactionExecutionRequest
describing the desired details of the executiontransactionExecutionDetails
- a list ofTransactionExecutionDetails
that were executedpayment
- the relatedPayment
that the transactions acted against- Returns:
- a
TransactionExecutionResponse
based on the givenTransactionExecutionDetails
andPayment
-
buildTransactionExecutionDetail
TransactionExecutionDetail buildTransactionExecutionDetail(@Nullable Payment payment, PaymentTransaction transaction, com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) Builds aTransactionExecutionDetail
based on the providedTransactionExecutionRequest
andPaymentTransaction
.- Parameters:
payment
- The relatedPayment
that the transactions acted against.transaction
- The transaction that was executed.paymentResponse
- The payment gateway's response to the executed transaction- Returns:
- A
TransactionExecutionDetail
based on the providedTransactionExecutionRequest
andPaymentTransaction
-
buildTransactionExecutionResponse
default TransactionExecutionResponse buildTransactionExecutionResponse(@Nullable Payment payment, PaymentTransaction transaction) - Parameters:
payment
- The relatedPayment
that the request will act against.transaction
- The transaction that was executed.- Returns:
- A
TransactionExecutionResponse
based on the providedPayment
, andPaymentTransaction
-
buildTransactionExecutionResponse
TransactionExecutionResponse buildTransactionExecutionResponse(@Nullable Payment payment, PaymentTransaction transaction, @Nullable com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) - Parameters:
payment
- The relatedPayment
that the request will act against.transaction
- The transaction that was executed.paymentResponse
- The payment gateway's response to the executed transaction- Returns:
- A
TransactionExecutionResponse
based on the providedPayment
, andPaymentTransaction
-
getParentTransactionWithExecutableAmounts
List<TransactionWithExecutableAmount> getParentTransactionWithExecutableAmounts(Payment payment, TransactionExecutionRequest request) Gets a list ofTransactionWithExecutableAmounts
representing the parent transactions of the givenTransactionExecutionRequest
.This is used when the
TransactionExecutionRequest.getTransactionType()
requires one or more proceeding parent transactions to act against. For example, if the request is forDefaultTransactionTypes.REFUND
, this will retrieve all the non-fully-reversed parent transactions, such as capture, etc.Note that out-of-box, the scenario of having multiple parent transactions is very unlikely and not expected, however it is supported.
- Parameters:
payment
- thePayment
to look for the transaction from.- Returns:
- a list of
TransactionWithExecutableAmounts
representing the parent transactions of the givenTransactionExecutionRequest
- Throws:
InvalidTransactionExecutionRequestException
- if the givenTransactionExecutionRequest.getTransactionType()
requires a parent transaction but is not found
-