Class DefaultTransactionSummaryService
java.lang.Object
com.broadleafcommerce.paymenttransaction.service.summary.DefaultTransactionSummaryService
- All Implemented Interfaces:
TransactionSummaryService
Default implementation of the
TransactionSummaryService
.- Author:
- Chris Kittrell (ckittrell)
-
Constructor Summary
ConstructorDescriptionDefaultTransactionSummaryService
(PaymentManagementService<Payment> paymentManagementService, PaymentSummaryService paymentSummaryService, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected TransactionSummary
addPaymentsToSummary
(@NonNull TransactionSummary transactionSummary, @NonNull List<Payment> payments) protected TransactionSummary
addTransactionsToSummary
(@NonNull TransactionSummary transactionSummary, @NonNull List<PaymentTransaction> transactions, @NonNull TransactionSummaryRequest request) protected PaymentRef
buildPaymentRef
(Payment payment) protected List<PaymentTransactionRef>
buildTransactionRefs
(@NonNull List<PaymentTransaction> transactions, @NonNull TransactionSummaryRequest request) buildTransactionSummary
(@NonNull TransactionSummaryRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds aTransactionSummary
based on thePaymentTransactions
of thePayments
identified byTransactionSummaryRequest.getOwnerType()
&TransactionSummaryRequest.getOwnerId()
.protected javax.money.MonetaryAmount
determineAmountAwaiting3DSResults
(@NonNull TransactionSummary transactionSummary, @NonNull List<PaymentTransaction> transactions) Determines the amount awaiting 3DS results.protected javax.money.MonetaryAmount
determineAmountAwaitingExternalResults
(@NonNull TransactionSummary transactionSummary, @NonNull List<PaymentTransaction> transactions) Determines the amount awaiting external results.protected javax.money.MonetaryAmount
determineAuthorizeAmountAwaitingResult
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the authorize amount awaiting payment gateway result from the payment transactions.protected javax.money.MonetaryAmount
determineAuthorizedAmount
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the authorized amount of the payment transactions - "total authorized - total reverse-authed".protected javax.money.MonetaryAmount
determineCaptureAmountAwaitingResult
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the capture amount awaiting payment gateway result from the payment transactions.protected javax.money.MonetaryAmount
determineCapturedAmount
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the captured amount of the payment transactions - "total captured - total refunded".protected javax.money.MonetaryAmount
determineDetachedCreditAmount
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the detached amount of the payment transactions.protected javax.money.MonetaryAmount
determineRefundAmountAwaitingResult
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the refund amount awaiting payment gateway result from the payment transactions.protected javax.money.MonetaryAmount
determineRefundedAmount
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the refunded amount of the payment transactions.protected javax.money.MonetaryAmount
determineReverseAuthAmountAwaitingResult
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the reverse authorize amount awaiting payment gateway result from the payment transactions.protected javax.money.MonetaryAmount
determineTotalEverCaptured
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the total amount ever captured by the payment transactions.protected List<PaymentTransaction>
filterOutNonSuccessfulAndReversedTransactions
(@NonNull List<PaymentTransaction> transactions) protected List<PaymentTransaction>
filterOutNonSuccessfulTransactions
(@NonNull List<PaymentTransaction> transactions) protected List<PaymentTransaction>
filterOutReversedOrReversalTransactions
(@NonNull List<PaymentTransaction> transactions) protected PaymentManagementService<Payment>
protected PaymentSummaryService
protected com.broadleafcommerce.common.extension.TypeFactory
protected boolean
isDetachedCreditActingAsRefund
(PaymentTransaction transaction) protected void
updateTransactionSummaryForAmountAwaiting3DSResults
(@NonNull TransactionSummary transactionSummary, @NonNull List<PaymentTransaction> transactions) UpdateTransactionSummary
forPaymentTransactions
that are awaiting 3DS results.protected void
updateTransactionSummaryForAmountAwaitingExternalResults
(@NonNull TransactionSummary transactionSummary, @NonNull List<PaymentTransaction> transactions) UpdateTransactionSummary
forPaymentTransactions
that are awaiting external results.protected void
updateTransactionSummaryForPendingAmounts
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) UpdateTransactionSummary
forPaymentTransactions
that are awaiting async results or 3DS results.protected void
updateTransactionSummaryProcessedAmounts
(@NonNull TransactionSummary transactionSummary, List<PaymentTransaction> nonReversedTransactions) UpdateTransactionSummary
forPaymentTransactions
that are successful.protected TransactionSummary
updateTransactionSummaryTotals
(@NonNull TransactionSummary transactionSummary, @NonNull List<PaymentTransaction> transactions)
-
Constructor Details
-
DefaultTransactionSummaryService
public DefaultTransactionSummaryService(PaymentManagementService<Payment> paymentManagementService, PaymentSummaryService paymentSummaryService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
buildTransactionSummary
public TransactionSummary buildTransactionSummary(@NonNull @NonNull TransactionSummaryRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:TransactionSummaryService
Builds aTransactionSummary
based on thePaymentTransactions
of thePayments
identified byTransactionSummaryRequest.getOwnerType()
&TransactionSummaryRequest.getOwnerId()
.- Specified by:
buildTransactionSummary
in interfaceTransactionSummaryService
- Parameters:
request
- TheTransactionSummaryRequest
used to identifyPayments
used to create theTransactionSummary
and the attributes used to filter for specific transaction sets.contextInfo
- the contextInfo for the request- Returns:
- a
TransactionSummary
based on thePaymentTransactions
of thePayments
identified byTransactionSummaryRequest.getOwnerType()
&TransactionSummaryRequest.getOwnerId()
-
addPaymentsToSummary
protected TransactionSummary addPaymentsToSummary(@NonNull @NonNull TransactionSummary transactionSummary, @NonNull @NonNull List<Payment> payments) -
addTransactionsToSummary
protected TransactionSummary addTransactionsToSummary(@NonNull @NonNull TransactionSummary transactionSummary, @NonNull @NonNull List<PaymentTransaction> transactions, @NonNull @NonNull TransactionSummaryRequest request) -
buildPaymentRef
-
buildTransactionRefs
protected List<PaymentTransactionRef> buildTransactionRefs(@NonNull @NonNull List<PaymentTransaction> transactions, @NonNull @NonNull TransactionSummaryRequest request) -
updateTransactionSummaryTotals
protected TransactionSummary updateTransactionSummaryTotals(@NonNull @NonNull TransactionSummary transactionSummary, @NonNull @NonNull List<PaymentTransaction> transactions) -
updateTransactionSummaryForAmountAwaiting3DSResults
protected void updateTransactionSummaryForAmountAwaiting3DSResults(@NonNull @NonNull TransactionSummary transactionSummary, @NonNull @NonNull List<PaymentTransaction> transactions) UpdateTransactionSummary
forPaymentTransactions
that are awaiting 3DS results.- Parameters:
transactionSummary
- theTransactionSummary
to updatetransactions
- thePaymentTransactions
-
determineAmountAwaiting3DSResults
protected javax.money.MonetaryAmount determineAmountAwaiting3DSResults(@NonNull @NonNull TransactionSummary transactionSummary, @NonNull @NonNull List<PaymentTransaction> transactions) Determines the amount awaiting 3DS results.- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment's collection of transactions- Returns:
- the amount awaiting 3DS results.
-
updateTransactionSummaryForAmountAwaitingExternalResults
protected void updateTransactionSummaryForAmountAwaitingExternalResults(@NonNull @NonNull TransactionSummary transactionSummary, @NonNull @NonNull List<PaymentTransaction> transactions) UpdateTransactionSummary
forPaymentTransactions
that are awaiting external results.- Parameters:
transactionSummary
- theTransactionSummary
to updatetransactions
- thePaymentTransactions
-
determineAmountAwaitingExternalResults
protected javax.money.MonetaryAmount determineAmountAwaitingExternalResults(@NonNull @NonNull TransactionSummary transactionSummary, @NonNull @NonNull List<PaymentTransaction> transactions) Determines the amount awaiting external results.- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment's collection of transactions- Returns:
- the amount awaiting external results.
-
filterOutNonSuccessfulAndReversedTransactions
protected List<PaymentTransaction> filterOutNonSuccessfulAndReversedTransactions(@NonNull @NonNull List<PaymentTransaction> transactions) -
filterOutNonSuccessfulTransactions
protected List<PaymentTransaction> filterOutNonSuccessfulTransactions(@NonNull @NonNull List<PaymentTransaction> transactions) -
filterOutReversedOrReversalTransactions
protected List<PaymentTransaction> filterOutReversedOrReversalTransactions(@NonNull @NonNull List<PaymentTransaction> transactions) -
updateTransactionSummaryProcessedAmounts
protected void updateTransactionSummaryProcessedAmounts(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> nonReversedTransactions) UpdateTransactionSummary
forPaymentTransactions
that are successful.- Parameters:
transactionSummary
- theTransactionSummary
to updatenonReversedTransactions
- the non-reversed or reversalPaymentTransactions
-
determineAuthorizedAmount
protected javax.money.MonetaryAmount determineAuthorizedAmount(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the authorized amount of the payment transactions - "total authorized - total reverse-authed".- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment transactions- Returns:
- the authorized amount of the payment transactions
-
determineCapturedAmount
protected javax.money.MonetaryAmount determineCapturedAmount(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the captured amount of the payment transactions - "total captured - total refunded".- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment transactions- Returns:
- the captured amount of the payment transactions
-
determineTotalEverCaptured
protected javax.money.MonetaryAmount determineTotalEverCaptured(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the total amount ever captured by the payment transactions.- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment transactions- Returns:
- the total amount ever captured by the payment transactions
-
determineRefundedAmount
protected javax.money.MonetaryAmount determineRefundedAmount(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the refunded amount of the payment transactions. If there is theDefaultTransactionTypes.DETACHED_CREDIT
transaction with theDefaultTransactionTypes.CAPTURE
orDefaultTransactionTypes.AUTHORIZE_AND_CAPTURE
parent transaction the detached amount will be included in refunded amount.- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment transactions- Returns:
- the refunded amount of the payment transactions
-
determineDetachedCreditAmount
protected javax.money.MonetaryAmount determineDetachedCreditAmount(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the detached amount of the payment transactions. If the transaction has the parent transaction withDefaultTransactionTypes.CAPTURE
orDefaultTransactionTypes.AUTHORIZE_AND_CAPTURE
type the detached amount is skipped and will be added toTransactionSummary.getAmountRefunded()
.- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment transactions- Returns:
- the detached amount of the payment transactions
-
isDetachedCreditActingAsRefund
-
updateTransactionSummaryForPendingAmounts
protected void updateTransactionSummaryForPendingAmounts(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) UpdateTransactionSummary
forPaymentTransactions
that are awaiting async results or 3DS results.- Parameters:
transactionSummary
- theTransactionSummary
to updatetransactions
- thePaymentTransactions
-
determineAuthorizeAmountAwaitingResult
protected javax.money.MonetaryAmount determineAuthorizeAmountAwaitingResult(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the authorize amount awaiting payment gateway result from the payment transactions.- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment transactions- Returns:
- the authorize amount awaiting payment gateway result from the payment transactions
-
determineCaptureAmountAwaitingResult
protected javax.money.MonetaryAmount determineCaptureAmountAwaitingResult(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the capture amount awaiting payment gateway result from the payment transactions.- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment transactions- Returns:
- the capture amount awaiting payment gateway result from the payment transactions
-
determineReverseAuthAmountAwaitingResult
protected javax.money.MonetaryAmount determineReverseAuthAmountAwaitingResult(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the reverse authorize amount awaiting payment gateway result from the payment transactions.- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment transactions- Returns:
- the reverse authorize amount awaiting payment gateway result from the payment transactions
-
determineRefundAmountAwaitingResult
protected javax.money.MonetaryAmount determineRefundAmountAwaitingResult(@NonNull @NonNull TransactionSummary transactionSummary, List<PaymentTransaction> transactions) Determines the refund amount awaiting payment gateway result from the payment transactions.- Parameters:
transactionSummary
- theTransactionSummary
for the paymenttransactions
- the payment transactions- Returns:
- the refund amount awaiting payment gateway result from the payment transactions
-
getPaymentManagementService
-
getPaymentSummaryService
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-