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.AUTHORIZEtransaction.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_CAPTUREtransaction.capture(@NonNull TransactionExecutionRequest request, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.CAPTUREtransaction.detachedCredit(@NonNull TransactionExecutionRequest request, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.DETACHED_CREDITtransaction.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.REFUNDtransaction.reverseAuthorize(@NonNull TransactionExecutionRequest request, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Communicates with the relevant payment gateway to execute aDefaultTransactionTypes.REVERSE_AUTHtransaction.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 thePaymentandSavedPaymentMethod.
-
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.AUTHORIZEtransaction.- Parameters:
request- TheTransactionExecutionRequestdescribing the desired details of the transaction.lockToken- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetaildescribing the resulting transaction andPaymentSummary. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if aPaymentcannot be found for the givenTransactionExecutionRequest.getPaymentId().InvalidTransactionExecutionRequestException- if theTransactionExecutionRequestis 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_CAPTUREtransaction.- Parameters:
request- TheTransactionExecutionRequestdescribing the desired details of the transaction.lockToken- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetaildescribing the resulting transaction andPaymentSummary. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if aPaymentcannot be found for the givenTransactionExecutionRequest.getPaymentId().InvalidTransactionExecutionRequestException- if theTransactionExecutionRequestis 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.CAPTUREtransaction.- Parameters:
request- TheTransactionExecutionRequestdescribing the desired details of the transaction.lockToken- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetaildescribing the resulting transaction andPaymentSummary. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if aPaymentcannot be found for the givenTransactionExecutionRequest.getPaymentId().InvalidTransactionExecutionRequestException- if theTransactionExecutionRequestis 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_AUTHtransaction.- Parameters:
request- TheTransactionExecutionRequestdescribing the desired details of the transaction.lockToken- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetaildescribing the resulting transaction andPaymentSummary. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if aPaymentcannot be found for the givenTransactionExecutionRequest.getPaymentId().InvalidTransactionExecutionRequestException- if theTransactionExecutionRequestis 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.REFUNDtransaction.- Parameters:
request- TheTransactionExecutionRequestdescribing the desired details of the transaction.lockToken- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetaildescribing the resulting transaction andPaymentSummary. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if aPaymentcannot be found for the givenTransactionExecutionRequest.getPaymentId().InvalidTransactionExecutionRequestException- if theTransactionExecutionRequestis 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_CREDITtransaction.If
TransactionExecutionRequest.getParentTransactionId()is provided, then we'll consider it to be acting as a refund. In this case, the parent transaction should haveDefaultTransactionTypes.CAPTUREorDefaultTransactionTypes.AUTHORIZE_AND_CAPTUREtype, andTransactionExecutionRequest.getTransactionAmount()must be less than or equal to the parent transaction's amount.- Parameters:
request- TheTransactionExecutionRequestdescribing the desired details of the transaction.lockToken- Token granted to resource that owns the payment lock.- Returns:
- The
TransactionExecutionDetaildescribing the resulting transaction andPaymentSummary. - Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if aPaymentcannot be found for the givenTransactionExecutionRequest.getPaymentId().InvalidTransactionExecutionRequestException- if theTransactionExecutionRequestis 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
TransactionExecutionResponsedescribing 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 thePaymentandSavedPaymentMethod.- 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
-