Class DefaultCheckoutPaymentMethodService
java.lang.Object
com.broadleafcommerce.cartoperation.service.payment.DefaultCheckoutPaymentMethodService
- All Implemented Interfaces:
CheckoutPaymentMethodService
public class DefaultCheckoutPaymentMethodService
extends Object
implements CheckoutPaymentMethodService
- Author:
- Marie Standeven (mariestandeven)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCheckoutPaymentMethodService(CartOperationCheckoutProperties cartOperationCheckoutProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancartHasSubscriptionItems(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Checks if the cart contains subscription items.protected booleandoFulfillmentExclusionsPassForPayment(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption) protected booleandoFulfillmentInclusionsPassForPayment(@NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption) protected List<CheckoutPaymentMethodOption>filterAvailableCheckoutPaymentMethodOptionsByCart(@NonNull List<CheckoutPaymentMethodOption> checkoutPaymentMethodOptions, @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hook point to filter available checkout payment method options by the cart details.protected List<CheckoutPaymentMethodOption>filterAvailableCheckoutPaymentMethodOptionsByCustomer(@NonNull List<CheckoutPaymentMethodOption> checkoutPaymentMethodOptions, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hook point to filter available checkout payment method options by the customer details.protected StringgetApplicationIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtilsprotected CartOperationCheckoutPropertiesprotected CartSubscriptionUtilsgetCheckoutPaymentExpectations(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Get the consolidated checkout payment expectations (requirements) and available options.getCheckoutPaymentMethodOptions(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.CustomerRef customer, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the available checkout payment method options for the given cart, customer, and context.protected PaymentProvider<PaymentSummary>protected com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationServiceprotected StringgetTenantIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected booleanisCartMaxTotalAllowedForPayment(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull CheckoutPaymentMethodOption option) protected booleanisCartMinTotalAllowedForPayment(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull CheckoutPaymentMethodOption option) protected booleanisPaymentMethodOptionAvailableForFulfillmentGroups(@NonNull CheckoutPaymentMethodOption option, @NonNull List<com.broadleafcommerce.cart.client.domain.FulfillmentGroup> fulfillmentGroups) Checks that the option is available at least for one of the fulfillment groups.booleanisPaymentRequired(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Check if an active payment is required to submit checkout for the cart.booleanisSavedPaymentMethodRequired(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Check if a saved payment method is required to submit checkout for the cart.protected booleanisSavedPaymentMethodRequiredForSubscriptionCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Checks if a saved payment method is required for subscription carts.protected org.springframework.data.domain.Page<SavedPaymentMethodSummary>readCustomerActivePaymentMethods(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the active saved payment methods for the customer of the given cart.voidsetAuthenticationUtils(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils) voidsetCartSubscriptionUtils(CartSubscriptionUtils cartSubscriptionUtils) voidsetPaymentProvider(PaymentProvider<PaymentSummary> paymentProvider) voidsetSpelRuleEvaluationService(com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationService spelRuleEvaluationService)
-
Constructor Details
-
DefaultCheckoutPaymentMethodService
public DefaultCheckoutPaymentMethodService(CartOperationCheckoutProperties cartOperationCheckoutProperties)
-
-
Method Details
-
getCheckoutPaymentMethodOptions
public List<CheckoutPaymentMethodOption> getCheckoutPaymentMethodOptions(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CheckoutPaymentMethodServiceFind the available checkout payment method options for the given cart, customer, and context.- Specified by:
getCheckoutPaymentMethodOptionsin interfaceCheckoutPaymentMethodService- Parameters:
cart- the current cart in checkoutcustomer- a reference to the current customer in checkoutcontextInfo- context information around sandbox and multitenant state- Returns:
- a list of payment method options available in the current checkout context
-
getCheckoutPaymentExpectations
public CheckoutPaymentExpectations getCheckoutPaymentExpectations(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customer, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CheckoutPaymentMethodServiceGet the consolidated checkout payment expectations (requirements) and available options.- Specified by:
getCheckoutPaymentExpectationsin interfaceCheckoutPaymentMethodService- Parameters:
cart- the current cart in checkoutcustomer- a reference to the current customer in checkoutcontextInfo- context information around sandbox and multitenant state- Returns:
- checkout payment expectations and options
-
isPaymentRequired
public boolean isPaymentRequired(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CheckoutPaymentMethodServiceCheck if an active payment is required to submit checkout for the cart.- Specified by:
isPaymentRequiredin interfaceCheckoutPaymentMethodService- Parameters:
cart- the current cart in checkoutcontextInfo- context information around sandbox and multitenant state- Returns:
- true if a payment is required, false otherwise
-
isSavedPaymentMethodRequired
public boolean isSavedPaymentMethodRequired(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CheckoutPaymentMethodServiceCheck if a saved payment method is required to submit checkout for the cart.- Specified by:
isSavedPaymentMethodRequiredin interfaceCheckoutPaymentMethodService- Parameters:
cart- the current cart in checkoutcontextInfo- context information around sandbox and multitenant state- Returns:
- true if a saved payment method is required, false otherwise
-
cartHasSubscriptionItems
protected boolean cartHasSubscriptionItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Checks if the cart contains subscription items.- Parameters:
cart- the current cartcontextInfo- context information around sandbox and multitenant state- Returns:
- true if the cart has subscription items, false otherwise
- Since:
- Cart Operation Service 3.0.0, Release Train 3.0.0
-
isSavedPaymentMethodRequiredForSubscriptionCart
protected boolean isSavedPaymentMethodRequiredForSubscriptionCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Checks if a saved payment method is required for subscription carts.- Parameters:
cart- the current cartcontextInfo- context information around sandbox and multitenant state- Returns:
- true if a saved payment method is required, false otherwise
- Since:
- Cart Operation Service 3.0.0, Release Train 3.0.0
-
readCustomerActivePaymentMethods
protected org.springframework.data.domain.Page<SavedPaymentMethodSummary> readCustomerActivePaymentMethods(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Reads the active saved payment methods for the customer of the given cart.- Parameters:
cart- the current cartcontextInfo- context information around sandbox and multitenant state- Returns:
- a page of active saved payment method summaries
- Since:
- Cart Operation Service 3.0.0, Release Train 3.0.0
-
filterAvailableCheckoutPaymentMethodOptionsByCustomer
protected List<CheckoutPaymentMethodOption> filterAvailableCheckoutPaymentMethodOptionsByCustomer(@NonNull @NonNull List<CheckoutPaymentMethodOption> checkoutPaymentMethodOptions, @Nullable com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hook point to filter available checkout payment method options by the customer details.- Parameters:
checkoutPaymentMethodOptions- the list of available checkout payment method optionscustomerRef- a reference to the current customer in checkoutcontextInfo- context information around sandbox and multitenant state- Returns:
- the updated list of available payment methods
-
filterAvailableCheckoutPaymentMethodOptionsByCart
protected List<CheckoutPaymentMethodOption> filterAvailableCheckoutPaymentMethodOptionsByCart(@NonNull @NonNull List<CheckoutPaymentMethodOption> checkoutPaymentMethodOptions, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hook point to filter available checkout payment method options by the cart details.- Parameters:
checkoutPaymentMethodOptions- the list of available checkout payment method optionscart- the current cart in checkoutcontextInfo- context information around sandbox and multitenant state- Returns:
- the updated list of available payment methods
-
isPaymentMethodOptionAvailableForFulfillmentGroups
protected boolean isPaymentMethodOptionAvailableForFulfillmentGroups(@NonNull @NonNull CheckoutPaymentMethodOption option, @NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.FulfillmentGroup> fulfillmentGroups) Checks that the option is available at least for one of the fulfillment groups.- Parameters:
option- the payment method option to validatefulfillmentGroups- the cart fulfillment groups- Returns:
- true if fulfillment groups is empty or the option is available for one of the group
-
doFulfillmentExclusionsPassForPayment
protected boolean doFulfillmentExclusionsPassForPayment(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption) -
doFulfillmentInclusionsPassForPayment
protected boolean doFulfillmentInclusionsPassForPayment(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup, @NonNull @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption) -
isCartMaxTotalAllowedForPayment
protected boolean isCartMaxTotalAllowedForPayment(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull CheckoutPaymentMethodOption option) -
isCartMinTotalAllowedForPayment
protected boolean isCartMinTotalAllowedForPayment(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull CheckoutPaymentMethodOption option) -
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) -
getCartOperationCheckoutProperties
-
getSpelRuleEvaluationService
protected com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationService getSpelRuleEvaluationService() -
setSpelRuleEvaluationService
@Autowired public void setSpelRuleEvaluationService(com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationService spelRuleEvaluationService) -
getPaymentProvider
-
setPaymentProvider
-
getCartSubscriptionUtils
-
setCartSubscriptionUtils
-
getAuthenticationUtils
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils() -
setAuthenticationUtils
@Autowired public void setAuthenticationUtils(com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils)
-