Interface TransactionExecutionService
- All Known Implementing Classes:
DefaultTransactionExecutionService
public interface TransactionExecutionService
-
Method Summary
Modifier and TypeMethodDescriptionauthorize
(@NonNull TransactionExecutionRequest request, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute anDefaultTransactionTypes.AUTHORIZE
transaction.authorizeAndCapture
(@NonNull TransactionExecutionRequest request, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute anDefaultTransactionTypes.AUTHORIZE_AND_CAPTURE
transaction.capture
(@NonNull TransactionExecutionRequest request, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.CAPTURE
transaction.detachedCredit
(@NonNull TransactionExecutionRequest request, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.DETACHED_CREDIT
transaction.recordGatewayTransactionResults
(@NonNull String paymentId, Map<String, Object> transactionResults, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Records transaction results that are processed by the gateway outside the checkout workflow.refund
(@NonNull TransactionExecutionRequest request, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.REFUND
transaction.reverseAuthorize
(@NonNull TransactionExecutionRequest request, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.REVERSE_AUTH
transaction.updatePaymentBasedOnTransactionResult
(@NonNull Payment payment, @NonNull PaymentTransaction transaction, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse response, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Based on the results of the payment gateway authorize transaction, update thePayment
andSavedPaymentMethod
.
-
Method Details
-
authorize
TransactionExecutionResponse authorize(@NonNull @NonNull TransactionExecutionRequest request, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute anDefaultTransactionTypes.AUTHORIZE
transaction.- Parameters:
request
- TheTransactionExecutionRequest
describing the desired details of the transaction.lockToken
- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetail
describing the resulting transaction andPaymentSummary
. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if aPayment
cannot be found for the givenTransactionExecutionRequest.getPaymentId()
.InvalidTransactionExecutionRequestException
- if theTransactionExecutionRequest
is invalid.PaymentTransactionExecutionException
- if an unexpected error was encountered while executing the transaction.
-
authorizeAndCapture
TransactionExecutionResponse authorizeAndCapture(@NonNull @NonNull TransactionExecutionRequest request, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute anDefaultTransactionTypes.AUTHORIZE_AND_CAPTURE
transaction.- Parameters:
request
- TheTransactionExecutionRequest
describing the desired details of the transaction.lockToken
- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetail
describing the resulting transaction andPaymentSummary
. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if aPayment
cannot be found for the givenTransactionExecutionRequest.getPaymentId()
.InvalidTransactionExecutionRequestException
- if theTransactionExecutionRequest
is invalid.PaymentTransactionExecutionException
- if an unexpected error was encountered while executing the transaction.
-
capture
TransactionExecutionResponse capture(@NonNull @NonNull TransactionExecutionRequest request, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.CAPTURE
transaction.- Parameters:
request
- TheTransactionExecutionRequest
describing the desired details of the transaction.lockToken
- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetail
describing the resulting transaction andPaymentSummary
. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if aPayment
cannot be found for the givenTransactionExecutionRequest.getPaymentId()
.InvalidTransactionExecutionRequestException
- if theTransactionExecutionRequest
is invalid.PaymentTransactionExecutionException
- if an unexpected error was encountered while executing the transaction.
-
reverseAuthorize
TransactionExecutionResponse reverseAuthorize(@NonNull @NonNull TransactionExecutionRequest request, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.REVERSE_AUTH
transaction.- Parameters:
request
- TheTransactionExecutionRequest
describing the desired details of the transaction.lockToken
- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetail
describing the resulting transaction andPaymentSummary
. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if aPayment
cannot be found for the givenTransactionExecutionRequest.getPaymentId()
.InvalidTransactionExecutionRequestException
- if theTransactionExecutionRequest
is invalid.PaymentTransactionExecutionException
- if an unexpected error was encountered while executing the transaction.
-
refund
TransactionExecutionResponse refund(@NonNull @NonNull TransactionExecutionRequest request, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.REFUND
transaction.- Parameters:
request
- TheTransactionExecutionRequest
describing the desired details of the transaction.lockToken
- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetail
describing the resulting transaction andPaymentSummary
. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if aPayment
cannot be found for the givenTransactionExecutionRequest.getPaymentId()
.InvalidTransactionExecutionRequestException
- if theTransactionExecutionRequest
is invalid.PaymentTransactionExecutionException
- if an unexpected error was encountered while executing the transaction.
-
detachedCredit
TransactionExecutionResponse detachedCredit(@NonNull @NonNull TransactionExecutionRequest request, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.DETACHED_CREDIT
transaction.If
TransactionExecutionRequest.getParentTransactionId()
is provided, then we'll consider it to be acting as a refund. In this case, the parent transaction should haveDefaultTransactionTypes.CAPTURE
orDefaultTransactionTypes.AUTHORIZE_AND_CAPTURE
type, andTransactionExecutionRequest.getTransactionAmount()
must be less than or equal to the parent transaction's amount.- Parameters:
request
- TheTransactionExecutionRequest
describing the desired details of the transaction.lockToken
- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetail
describing the resulting transaction andPaymentSummary
. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if aPayment
cannot be found for the givenTransactionExecutionRequest.getPaymentId()
.InvalidTransactionExecutionRequestException
- if theTransactionExecutionRequest
is invalid.PaymentTransactionExecutionException
- if an unexpected error was encountered while executing the transaction.
-
recordGatewayTransactionResults
TransactionExecutionResponse recordGatewayTransactionResults(@NonNull @NonNull String paymentId, Map<String, Object> transactionResults, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Records transaction results that are processed by the gateway outside the checkout workflow.- Parameters:
paymentId
- the ID of the payment for this transactiontransactionResults
- a map of the gateway's results for this transactioncontext
- Context information around sandbox and multitenant state.- Returns:
- The
TransactionExecutionResponse
describing the resulting transaction andPaymentSummary
.
-
updatePaymentBasedOnTransactionResult
@Nullable Payment updatePaymentBasedOnTransactionResult(@NonNull @NonNull Payment payment, @NonNull @NonNull PaymentTransaction transaction, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse response, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Based on the results of the payment gateway authorize transaction, update thePayment
andSavedPaymentMethod
.- Parameters:
payment
- the payment that is to be updated based on the transactiontransaction
- the transaction that was just executedresponse
- the payment gateway's response to the transactionlockToken
- Token granted to resource that owns the payment lock.contextInfo
- Context information related to multitenancy.- Returns:
- the updated payment
-