public class CartPaymentMethodValidationActivity extends Object implements CheckoutWorkflowActivity
CheckoutWorkflowActivity
is responsible for validating that the cart includes active
Payments
whose sum is equal to CartPricing.getTotal()
. Additionally, this
activity is responsible for verifying that the PaymentGatewayType
is specified by the
payment (via Payment.getGatewayType()
) to ensure that it can be authorized/captured.Constructor and Description |
---|
CartPaymentMethodValidationActivity(CartPaymentStatusService paymentStatusService,
PaymentSummaryService paymentSummaryService,
com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayConfigurationProvider configurationProvider,
org.springframework.context.MessageSource messageSource) |
Modifier and Type | Method and Description |
---|---|
protected Predicate<com.broadleafcommerce.order.common.domain.PaymentTransaction> |
buildIsNotReversedAuthorizePredicate(com.broadleafcommerce.order.common.domain.Payment payment)
Deprecated.
this method is no longer used
|
protected Predicate<com.broadleafcommerce.order.common.domain.PaymentTransaction> |
buildIsNotReversedCapturePredicate(com.broadleafcommerce.order.common.domain.Payment payment)
Deprecated.
this method is no longer used
|
com.broadleafcommerce.cart.client.domain.Cart |
execute(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method responsible for executing some work against the cart that is required for checkout.
|
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 javax.money.CurrencyUnit |
getCurrencyUnit(com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
protected String |
getMessage(@NonNull String errorMessage,
Object... args) |
protected org.springframework.context.MessageSource |
getMessageSource() |
protected CartPaymentStatusService |
getPaymentStatusService() |
protected PaymentSummaryService |
getPaymentSummaryService() |
protected javax.money.MonetaryAmount |
getZeroAmount(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) |
protected javax.money.MonetaryAmount |
getZeroAmount(@NonNull javax.money.CurrencyUnit currencyUnit) |
com.broadleafcommerce.cart.client.domain.Cart |
rollback(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
@NonNull String requestId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Method responsible for rolling back any work that was done during the execution of the
#execute(Cart, String) method. |
protected void |
validateCartHasActivePayment(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Validate that the cart has at least one active payment
|
protected void |
validatePaymentAmount(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Validate that each of the cart's active
Payments are responsible for a zero
or greater amount. |
protected void |
validatePaymentAmountSum(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Validate that the sum of the cart's active
Payments is equal to the cart
total (CartPricing.getTotal() ) |
protected void |
validatePaymentTransactionAmountSums(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Validates that the sum of authorized/captured amount of the successful transactions equal to
the payment amount.
|
public CartPaymentMethodValidationActivity(CartPaymentStatusService paymentStatusService, PaymentSummaryService paymentSummaryService, com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayConfigurationProvider configurationProvider, org.springframework.context.MessageSource messageSource)
public com.broadleafcommerce.cart.client.domain.Cart execute(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CheckoutWorkflowActivity
execute
in interface CheckoutWorkflowActivity
cart
- The Cart
that we're attempting to checkout with.requestId
- The id used to identify changes tied to the specific execution requestcontextInfo
- Context information around sandbox and multitenant state.public com.broadleafcommerce.cart.client.domain.Cart rollback(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull String requestId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
CheckoutWorkflowActivity
#execute(Cart, String)
method.rollback
in interface CheckoutWorkflowActivity
cart
- The Cart
that we were attempting to checkout with, but ran into an
exception/error.requestId
- The id used to identify changes tied to the specific execution requestcontextInfo
- Context information around sandbox and multitenant state.protected void validateCartHasActivePayment(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
cart
- protected void validatePaymentAmount(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
Payments
are responsible for a zero
or greater amount. In some cases, a zero amount may be useful to signify a tokenized payment
to be used in future billing (e.g. a free trial offer that allows an order to be placed with
zero up front and billed the full amount after the trial expires or a "post-paid" plan
product that is charged nothing up front and the actual bill amount is determined by usage at
a later date).cart
- protected void validatePaymentAmountSum(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Payments
is equal to the cart
total (CartPricing.getTotal()
)cart
- protected void validatePaymentTransactionAmountSums(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
cart
- The Cart
with the payments to validatecontextInfo
- Context information around sandbox and multitenant stateprotected 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()
@Deprecated protected Predicate<com.broadleafcommerce.order.common.domain.PaymentTransaction> buildIsNotReversedCapturePredicate(com.broadleafcommerce.order.common.domain.Payment payment)
@Deprecated protected Predicate<com.broadleafcommerce.order.common.domain.PaymentTransaction> buildIsNotReversedAuthorizePredicate(com.broadleafcommerce.order.common.domain.Payment payment)
protected javax.money.MonetaryAmount getZeroAmount(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
@NonNull protected javax.money.CurrencyUnit getCurrencyUnit(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
@NonNull protected javax.money.MonetaryAmount getZeroAmount(@NonNull @NonNull javax.money.CurrencyUnit currencyUnit)
protected String getMessage(@NonNull @NonNull String errorMessage, @Nullable Object... args)
protected CartPaymentStatusService getPaymentStatusService()
protected PaymentSummaryService getPaymentSummaryService()
protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayConfigurationProvider getConfigurationProvider()
protected org.springframework.context.MessageSource getMessageSource()
Copyright © 2021. All rights reserved.