public class DefaultPaymentConfirmationService extends Object implements PaymentConfirmationService
payments
in the context of a checkout submission.Constructor and Description |
---|
DefaultPaymentConfirmationService(com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayTransactionServiceProvider transactionServiceProvider,
com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayConfigurationProvider configurationProvider,
com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayRollbackServiceProvider rollbackServiceProvider,
PaymentTransactionService paymentTransactionService,
PaymentRequestService paymentRequestService,
CartPaymentStatusService paymentStatusService,
PaymentSummaryService paymentSummaryService,
CartProvider cartProvider,
com.broadleafcommerce.common.extension.TypeFactory typeFactory) |
Modifier and Type | Method and Description |
---|---|
protected com.broadleafcommerce.cart.client.domain.Cart |
authorizeAndCapturePayment(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull com.broadleafcommerce.order.common.domain.Payment payment,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Communicates with the relevant payment gateway, executing an authorization transaction for
the provided payment & records the results on the cart in the form of a
PaymentTransaction |
protected com.broadleafcommerce.cart.client.domain.Cart |
authorizeAndCapturePayment(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull com.broadleafcommerce.order.common.domain.Payment payment,
@NonNull String requestId,
String securityCode,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Communicates with the relevant payment gateway, executing an authorization transaction for
the provided payment & records the results on the cart in the form of a
PaymentTransaction |
protected com.broadleafcommerce.cart.client.domain.Cart |
authorizePayment(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull com.broadleafcommerce.order.common.domain.Payment payment,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Communicates with the relevant payment gateway, executing an authorization transaction for
the provided payment & records the results on the cart in the form of a
PaymentTransaction |
protected com.broadleafcommerce.cart.client.domain.Cart |
authorizePayment(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull com.broadleafcommerce.order.common.domain.Payment payment,
@NonNull String requestId,
String securityCode,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Communicates with the relevant payment gateway, executing an authorization transaction for
the provided payment & records the results on the cart in the form of a
PaymentTransaction |
com.broadleafcommerce.cart.client.domain.Cart |
confirmCartPayments(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Intended to confirm all unconfirmed, active
payments related to the provided
Cart . |
com.broadleafcommerce.cart.client.domain.Cart |
confirmCartPayments(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
@NonNull Map<String,String> securityCodes,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Intended to confirm all unconfirmed, active
payments related to the provided
Cart . |
protected CartProvider |
getCartProvider() |
protected String |
getCheckoutTransactionType(@NonNull String gatewayType)
Based on the provided
PaymentGatewayType , determine which TransactionType
should be used to execute the payment stage of the checkout. |
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayConfigurationProvider |
getConfigurationProvider() |
protected List<com.broadleafcommerce.order.common.domain.Payment> |
getConfirmedPayments(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Identifies all of the cart's authorized payments that could potentially be rolled back
|
List<com.broadleafcommerce.order.common.domain.Payment> |
getConfirmedPaymentsToRollback(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId)
Gather confirmed payments that have a successful transactions tied to the provided requestId
|
protected PaymentRequestService |
getPaymentRequestService() |
protected CartPaymentStatusService |
getPaymentStatusService() |
protected PaymentSummaryService |
getPaymentSummaryService() |
protected PaymentTransactionService |
getPaymentTransactionService() |
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayRollbackServiceProvider |
getRollbackServiceProvider() |
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayTransactionServiceProvider |
getTransactionServiceProvider() |
protected List<com.broadleafcommerce.order.common.domain.PaymentTransaction> |
getTransactionsToRollback(@NonNull com.broadleafcommerce.order.common.domain.Payment confirmedPayment,
@NonNull String requestId)
Gathers the successful authorization transactions that are related to the provided requestId.
|
protected com.broadleafcommerce.common.extension.TypeFactory |
getTypeFactory() |
protected com.broadleafcommerce.paymentgateway.service.PaymentGatewayRollbackService |
identifyRollbackService(@NonNull com.broadleafcommerce.order.common.domain.Payment payment)
Identifies the relevant
PaymentGatewayRollbackService based on the payment's
Payment.getGatewayType() |
protected com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService |
identifyTransactionService(@NonNull com.broadleafcommerce.order.common.domain.Payment payment)
Identifies the relevant
PaymentGatewayTransactionService based on the payment's
Payment.getGatewayType() |
com.broadleafcommerce.cart.client.domain.Cart |
rollbackConfirmedPayments(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Intended to roll back all authorized, active
payments related to the provided
Cart . |
protected com.broadleafcommerce.cart.client.domain.Cart |
rollbackSuccessfulAuthTransaction(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull com.broadleafcommerce.order.common.domain.Payment payment,
@NonNull com.broadleafcommerce.order.common.domain.PaymentTransaction parentTransaction,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Rolls back any successful authorization transactions by interacting with the relevant payment
gateway to void/cancel the authorization and records the result of the reverse-auth
transaction on the cart as a
PaymentTransaction . |
protected boolean |
shouldConfirmPayment(com.broadleafcommerce.order.common.domain.Payment payment)
Determine whether to confirm this payment.
|
protected List<com.broadleafcommerce.order.common.domain.Payment> |
sortPayments(List<com.broadleafcommerce.order.common.domain.Payment> payments)
Hook used to order the cart's payments to produce the most favorable conditions when
executing transactions against the payment.
|
public DefaultPaymentConfirmationService(com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayTransactionServiceProvider transactionServiceProvider, com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayConfigurationProvider configurationProvider, com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayRollbackServiceProvider rollbackServiceProvider, PaymentTransactionService paymentTransactionService, PaymentRequestService paymentRequestService, CartPaymentStatusService paymentStatusService, PaymentSummaryService paymentSummaryService, CartProvider cartProvider, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
public com.broadleafcommerce.cart.client.domain.Cart confirmCartPayments(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
PaymentConfirmationService
payments
related to the provided
Cart
. Ultimately the confirmation of each unconfirmed payment should lead to a
payment gateway transaction (usually an DefaultTransactionTypes.AUTHORIZE
transaction) & the recording of a PaymentTransaction
on the cart.confirmCartPayments
in interface PaymentConfirmationService
cart
- the cart that owns the list of paymentsrequestId
- the id representing the customer's request to confirm their paymentscontextInfo
- Context information around sandbox and multitenant state.public com.broadleafcommerce.cart.client.domain.Cart confirmCartPayments(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @NonNull @NonNull Map<String,String> securityCodes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
PaymentConfirmationService
payments
related to the provided
Cart
. Ultimately the confirmation of each unconfirmed payment should lead to a
payment gateway transaction (usually an DefaultTransactionTypes.AUTHORIZE
transaction) & the recording of a PaymentTransaction
on the cart.confirmCartPayments
in interface PaymentConfirmationService
cart
- the cart that owns the list of paymentsrequestId
- the id representing the customer's request to confirm their paymentssecurityCodes
- The map of card security codes keyed by payment id for processing saved
paymentscontextInfo
- Context information around sandbox and multitenant state.public List<com.broadleafcommerce.order.common.domain.Payment> getConfirmedPaymentsToRollback(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId)
PaymentConfirmationService
getConfirmedPaymentsToRollback
in interface PaymentConfirmationService
cart
- The cart whose checkout submission is being processedrequestId
- the unique identifier of this checkout attemptpublic com.broadleafcommerce.cart.client.domain.Cart rollbackConfirmedPayments(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
PaymentConfirmationService
payments
related to the provided
Cart
. The rollback of each authorized payment should lead to a
DefaultTransactionTypes.REVERSE_AUTH
payment gateway transaction & an updating of the
relevant PaymentTransaction
to have a unconfirmed status.rollbackConfirmedPayments
in interface PaymentConfirmationService
cart
- the cart that owns the list of payments that are to be rolled backrequestId
- the id representing the customer's request to confirm their paymentscontextInfo
- Context information around sandbox and multitenant state.protected List<com.broadleafcommerce.order.common.domain.Payment> sortPayments(List<com.broadleafcommerce.order.common.domain.Payment> payments)
PaymentConfirmationActivity
is the last activity in the workflow and the payment with
the challenging rollback is processed last, then the rollback will actually never occur.
Instead, either this payment's transaction will pass and the checkout completes, or the
transaction fails and only previously completed work may need to be rolled back.payments
- The un-ordered list of cart paymentsprotected String getCheckoutTransactionType(@NonNull @NonNull String gatewayType)
PaymentGatewayType
, determine which TransactionType
should be used to execute the payment stage of the checkout.gatewayType
- The payment gateway's unique identifier that should be used to lookup the
desired transaction typePaymentGatewayConfiguration.getCheckoutTransactionType()
protected com.broadleafcommerce.cart.client.domain.Cart authorizeAndCapturePayment(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.Payment payment, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
PaymentTransaction
cart
- the payment's owning cartpayment
- the payment to be authorizedrequestId
- the id representing the customer's request to confirm their paymentsPayment
& PaymentTransaction
which
represent the transaction resultscom.broadleafcommerce.paymentgateway.service.exception.PaymentException
- thrown if an error is encountered while executing the authorizationprotected com.broadleafcommerce.cart.client.domain.Cart authorizeAndCapturePayment(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.Payment payment, @NonNull @NonNull String requestId, @Nullable String securityCode, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
PaymentTransaction
cart
- the payment's owning cartpayment
- the payment to be authorizedrequestId
- the id representing the customer's request to confirm their paymentssecurityCode
- payment method security code that may be required to execute the
transactionPayment
& PaymentTransaction
which
represent the transaction resultscom.broadleafcommerce.paymentgateway.service.exception.PaymentException
- thrown if an error is encountered while executing the authorizationprotected boolean shouldConfirmPayment(com.broadleafcommerce.order.common.domain.Payment payment)
payment
- the payment to confirmprotected com.broadleafcommerce.cart.client.domain.Cart authorizePayment(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.Payment payment, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
PaymentTransaction
cart
- the payment's owning cartpayment
- the payment to be authorizedrequestId
- the id representing the customer's request to confirm their paymentsPayment
& PaymentTransaction
which
represent the transaction resultscom.broadleafcommerce.paymentgateway.service.exception.PaymentException
- thrown if an error is encountered while executing the authorizationprotected com.broadleafcommerce.cart.client.domain.Cart authorizePayment(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.Payment payment, @NonNull @NonNull String requestId, @Nullable String securityCode, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
PaymentTransaction
cart
- the payment's owning cartpayment
- the payment to be authorizedrequestId
- the id representing the customer's request to confirm their paymentssecurityCode
- payment method security code that may be required to execute the
transactionPayment
& PaymentTransaction
which
represent the transaction resultscom.broadleafcommerce.paymentgateway.service.exception.PaymentException
- thrown if an error is encountered while executing the authorizationprotected com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService identifyTransactionService(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Payment payment)
PaymentGatewayTransactionService
based on the payment's
Payment.getGatewayType()
payment
- the payment object that contains a reference to the required transaction
serviceprotected List<com.broadleafcommerce.order.common.domain.Payment> getConfirmedPayments(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
cart
- The cart whose checkout submission is being processedprotected List<com.broadleafcommerce.order.common.domain.PaymentTransaction> getTransactionsToRollback(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Payment confirmedPayment, @NonNull @NonNull String requestId)
confirmedPayment
- a confirmed payment that likely owns a transaction tied to this
checkout requestrequestId
- the unique identifier of this checkout attemptprotected com.broadleafcommerce.cart.client.domain.Cart rollbackSuccessfulAuthTransaction(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.Payment payment, @NonNull @NonNull com.broadleafcommerce.order.common.domain.PaymentTransaction parentTransaction, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
PaymentTransaction
.cart
- The cart whose checkout submission is being processedpayment
- The payment that was previously authorized as a part of this checkout
submissionparentTransaction
- The transaction that is being rolled backrequestId
- the unique identifier of this checkout attemptDefaultTransactionTypes.REVERSE_AUTH
PaymentTransaction
protected com.broadleafcommerce.paymentgateway.service.PaymentGatewayRollbackService identifyRollbackService(@NonNull @NonNull com.broadleafcommerce.order.common.domain.Payment payment)
PaymentGatewayRollbackService
based on the payment's
Payment.getGatewayType()
payment
- the payment object that contains a reference to the required transaction
rollback serviceprotected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayTransactionServiceProvider getTransactionServiceProvider()
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayConfigurationProvider getConfigurationProvider()
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayRollbackServiceProvider getRollbackServiceProvider()
protected PaymentTransactionService getPaymentTransactionService()
protected PaymentRequestService getPaymentRequestService()
protected CartPaymentStatusService getPaymentStatusService()
protected PaymentSummaryService getPaymentSummaryService()
protected CartProvider getCartProvider()
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
Copyright © 2021. All rights reserved.