Class DefaultPaymentCaptureService
- All Implemented Interfaces:
PaymentCaptureService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionautoCapturePaymentsIfNecessary(com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) This method is used to auto-capture payments for the gateway types specified inOrderOperationPaymentProperties.getAutoCapturePaymentGateways(String, String)list.protected List<PaymentExecutionRequest>buildFromPaymentDistributionDetails(@NonNull javax.money.MonetaryAmount totalToExecute, @NonNull List<ExecutablePayment> executablePayments, @NonNull com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a list ofPaymentExecutionRequestsbased on theOrder.getPaymentDistributionDetails().protected List<PaymentExecutionRequest>buildFromPaymentPriority(@NonNull javax.money.MonetaryAmount totalToExecute, @NonNull List<ExecutablePayment> executablePayments, @NonNull com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a list ofPaymentExecutionRequestsbased on the payment priority.protected com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaimbuildFulfillmentCaptureClaim(@NonNull String paymentId, @NonNull javax.money.MonetaryAmount amountToClaim, @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Builds aFulfillmentCaptureClaimbased on the givenPaymentSummaryand amount to claim.protected com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaimbuildFulfillmentCaptureClaim(@NonNull String paymentId, @NonNull javax.money.MonetaryAmount amountToClaim, String fulfillmentId) Deprecated, for removal: This API element is subject to removal in a future version.protected List<com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaim>buildFulfillmentCaptureClaims(@NonNull List<PaymentExecutionRequest> claimRequests, @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Builds a list ofFulfillmentCaptureClaimsbased on the givenpayment claim requestsprotected List<com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaim>buildFulfillmentCaptureClaims(List<PaymentExecutionRequest> claimRequests, String fulfillmentId) Deprecated, for removal: This API element is subject to removal in a future version.protected PaymentExecutionRequestbuildPaymentExecutionRequest(@NonNull ExecutablePayment executablePayment, @NonNull javax.money.MonetaryAmount amountToExecute, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected List<PaymentExecutionRequest>buildPaymentExecutionRequests(@NonNull javax.money.MonetaryAmount totalToExecute, @NonNull List<ExecutablePayment> executablePayments, @NonNull com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected TransactionExecutionResponsecaptureAmount(@NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @NonNull PaymentSummary paymentSummary, @NonNull String lockToken, TransactionAmountDetails transactionAmountDetails, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Captures the amount specified against the provided payment.protected TransactionExecutionResponsecaptureAmount(@NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @NonNull PaymentSummary paymentSummary, @NonNull String lockToken, javax.money.MonetaryAmount amountToCapture, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Captures the amount specified against the provided payment.protected List<com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaim>claimAlreadyCapturedAmountsIfPossible(@NonNull List<PaymentExecutionRequest> executionRequests, @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Claims capture transactions that were executed during the checkout flow (AuthAndCapture checkout transaction type) if possible.claimAndCaptureFulfillment(@NonNull javax.money.MonetaryAmount totalToCapture, @NonNull com.broadleafcommerce.order.client.domain.Order order, @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Responsible for claiming and/or capturing an amount from theOrder'spayments.protected List<TransactionExecutionResponse>executeAutoCaptures(@NonNull List<PaymentExecutionRequest> executionRequestsForAutoCapturing, @NonNull com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected TransactionExecutionResponseexecuteAutoCaptureTransaction(@NonNull PaymentSummary paymentSummary, @NonNull String lockToken, @NonNull TransactionExecutionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected List<TransactionExecutionResponse>executeCaptures(@NonNull List<PaymentExecutionRequest> paymentExecutionRequests, @NonNull com.broadleafcommerce.order.client.domain.Order order, @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Executes capture transactions based on the givenPaymentExecutionRequests.protected javax.money.MonetaryAmountgetAmountAvailableForCapture(@NonNull PaymentSummary payment) Determines the amount that can be captured for this paymentprotected javax.money.MonetaryAmountgetAmountToCapture(@NonNull PaymentSummary payment, @NonNull javax.money.MonetaryAmount remainingToCapture) Based on the payment & the remaining to capture, return the amount that should be captured for this paymentprotected javax.money.MonetaryAmountgetAmountToExecute(@NonNull javax.money.MonetaryAmount totalToExecute, @NonNull ExecutablePayment executablePayment) protected StringgetApplicationIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected javax.money.MonetaryAmountgetClaimableAmount(@NonNull PaymentSummary payment, com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaimSummary claimSummary) protected <P extends PaymentSummary>
Map<String,com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaimSummary> getClaimSummaryByPaymentId(@NonNull List<P> payments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets a map ofFulfillmentCaptureClaimSummaryby the payment id.protected List<ExecutablePayment>getExecutablePayments(@NonNull com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a sorted list ofExecutablePaymentsrepresentingPaymentSummariesthat are available for claim or capture for the givenOrder.protected FulfillmentCaptureClaimProviderprotected OrderOperationPaymentPropertiesprotected OrderOperationServicePropertiesprotected PaymentDistributionServiceprotected List<PaymentExecutionRequest>getPaymentExecutionRequestsForAutoCapturing(@NonNull com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) getPaymentIds(List<org.springframework.data.util.Pair<PaymentSummary, javax.money.MonetaryAmount>> amountToCapturePerPayment) Gets a list of payment ids from the given list of amounts to capture per payment.protected PaymentPriorityStrategyprotected PaymentProviderprotected List<PaymentSummary>getPaymentsWithAmountAvailableForCapture(@NonNull com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Identifies the order's payments that have some amount that is available to be captured.protected List<PaymentSummary>getPaymentsWithAmountAvailableToClaim(@NonNull com.broadleafcommerce.order.client.domain.Order order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the order's payments that have some amount that is available to be claimed.protected StringgetTenantIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.common.extension.TypeFactoryvoidsetFulfillmentCaptureClaimProvider(FulfillmentCaptureClaimProvider fulfillmentCaptureClaimProvider) voidsetOrderOperationPaymentProperties(OrderOperationPaymentProperties orderOperationPaymentProperties) voidsetOrderOperationServiceProperties(OrderOperationServiceProperties orderOperationServiceProperties) voidsetPaymentDistributionService(PaymentDistributionService paymentDistributionService) voidsetPaymentPriorityStrategy(PaymentPriorityStrategy paymentPriorityStrategy) voidsetTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) protected List<ExecutablePayment>sortExecutablePaymentsByPriority(List<ExecutablePayment> executablePayments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Given a list ofExecutablePayments, sorts them in order of which should be captured first.protected List<PaymentSummary>sortPaymentsByPriority(List<PaymentSummary> paymentSummaries) Deprecated.since 1.7.2, in favor ofsortPaymentsByPriority(List, ContextInfo)protected List<PaymentSummary>sortPaymentsByPriority(List<PaymentSummary> paymentSummaries, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Given a list ofPaymentSummaries, sorts them in order of which should be captured first.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.orderoperation.service.payment.PaymentCaptureService
captureFulfillment, captureFulfillmentTotal
-
Constructor Details
-
DefaultPaymentCaptureService
-
-
Method Details
-
claimAndCaptureFulfillment
public CaptureFulfillmentResult claimAndCaptureFulfillment(@NonNull @NonNull javax.money.MonetaryAmount totalToCapture, @NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentCaptureServiceResponsible for claiming and/or capturing an amount from theOrder'spayments.If there are payments already captured during the checkout flow, meaning the checkout transaction type was
DefaultTransactionTypes.AUTHORIZE_AND_CAPTURE, this method will claim those captured amounts instead of executing unnecessary capture transactions.In a multi-payment scenario with different checkout transaction types, there may be a mixture of claiming and executing the capture transactions for a single
OrderFulfillment.- Specified by:
claimAndCaptureFulfillmentin interfacePaymentCaptureService- Parameters:
totalToCapture- The amount to claim and/or capture for theOrderFulfillmentorder- The order whose payments should be used to claim and/or capture the specified amountfulfillment- The fulfillment to claim and/or capture payment(s) forcontextInfo- Context information around sandbox and multitenant state.- Returns:
- the
CaptureFulfillmentResultcontaining details about how the fulfillment was claimed and/or captured
-
autoCapturePaymentsIfNecessary
public List<TransactionExecutionResponse> autoCapturePaymentsIfNecessary(com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:PaymentCaptureServiceThis method is used to auto-capture payments for the gateway types specified inOrderOperationPaymentProperties.getAutoCapturePaymentGateways(String, String)list.- Specified by:
autoCapturePaymentsIfNecessaryin interfacePaymentCaptureService- Parameters:
order- The order whose payments should be used to capture the auto paymentcontextInfo- Context information around sandbox and multitenant state- Returns:
- the
TransactionExecutionResponsesfor all the capture transactions
-
getExecutablePayments
protected List<ExecutablePayment> getExecutablePayments(@NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a sorted list ofExecutablePaymentsrepresentingPaymentSummariesthat are available for claim or capture for the givenOrder.- Parameters:
order- theOrderto build theExecutablePaymentsforcontextInfo- context information around sandbox and multitenant state- Returns:
- a list of
ExecutablePaymentsrepresentingPaymentSummariesthat are available for claim or capture for the givenOrder
-
buildPaymentExecutionRequests
protected List<PaymentExecutionRequest> buildPaymentExecutionRequests(@NonNull @NonNull javax.money.MonetaryAmount totalToExecute, @NonNull @NonNull List<ExecutablePayment> executablePayments, @NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
buildFromPaymentDistributionDetails
protected List<PaymentExecutionRequest> buildFromPaymentDistributionDetails(@NonNull @NonNull javax.money.MonetaryAmount totalToExecute, @NonNull @NonNull List<ExecutablePayment> executablePayments, @NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a list ofPaymentExecutionRequestsbased on theOrder.getPaymentDistributionDetails().This will always execute a payment transaction for each payment based on its distribution, regardless the total amount to execute.
- Parameters:
totalToExecute- the total to executeexecutablePayments- a list ofExecutablePaymentscontaining the executablePaymentSummaryalong with its amount available to execute, sorted by payment priorityorder- theOrderthat the execution requests are related tocontextInfo- context information around sandbox and multitenant state- Returns:
- a list of
PaymentExecutionRequestsbased on theOrder.getPaymentDistributionDetails()
-
buildFromPaymentPriority
protected List<PaymentExecutionRequest> buildFromPaymentPriority(@NonNull @NonNull javax.money.MonetaryAmount totalToExecute, @NonNull @NonNull List<ExecutablePayment> executablePayments, @NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds a list ofPaymentExecutionRequestsbased on the payment priority.This will capture/claim as much as possible for each payment based on its available amount, to minimize the total number of payment executions.
- Parameters:
totalToExecute- the total to executeexecutablePayments- a list ofExecutablePaymentscontaining the executablePaymentSummaryalong with its amount available to execute, sorted by payment priorityorder- theOrderthat the execution requests are related tocontextInfo- context information around sandbox and multitenant state- Returns:
- a list of
PaymentExecutionRequestsbased on theOrder.getPaymentDistributionDetails()
-
buildPaymentExecutionRequest
protected PaymentExecutionRequest buildPaymentExecutionRequest(@NonNull @NonNull ExecutablePayment executablePayment, @NonNull @NonNull javax.money.MonetaryAmount amountToExecute, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getAmountToExecute
protected javax.money.MonetaryAmount getAmountToExecute(@NonNull @NonNull javax.money.MonetaryAmount totalToExecute, @NonNull @NonNull ExecutablePayment executablePayment) -
executeCaptures
protected List<TransactionExecutionResponse> executeCaptures(@NonNull @NonNull List<PaymentExecutionRequest> paymentExecutionRequests, @NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Executes capture transactions based on the givenPaymentExecutionRequests.- Parameters:
paymentExecutionRequests- ThePaymentExecutionRequestsused to execute the capture transactionsorder- The order whose payments should be used to capture the specified amountfulfillment- The fulfillment to capture payment forcontextInfo- Context information around sandbox and multitenant state.- Returns:
- the
TransactionExecutionResponsesfor all the capture transactions - Throws:
PaymentCaptureException- If the totalToCapture is too high and cannot be handled by the order's paymentsPaymentTransactionFailureException- If a payment capture transaction fails
-
getPaymentExecutionRequestsForAutoCapturing
protected List<PaymentExecutionRequest> getPaymentExecutionRequestsForAutoCapturing(@NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
executeAutoCaptures
protected List<TransactionExecutionResponse> executeAutoCaptures(@NonNull @NonNull List<PaymentExecutionRequest> executionRequestsForAutoCapturing, @NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
executeAutoCaptureTransaction
protected TransactionExecutionResponse executeAutoCaptureTransaction(@NonNull @NonNull PaymentSummary paymentSummary, @NonNull @NonNull String lockToken, @NonNull @NonNull TransactionExecutionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
claimAlreadyCapturedAmountsIfPossible
protected List<com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaim> claimAlreadyCapturedAmountsIfPossible(@NonNull @NonNull List<PaymentExecutionRequest> executionRequests, @NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Claims capture transactions that were executed during the checkout flow (AuthAndCapture checkout transaction type) if possible.Note that only payments with captured amounts with the matching
Order.getCheckoutRequestId()are considered claimable.- Parameters:
executionRequests- ThePaymentExecutionRequestscontaining requests to claimfulfillment- The fulfillment to claim the capture transactions forcontextInfo- Context information around sandbox and multitenant state.- Returns:
- a list of
FulfillmentCaptureClaimsrepresenting the amounts that have been claimed
-
getPaymentsWithAmountAvailableToClaim
protected List<PaymentSummary> getPaymentsWithAmountAvailableToClaim(@NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the order's payments that have some amount that is available to be claimed.This method retrieves payments with checkout-executed capture transactions, meaning the checkout transaction type was
DefaultTransactionTypes.AUTHORIZE_AND_CAPTURE, so that we can claim already-executed capture amounts rather than executing unnecessary capture transactions.- Parameters:
order- the order whose payments should be capturedcontextInfo- context information around sandbox and multitenant state- Returns:
- the payment summaries that have some amount that is available to be claimed
-
getClaimSummaryByPaymentId
protected <P extends PaymentSummary> Map<String,com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaimSummary> getClaimSummaryByPaymentId(@NonNull @NonNull List<P> payments, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets a map ofFulfillmentCaptureClaimSummaryby the payment id.- Parameters:
payments- The payments to get the claim summaries forcontextInfo- Context information around sandbox and multitenant state.- Returns:
- a map of
FulfillmentCaptureClaimSummaryby the payment id
-
getClaimableAmount
protected javax.money.MonetaryAmount getClaimableAmount(@NonNull @NonNull PaymentSummary payment, @Nullable com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaimSummary claimSummary) -
buildFulfillmentCaptureClaims
@Deprecated(forRemoval=true) protected List<com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaim> buildFulfillmentCaptureClaims(List<PaymentExecutionRequest> claimRequests, String fulfillmentId) Deprecated, for removal: This API element is subject to removal in a future version. -
buildFulfillmentCaptureClaims
protected List<com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaim> buildFulfillmentCaptureClaims(@NonNull @NonNull List<PaymentExecutionRequest> claimRequests, @NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Builds a list ofFulfillmentCaptureClaimsbased on the givenpayment claim requests- Parameters:
claimRequests- a list ofpayment claim requestsorderFulfillment- theOrderFulfillmentthat the claims are for- Returns:
- a list of
FulfillmentCaptureClaimsbased on the givenpayment claim requests
-
buildFulfillmentCaptureClaim
@Deprecated(forRemoval=true) protected com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaim buildFulfillmentCaptureClaim(@NonNull @NonNull String paymentId, @NonNull @NonNull javax.money.MonetaryAmount amountToClaim, String fulfillmentId) Deprecated, for removal: This API element is subject to removal in a future version. -
buildFulfillmentCaptureClaim
protected com.broadleafcommerce.order.client.domain.FulfillmentCaptureClaim buildFulfillmentCaptureClaim(@NonNull @NonNull String paymentId, @NonNull @NonNull javax.money.MonetaryAmount amountToClaim, @NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment orderFulfillment) Builds aFulfillmentCaptureClaimbased on the givenPaymentSummaryand amount to claim.The deprecated
buildFulfillmentCaptureClaim(String, MonetaryAmount, String)method is called for the sake of backward compatibility and ensure that customization is used, if any.- Parameters:
paymentId- the payment id to claim againstamountToClaim- theMonetaryAmountto claimorderFulfillment- theOrderFulfillmentthat the claims are for- Returns:
- a
FulfillmentCaptureClaimbased on the givenPaymentSummaryand amount to claim
-
getPaymentsWithAmountAvailableForCapture
protected List<PaymentSummary> getPaymentsWithAmountAvailableForCapture(@NonNull @NonNull com.broadleafcommerce.order.client.domain.Order order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Identifies the order's payments that have some amount that is available to be captured.- Parameters:
order- The order whose payments should be capturedcontextInfo- Context information around sandbox and multitenant state.- Returns:
- The payment summaries that have some amount that is available to be captured
-
sortExecutablePaymentsByPriority
protected List<ExecutablePayment> sortExecutablePaymentsByPriority(List<ExecutablePayment> executablePayments, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Given a list ofExecutablePayments, sorts them in order of which should be captured first.Any custom logic for capture payment priority should be added here.
- Parameters:
executablePayments- the list ofExecutablePaymentsto sortcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a new list representing the sorted result
-
sortPaymentsByPriority
protected List<PaymentSummary> sortPaymentsByPriority(List<PaymentSummary> paymentSummaries, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Given a list ofPaymentSummaries, sorts them in order of which should be captured first.Any custom logic for capture payment priority should be added here.
- Parameters:
paymentSummaries- the list ofPaymentSummariesto sort based on capture prioritycontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a new list representing the sorted result
-
sortPaymentsByPriority
@Deprecated protected List<PaymentSummary> sortPaymentsByPriority(List<PaymentSummary> paymentSummaries) Deprecated.since 1.7.2, in favor ofsortPaymentsByPriority(List, ContextInfo)Given a list ofPaymentSummaries, sorts them in order of which should be captured first. By default, the same list is returned.Any custom logic for capture payment priority should be added here.
- Parameters:
paymentSummaries- the list ofPaymentSummariesto sort based on capture priority- Returns:
- a new list representing the sorted result
-
getAmountToCapture
protected javax.money.MonetaryAmount getAmountToCapture(@NonNull @NonNull PaymentSummary payment, @NonNull @NonNull javax.money.MonetaryAmount remainingToCapture) Based on the payment & the remaining to capture, return the amount that should be captured for this payment- Parameters:
payment- The authorized payment that we're considering for captureremainingToCapture- The remaining total for the order that should be captured- Returns:
- The amount that should be captured for this payment
-
getAmountAvailableForCapture
protected javax.money.MonetaryAmount getAmountAvailableForCapture(@NonNull @NonNull PaymentSummary payment) Determines the amount that can be captured for this payment- Parameters:
payment- The authorized payment that is a candidate for capture- Returns:
- The payment's amount that is available for capture
-
getPaymentIds
protected List<String> getPaymentIds(List<org.springframework.data.util.Pair<PaymentSummary, javax.money.MonetaryAmount>> amountToCapturePerPayment) Gets a list of payment ids from the given list of amounts to capture per payment.- Parameters:
amountToCapturePerPayment- a list ofPaircontainers holding an authorized payment and the amount that should be captured against that payment- Returns:
- a list of payment ids
-
captureAmount
protected TransactionExecutionResponse captureAmount(@NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @NonNull @NonNull PaymentSummary paymentSummary, @NonNull @NonNull String lockToken, javax.money.MonetaryAmount amountToCapture, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Captures the amount specified against the provided payment.If one of the
TransactionExecutionDetailsin theTransactionExecutionResponsefailed, aPaymentTransactionFailureExceptionis thrown.- Parameters:
fulfillment- The fulfillment to capture payment forpaymentSummary- The payment that is being capturedlockToken- the token that owns the payment lockamountToCapture- The amount that should be captured against the provided authorize transactioncontextInfo- Context information around sandbox and multitenant state.- Returns:
- The
TransactionExecutionResponseof the capture transaction - Throws:
PaymentTransactionFailureException- if one of the capture transactions fails
-
captureAmount
protected TransactionExecutionResponse captureAmount(@NonNull @NonNull com.broadleafcommerce.order.client.domain.OrderFulfillment fulfillment, @NonNull @NonNull PaymentSummary paymentSummary, @NonNull @NonNull String lockToken, TransactionAmountDetails transactionAmountDetails, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Captures the amount specified against the provided payment.If one of the
TransactionExecutionDetailsin theTransactionExecutionResponsefailed, aPaymentTransactionFailureExceptionis thrown.- Parameters:
fulfillment- The fulfillment to capture payment forpaymentSummary- The payment that is being capturedlockToken- the token that owns the payment locktransactionAmountDetails- The amount that should be captured against the provided authorize transactioncontextInfo- Context information around sandbox and multitenant state.- Returns:
- The
TransactionExecutionResponseof the capture transaction - Throws:
PaymentTransactionFailureException- if one of the capture transactions fails
-
getApplicationIdFromContext
@Nullable protected String getApplicationIdFromContext(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getTenantIdFromContext
@Nullable protected String getTenantIdFromContext(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getPaymentProvider
-
getPaymentPriorityStrategy
-
setPaymentPriorityStrategy
-
getFulfillmentCaptureClaimProvider
-
setFulfillmentCaptureClaimProvider
@Autowired public void setFulfillmentCaptureClaimProvider(FulfillmentCaptureClaimProvider fulfillmentCaptureClaimProvider) -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
setTypeFactory
@Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
getOrderOperationServiceProperties
-
setOrderOperationServiceProperties
@Autowired public void setOrderOperationServiceProperties(OrderOperationServiceProperties orderOperationServiceProperties) -
getPaymentDistributionService
-
setPaymentDistributionService
@Autowired public void setPaymentDistributionService(PaymentDistributionService paymentDistributionService) -
getOrderOperationPaymentProperties
-
setOrderOperationPaymentProperties
@Autowired public void setOrderOperationPaymentProperties(OrderOperationPaymentProperties orderOperationPaymentProperties)
-
buildFulfillmentCaptureClaim(String, MonetaryAmount, OrderFulfillment)