Class CartPaymentMethodValidationActivity

    • Method Detail

      • execute

        public CheckoutProcessDto execute​(@NonNull
                                          @NonNull CheckoutProcessDto processDto,
                                          @NonNull
                                          @NonNull Map<String,​String> securityCodes,
                                          @Nullable
                                          com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: RequiresSecurePaymentInformationActivity
        Method responsible for executing some work against the cart that requires secure payment information in checkout.
        Specified by:
        execute in interface RequiresSecurePaymentInformationActivity
        Parameters:
        processDto - The CheckoutProcessDto that we're attempting to checkout with.
        securityCodes - Secure codes that are passed to the gateway for verification during authorization or capture transactions.
        contextInfo - Context information around sandbox and multitenant state.
        Returns:
        The final state of the CheckoutProcessDto following the execution of the activity.
      • isCollectOnDeliverySelected

        protected boolean isCollectOnDeliverySelected​(@NonNull
                                                      @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
        Determines if any of the Cart.getFulfillmentGroups() has a DefaultCollectOnDeliveryStatus.SELECTED status in their FulfillmentGroup.getAttributes().

        Any custom logic should be added here.

        Parameters:
        cart - the Cart being validated
        Returns:
        true if the Collect on Delivery is selected, otherwise false
      • validateCartHasActivePayment

        protected void validateCartHasActivePayment​(@NonNull
                                                    @NonNull CheckoutProcessDto processDto)
        Validate that the cart has at least one active payment.
        Parameters:
        processDto - the CheckoutProcessDto that we're attempting to checkout with
      • validatePaymentMethodAvailability

        protected void validatePaymentMethodAvailability​(@NonNull
                                                         @NonNull CheckoutProcessDto processDto,
                                                         @Nullable
                                                         com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Validate that the payments on the cart are available in the current context.
        Parameters:
        processDto - the CheckoutProcessDto that we're attempting to checkout with
      • getCheckoutPaymentMethodOptions

        protected List<CheckoutPaymentMethodOption> getCheckoutPaymentMethodOptions​(@NonNull
                                                                                    @NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
                                                                                    @Nullable
                                                                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • validatePaymentAmount

        protected void validatePaymentAmount​(@NonNull
                                             @NonNull CheckoutProcessDto processDto)
        Validate that each of the PaymentSummaries 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 cart item that is charged nothing up front and the actual bill amount is determined by usage at a later date).
        Parameters:
        processDto - the CheckoutProcessDto that we're attempting to checkout with
      • validateCollectOnDeliveryPaymentConfiguration

        protected void validateCollectOnDeliveryPaymentConfiguration​(@NonNull
                                                                     @NonNull CheckoutProcessDto processDto,
                                                                     @Nullable
                                                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Validate that COD payments are valid and correctly configured in the cart context.
        Parameters:
        processDto - the information (cart, payments, etc.) that we're attempting to checkout with
        contextInfo - context information related to multitenancy
      • isUsingCollectOnDelivery

        protected boolean isUsingCollectOnDelivery​(@Nullable
                                                   com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup)
      • validateCollectOnDeliveryFees

        protected void validateCollectOnDeliveryFees​(@NonNull
                                                     @NonNull CheckoutProcessDto processDto,
                                                     @NonNull
                                                     @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption,
                                                     @Nullable
                                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • validateCollectOnDeliveryMinAndMaxCartAmounts

        protected void validateCollectOnDeliveryMinAndMaxCartAmounts​(@NonNull
                                                                     @NonNull CheckoutProcessDto processDto,
                                                                     @NonNull
                                                                     @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption,
                                                                     @Nullable
                                                                     com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • validateCollectOnDeliveryFulfilmentInclusionsAndExclusions

        protected void validateCollectOnDeliveryFulfilmentInclusionsAndExclusions​(@NonNull
                                                                                  @NonNull CheckoutProcessDto processDto,
                                                                                  @NonNull
                                                                                  @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup codFulfillmentGroup,
                                                                                  @NonNull
                                                                                  @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption,
                                                                                  @Nullable
                                                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • doesFeeCartItemExist

        protected boolean doesFeeCartItemExist​(@NonNull
                                               CheckoutPaymentMethodOption.FeeDto fee,
                                               @NonNull
                                               @NonNull Map<String,​List<com.broadleafcommerce.cart.client.domain.CartItem>> existingFeesByName,
                                               @NonNull
                                               @NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
                                               @Nullable
                                               com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • isCartMaxTotalAllowedForCOD

        protected boolean isCartMaxTotalAllowedForCOD​(@NonNull
                                                      @NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
                                                      @NonNull
                                                      @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption,
                                                      @Nullable
                                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • isCartMinTotalAllowedForCOD

        protected boolean isCartMinTotalAllowedForCOD​(@NonNull
                                                      @NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
                                                      @NonNull
                                                      @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption,
                                                      @Nullable
                                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • doFulfillmentExclusionsPassForCOD

        protected boolean doFulfillmentExclusionsPassForCOD​(@NonNull
                                                            @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup,
                                                            @NonNull
                                                            @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption,
                                                            @Nullable
                                                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • doFulfillmentInclusionsPassForCOD

        protected boolean doFulfillmentInclusionsPassForCOD​(@NonNull
                                                            @NonNull com.broadleafcommerce.cart.client.domain.FulfillmentGroup fulfillmentGroup,
                                                            @NonNull
                                                            @NonNull CheckoutPaymentMethodOption codCheckoutPaymentMethodOption,
                                                            @Nullable
                                                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • hasCollectOnDeliveryPayments

        protected boolean hasCollectOnDeliveryPayments​(@NonNull
                                                       @NonNull List<PaymentSummary> paymentSummaries)
      • validatePaymentAmountSum

        protected void validatePaymentAmountSum​(@NonNull
                                                @NonNull CheckoutProcessDto processDto,
                                                @Nullable
                                                com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Validate that the sum of the PaymentSummary amounts is equal to the cart total (CartPricing.getTotal()).
        Parameters:
        processDto - the CheckoutProcessDto that we're attempting to checkout with
        contextInfo - context information around sandbox and multitenant state
      • validatePaymentTransactionAmountSums

        protected void validatePaymentTransactionAmountSums​(@NonNull
                                                            @NonNull CheckoutProcessDto processDto,
                                                            @Nullable
                                                            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.
        Parameters:
        processDto - the CheckoutProcessDto that we're attempting to checkout with
        contextInfo - context information around sandbox and multitenant state
      • hasValidAmountAuthorizedOrCaptured

        protected boolean hasValidAmountAuthorizedOrCaptured​(@NonNull
                                                             @NonNull javax.money.MonetaryAmount amountAuthorizedOrCapturedOrPending,
                                                             @NonNull
                                                             @NonNull PaymentSummary paymentSummary,
                                                             @Nullable
                                                             com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Validates that the amount authorized or captured fully covers the payment total amount.
        Parameters:
        amountAuthorizedOrCapturedOrPending - the amount authorized or captured or awaiting capture result
        paymentSummary - the payment summary
        contextInfo - context information around sandbox and multitenant state
        Returns:
        true if the amount authorized or captured fully covers the payment total amount, false otherwise
      • validateStoreCreditAccountBalanceIfNeeded

        protected void validateStoreCreditAccountBalanceIfNeeded​(@NonNull
                                                                 @NonNull CheckoutProcessDto processDto,
                                                                 @Nullable
                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Validates that the store credit account has sufficient funds if needed.
        Parameters:
        processDto - the CheckoutProcessDto that we're attempting to checkout with
        contextInfo - context information related to multitenancy
      • isExternalTransactionExpected

        protected boolean isExternalTransactionExpected​(@NonNull
                                                        @NonNull PaymentSummary paymentSummary,
                                                        @Nullable
                                                        com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Based on the provided PaymentGatewayType, determine if the expected transaction is external.
        Parameters:
        paymentSummary - the payment summary
        contextInfo - context information around sandbox and multitenant state
      • getCheckoutTransactionType

        protected String getCheckoutTransactionType​(@NonNull
                                                    @NonNull String gatewayType,
                                                    @Nullable
                                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Based on the provided PaymentGatewayType, determine which TransactionType should be used to execute the payment stage of the checkout.
        Parameters:
        gatewayType - The payment gateway's unique identifier that should be used to lookup the desired transaction type
        contextInfo - Context information around sandbox and multitenant state
        Returns:
        The desired transaction type for the gateway
        See Also:
        CartOperationCheckoutProperties.getCheckoutTransactionTypeByGateway(String, String, String)
      • getMessage

        protected String getMessage​(@NonNull
                                    @NonNull String errorMessage,
                                    @Nullable
                                    Object... args)
      • 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)
      • getMessageSource

        protected org.springframework.context.MessageSource getMessageSource()
      • setCheckoutPaymentMethodService

        @Autowired
        public void setCheckoutPaymentMethodService​(CheckoutPaymentMethodService checkoutPaymentMethodService)
      • setCreditAccountTransactionExecutionProvider

        @Autowired
        public void setCreditAccountTransactionExecutionProvider​(CreditAccountTransactionExecutionProvider creditAccountTransactionExecutionProvider)
      • getTypeFactory

        protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
      • setTypeFactory

        @Autowired
        public void setTypeFactory​(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
      • getSpelRuleEvaluationService

        protected com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationService getSpelRuleEvaluationService()
      • setSpelRuleEvaluationService

        @Autowired
        public void setSpelRuleEvaluationService​(com.broadleafcommerce.rulesengine.expression.service.SpelRuleEvaluationService spelRuleEvaluationService)