Class ExternalPaymentProvider
java.lang.Object
com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
com.broadleafcommerce.orderoperation.service.provider.external.ExternalPaymentProvider
- All Implemented Interfaces:
PaymentProvider
-
Field Summary
FieldsFields inherited from class com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
ENTITY_NOT_FOUND, RSQL_FILTER_PARAM -
Constructor Summary
ConstructorsConstructorDescriptionExternalPaymentProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalPaymentProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionbuildTransactionExecutionRequest(String paymentId, TransactionType transactionType, TransactionAmountDetails transactionAmountDetails, String parentSourceEntityType, String parentSourceEntityId, String sourceEntityType, String sourceEntityId) Builds aTransactionExecutionRequestbased on the given properties.executeCapture(PaymentSummary paymentSummary, String lockToken, TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Captures an amount for the given payment.protected TransactionExecutionResponseexecutePaymentTransaction(String executionPath, TransactionExecutionRequest executionRequest, Integer paymentVersion, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) executeRefund(PaymentSummary paymentSummary, String lockToken, TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Refunds an amount for the given payment.executeReverseAuthorize(PaymentSummary paymentSummary, String lockToken, TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reverse authorizes an amount for the given payment.protected org.springframework.web.util.UriComponentsBuilderGets the base URI common to all requests this provider will make.Gets the type reference for a list of item list items.getPaymentIdVariables(String paymentId) protected ExternalPaymentPropertiesprotected StringlockPayments(@NonNull List<String> paymentIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Locks the given payments to ensure that all of the work done for capturing, reverse authorizing, and refunding process in general is consistently interacting with payments that will not change.readByPaymentOwnerAndTransactionSourceEntity(String ownerType, String ownerId, String sourceEntityType, String sourceEntityId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a list ofPaymentSummariesthat belong to the given payment owner and payment transaction source entity.readByPaymentOwnerAndTransactionSourceEntityTypes(String ownerType, String ownerId, Set<String> sourceEntityTypes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves a list ofPaymentSummariesthat belong to the given payment owner and payment transaction source entity types.readTransactionSummaryByPaymentOwner(String ownerType, String ownerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieves aTransactionSummaryfor the given owner entity type and id.voidunlockPayments(Collection<String> lockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Unlocks the payments, based on the lock tokens that were previously obtained viaPaymentProvider.lockPayments(List, ContextInfo).Methods inherited from class com.broadleafcommerce.orderoperation.service.provider.external.AbstractExternalProvider
buildNotFoundException, executeRequest, getHeaders, getObjectMapper, getTypeFactory, getWebClient, isEntityNotFound, pageableToParamsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.orderoperation.service.provider.PaymentProvider
buildTransactionExecutionRequest, buildTransactionExecutionRequest, buildTransactionExecutionRequest, readByCartId, readByOwnerTypeAndOwnerId
-
Field Details
-
DEFAULT_HEADER_PAYMENT_VERSION
- See Also:
-
DEFAULT_HEADER_PAYMENT_LOCK_TOKEN
- See Also:
-
-
Constructor Details
-
ExternalPaymentProvider
public ExternalPaymentProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ExternalPaymentProperties properties)
-
-
Method Details
-
readByPaymentOwnerAndTransactionSourceEntity
public List<PaymentSummary> readByPaymentOwnerAndTransactionSourceEntity(String ownerType, String ownerId, @Nullable String sourceEntityType, @Nullable String sourceEntityId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentProviderRetrieves a list ofPaymentSummariesthat belong to the given payment owner and payment transaction source entity.- Specified by:
readByPaymentOwnerAndTransactionSourceEntityin interfacePaymentProvider- Parameters:
ownerType- the owner type of thePaymentSummariesto retrieveownerId- the owner id of thePaymentSummariesto retrievecontextInfo- context information around sandbox and multitenant state- Returns:
- a list of
PaymentSummariesbased on the given payment owner and payment transaction source entity
-
readByPaymentOwnerAndTransactionSourceEntityTypes
public List<PaymentSummary> readByPaymentOwnerAndTransactionSourceEntityTypes(String ownerType, String ownerId, Set<String> sourceEntityTypes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentProviderRetrieves a list ofPaymentSummariesthat belong to the given payment owner and payment transaction source entity types.- Specified by:
readByPaymentOwnerAndTransactionSourceEntityTypesin interfacePaymentProvider- Parameters:
ownerType- the owner type of thePaymentSummariesto retrieveownerId- the owner id of thePaymentSummariesto retrievesourceEntityTypes- The set of source entity types to use for filteringcontextInfo- context information around sandbox and multitenant state- Returns:
- a list of
PaymentSummariesbased on the given payment owner and payment transaction source entity
-
readTransactionSummaryByPaymentOwner
public TransactionSummary readTransactionSummaryByPaymentOwner(String ownerType, String ownerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentProviderRetrieves aTransactionSummaryfor the given owner entity type and id.- Specified by:
readTransactionSummaryByPaymentOwnerin interfacePaymentProvider- Parameters:
ownerType- the owner type of thePaymentSummariesincluded in theTransactionSummaryownerId- the owner id of thePaymentSummariesincluded in theTransactionSummarycontextInfo- context information around sandbox and multitenant state- Returns:
- a
TransactionSummaryfor the given owner entity type and id
-
lockPayments
public Map<String,String> lockPayments(@NonNull @NonNull List<String> paymentIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentProviderLocks the given payments to ensure that all of the work done for capturing, reverse authorizing, and refunding process in general is consistently interacting with payments that will not change. With these locks in place, only this executing process will have access to modify the payments, until the lock TTL expires. Note: make sure that the capturing, reverse authorizing, and refunding process can sufficiently be contained within the payment lock TTL. This can be configured in PaymentTransactionServices.- Specified by:
lockPaymentsin interfacePaymentProvider- Parameters:
paymentIds- the ids of the payments are to be locked.contextInfo- context information around sandbox and multitenant state.- Returns:
- A map of payment id to lock token.
-
unlockPayments
public void unlockPayments(Collection<String> lockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentProviderUnlocks the payments, based on the lock tokens that were previously obtained viaPaymentProvider.lockPayments(List, ContextInfo).- Specified by:
unlockPaymentsin interfacePaymentProvider- Parameters:
lockTokens- Tokens that can be used to unlock the payments
-
executeCapture
public TransactionExecutionResponse executeCapture(PaymentSummary paymentSummary, String lockToken, TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentProviderCaptures an amount for the given payment.- Specified by:
executeCapturein interfacePaymentProvider- Parameters:
paymentSummary- the payment to capture the amount fromlockToken- the token that owns the payment lockrequest- theTransactionExecutionRequestto executecontextInfo- context information around sandbox and multitenant state- Returns:
- the
TransactionExecutionResponsefor the capture transaction
-
executeReverseAuthorize
public TransactionExecutionResponse executeReverseAuthorize(PaymentSummary paymentSummary, String lockToken, TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentProviderReverse authorizes an amount for the given payment.- Specified by:
executeReverseAuthorizein interfacePaymentProvider- Parameters:
paymentSummary- the payment to reverse authorize the amount fromlockToken- the token that owns the payment lockrequest- theTransactionExecutionRequestto executecontextInfo- context information around sandbox and multitenant state- Returns:
- the
TransactionExecutionResponsefor the reverse authorize transaction
-
executeRefund
public TransactionExecutionResponse executeRefund(PaymentSummary paymentSummary, String lockToken, TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentProviderRefunds 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.- Specified by:
executeRefundin interfacePaymentProvider- Parameters:
paymentSummary- the payment to refund the amount fromlockToken- the token that owns the payment lockrequest- theTransactionExecutionRequestto executecontextInfo- context information around sandbox and multitenant state- Returns:
- the
TransactionExecutionResponsefor the refund transaction
-
executePaymentTransaction
protected TransactionExecutionResponse executePaymentTransaction(String executionPath, TransactionExecutionRequest executionRequest, Integer paymentVersion, String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
buildTransactionExecutionRequest
public TransactionExecutionRequest buildTransactionExecutionRequest(String paymentId, TransactionType transactionType, TransactionAmountDetails transactionAmountDetails, String parentSourceEntityType, String parentSourceEntityId, String sourceEntityType, String sourceEntityId) Description copied from interface:PaymentProviderBuilds aTransactionExecutionRequestbased on the given properties.- Specified by:
buildTransactionExecutionRequestin interfacePaymentProvider- Parameters:
paymentId- theTransactionExecutionRequest.getPaymentId()transactionType- theTransactionExecutionRequest.getTransactionType()transactionAmountDetails- the transactionAmountDetailsparentSourceEntityType- theTransactionExecutionRequest.getParentSourceEntityType()parentSourceEntityId- theTransactionExecutionRequest.getParentSourceEntityId()sourceEntityType- theTransactionExecutionRequest.getSourceEntityType()sourceEntityId- theTransactionExecutionRequest.getSourceEntityId()- Returns:
- a
TransactionExecutionRequestbased on the given properties
-
getPaymentIdVariables
-
getMapType
Gets the type reference for a list of item list items.- Returns:
- type reference for a list of item list items
-
getBaseUri
protected org.springframework.web.util.UriComponentsBuilder getBaseUri()Gets the base URI common to all requests this provider will make.- Returns:
- a URI components builder with the base URI set up
-
getServiceClient
-
getProperties
-