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 aTransactionExecutionDetailbased on the providedTransactionExecutionRequestandPaymentTransaction.default TransactionExecutionResponsebuildTransactionExecutionResponse(Payment payment, PaymentTransaction transaction) buildTransactionExecutionResponse(Payment payment, PaymentTransaction transaction, com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) default TransactionExecutionResponsebuildTransactionExecutionResponse(TransactionExecutionRequest request, TransactionExecutionDetail transactionExecutionDetail, Payment payment) buildTransactionExecutionResponse(TransactionExecutionRequest request, List<TransactionExecutionDetail> transactionExecutionDetails, Payment payment) getParentTransactionWithExecutableAmounts(Payment payment, TransactionExecutionRequest request) Gets a list ofTransactionWithExecutableAmountsrepresenting the parent transactions of the givenTransactionExecutionRequest.
-
Method Details
-
buildTransactionExecutionResponse
default TransactionExecutionResponse buildTransactionExecutionResponse(TransactionExecutionRequest request, TransactionExecutionDetail transactionExecutionDetail, @Nullable Payment payment) Builds aTransactionExecutionResponsefor a singleTransactionExecutionDetailandPayment.This is useful for
TransactionExecutionRequestthat doesn't require a parent transaction, such asDefaultTransactionTypes.AUTHORIZEandDefaultTransactionTypes.AUTHORIZE_AND_CAPTURE.- Parameters:
request- theTransactionExecutionRequestdescribing the desired details of the executiontransactionExecutionDetail- theTransactionExecutionDetailthat was executedpayment- the relatedPaymentthat the transactions acted against- Returns:
- a
TransactionExecutionResponsefor a singleTransactionExecutionDetailandPayment
-
buildTransactionExecutionResponse
TransactionExecutionResponse buildTransactionExecutionResponse(TransactionExecutionRequest request, List<TransactionExecutionDetail> transactionExecutionDetails, @Nullable Payment payment) Builds aTransactionExecutionResponsebased on the givenTransactionExecutionDetailsandPayment.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
TransactionExecutionRequestwants 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- theTransactionExecutionRequestdescribing the desired details of the executiontransactionExecutionDetails- a list ofTransactionExecutionDetailsthat were executedpayment- the relatedPaymentthat the transactions acted against- Returns:
- a
TransactionExecutionResponsebased on the givenTransactionExecutionDetailsandPayment
-
buildTransactionExecutionDetail
TransactionExecutionDetail buildTransactionExecutionDetail(@Nullable Payment payment, PaymentTransaction transaction, com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) Builds aTransactionExecutionDetailbased on the providedTransactionExecutionRequestandPaymentTransaction.- Parameters:
payment- The relatedPaymentthat the transactions acted against.transaction- The transaction that was executed.paymentResponse- The payment gateway's response to the executed transaction- Returns:
- A
TransactionExecutionDetailbased on the providedTransactionExecutionRequestandPaymentTransaction
-
buildTransactionExecutionResponse
default TransactionExecutionResponse buildTransactionExecutionResponse(@Nullable Payment payment, PaymentTransaction transaction) - Parameters:
payment- The relatedPaymentthat the request will act against.transaction- The transaction that was executed.- Returns:
- A
TransactionExecutionResponsebased on the providedPayment, andPaymentTransaction
-
buildTransactionExecutionResponse
TransactionExecutionResponse buildTransactionExecutionResponse(@Nullable Payment payment, PaymentTransaction transaction, @Nullable com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse) - Parameters:
payment- The relatedPaymentthat the request will act against.transaction- The transaction that was executed.paymentResponse- The payment gateway's response to the executed transaction- Returns:
- A
TransactionExecutionResponsebased on the providedPayment, andPaymentTransaction
-
getParentTransactionWithExecutableAmounts
List<TransactionWithExecutableAmount> getParentTransactionWithExecutableAmounts(Payment payment, TransactionExecutionRequest request) Gets a list ofTransactionWithExecutableAmountsrepresenting 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- thePaymentto look for the transaction from.- Returns:
- a list of
TransactionWithExecutableAmountsrepresenting the parent transactions of the givenTransactionExecutionRequest - Throws:
InvalidTransactionExecutionRequestException- if the givenTransactionExecutionRequest.getTransactionType()requires a parent transaction but is not found
-