Interface PaymentTransactionExecutionProvider
- All Known Implementing Classes:
ExternalPaymentTransactionExecutionProvider
public interface PaymentTransactionExecutionProvider
Provider for interfacing with a PaymentTransactionService's APIs to execute payment transactions.
- Author:
- Chris Kittrell (ckittrell)
-
Method Summary
Modifier and TypeMethodDescriptionauthorizeAndCapture(String savedPaymentMethodId, SavedPaymentMethodTransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Authorize and Captures an amount described by theSavedPaymentMethodTransactionExecutionRequestagainst the saved payment method described by the providedsavedPaymentMethodId.lookupAuthAndCaptureTransactionResults(String savedPaymentMethodId, String requestId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Using the providedsavedPaymentMethodId&requestId(must match the requestId provided in the attempted AuthorizeAndCapture transaction) to lookup transaction results for the transaction.lookupRefundTransactionResults(String paymentId, String requestId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Using the providedpaymentId&requestId(must match the requestId provided in the attempted Refund transaction) to lookup transaction results for the transaction.refund(String paymentId, TransactionExecutionRequest request, String paymentVersion, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refunds an amount for the given payment.
-
Method Details
-
authorizeAndCapture
TransactionExecutionResponse authorizeAndCapture(String savedPaymentMethodId, SavedPaymentMethodTransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Authorize and Captures an amount described by theSavedPaymentMethodTransactionExecutionRequestagainst the saved payment method described by the providedsavedPaymentMethodId. Note: The combination ofsavedPaymentMethodId&SavedPaymentMethodTransactionExecutionRequest.getRequestId()are used to describe the uniqueness of the attempted interaction. This combination must be unique, or the request will be rejected.- Parameters:
savedPaymentMethodId- The id of a saved payment method stored in PaymentTransactionServicesrequest- The request payload describing the transaction that is to be executedcontextInfo- context information around the multi-tenant state- Returns:
- the
TransactionExecutionResponsefor the AuthorizeAndCapture transaction
-
refund
TransactionExecutionResponse refund(String paymentId, TransactionExecutionRequest request, String paymentVersion, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refunds an amount for the given payment.This method assumes that the parent transaction of this execution belongs to the same source entity, hence using
sourceEntityTypeasparentSourceEntityType.- Parameters:
paymentId- the id of the PaymentTransactionServices Payment that was created as part of the AuthorizeAndCapture transaction using a saved payment methodrequest- theTransactionExecutionRequestto executepaymentVersion- the known version of the PaymentTransactionServices Payment. Note: If this value is out-of-date (i.e. the Payment has since been updated or a transaction has been executed), then the BillingService could be making an incorrect decision about executing a refund.contextInfo- context information around the multi-tenant state- Returns:
- the
TransactionExecutionResponsefor the Refund transaction
-
lookupAuthAndCaptureTransactionResults
Optional<TransactionExecutionResponse> lookupAuthAndCaptureTransactionResults(String savedPaymentMethodId, String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Using the providedsavedPaymentMethodId&requestId(must match the requestId provided in the attempted AuthorizeAndCapture transaction) to lookup transaction results for the transaction.- Parameters:
savedPaymentMethodId- The id of a saved payment method stored in PaymentTransactionServicesrequestId- The request id provided viaSavedPaymentMethodTransactionExecutionRequest.getRequestId()with the attempted AuthorizeAndCapture transactioncontextInfo- context information around the multi-tenant state- Returns:
- an optional containing the results of the AuthorizeAndCapture transaction, if they can be found
-
lookupRefundTransactionResults
Optional<TransactionExecutionResponse> lookupRefundTransactionResults(String paymentId, String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Using the providedpaymentId&requestId(must match the requestId provided in the attempted Refund transaction) to lookup transaction results for the transaction.- Parameters:
paymentId- The id of a Payment in PaymentTransactionServicesrequestId- The request id provided viaSavedPaymentMethodTransactionExecutionRequest.getRequestId()with the attempted Refund transactioncontextInfo- context information around the multi-tenant state- Returns:
- an optional containing the results of the Refund transaction, if they can be found
-