Class DefaultCartApprovalValidationService

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected String[] getCartApproverPermissions()
      Retrieves the permissions that a user should have to perform cart approver-specific actions, such as submitting cart or rejecting cart.
      protected String getMessage​(@NonNull String errorMessage, Object... args)  
      protected org.springframework.context.MessageSource getMessageSource()  
      protected com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils getPolicyUtils()  
      protected List<String> getValidRequestApprovalStatuses()
      Retrieve the list of statuses which are considered valid to request cart approval.
      protected List<String> getValidRequestRejectionStatuses()
      Retrieve the list of statuses which are considered valid to reject a cart.
      void setPolicyUtils​(com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils policyUtils)  
      protected void validateCartStatusForRejection​(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Validates that the cart is in a valid Cart.getStatus() for rejection
      protected void validateCartStatusForRequestApproval​(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
      Validates that the cart is in a valid Cart.getStatus() for requesting approval.
      void validateRequestForRejection​(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @NonNull CartApprovalProcessRequest cartApprovalProcessRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Method that calls all validators performing checks on conditions necessary for a cart to be rejected.
      void validateSubmitForApproval​(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer, @NonNull CartApprovalProcessRequest cartApprovalProcessRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Method that calls all validators performing checks on conditions necessary for a cart to be submitted for approval.
      void validateUserIsCartReviewer​(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Validates that the user has the correct access to reject or submit the given Cart.
    • Constructor Detail

      • DefaultCartApprovalValidationService

        public DefaultCartApprovalValidationService​(org.springframework.context.MessageSource messageSource)
    • Method Detail

      • validateSubmitForApproval

        public void validateSubmitForApproval​(@NonNull
                                              @NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
                                              @NonNull
                                              @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer,
                                              @NonNull
                                              @NonNull CartApprovalProcessRequest cartApprovalProcessRequest,
                                              @Nullable
                                              com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CartApprovalValidationService
        Method that calls all validators performing checks on conditions necessary for a cart to be submitted for approval.
        Specified by:
        validateSubmitForApproval in interface CartApprovalValidationService
        Parameters:
        cart - The Cart that is being submitted for approval.
        customer - The CustomerRef of the user who is submitting the cart for approval.
        cartApprovalProcessRequest - the CartApprovalProcessRequest passed in by CartApprovalService
        contextInfo - context information around sandbox and multitenant state.
      • validateRequestForRejection

        public void validateRequestForRejection​(@NonNull
                                                @NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
                                                @NonNull
                                                @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customer,
                                                @NonNull
                                                @NonNull CartApprovalProcessRequest cartApprovalProcessRequest,
                                                @Nullable
                                                com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CartApprovalValidationService
        Method that calls all validators performing checks on conditions necessary for a cart to be rejected.
        Specified by:
        validateRequestForRejection in interface CartApprovalValidationService
        Parameters:
        cart - The Cart that is rejected.
        customer - The CustomerRef of the user who is rejecting the cart.
        cartApprovalProcessRequest - the CartApprovalProcessRequest passed in by CartApprovalService
        contextInfo - context information around sandbox and multitenant state
      • validateUserIsCartReviewer

        public void validateUserIsCartReviewer​(@NonNull
                                               @NonNull com.broadleafcommerce.cart.client.domain.Cart cart,
                                               @Nullable
                                               com.broadleafcommerce.order.common.domain.CustomerRef customerRef,
                                               @Nullable
                                               com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CartApprovalValidationService
        Validates that the user has the correct access to reject or submit the given Cart.
        Specified by:
        validateUserIsCartReviewer in interface CartApprovalValidationService
        Parameters:
        cart - the Cart that the user is attempting to access
        customerRef - the CustomerRef representing the user to validate against
        contextInfo - context information around sandbox and multitenant state
      • validateCartStatusForRequestApproval

        protected void validateCartStatusForRequestApproval​(@NonNull
                                                            @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
        Validates that the cart is in a valid Cart.getStatus() for requesting approval.
        Parameters:
        cart - The Cart that's being submitted for approval.
        Throws:
        CartApprovalValidationException - if the cart status is not valid to request approval.
      • validateCartStatusForRejection

        protected void validateCartStatusForRejection​(@NonNull
                                                      @NonNull com.broadleafcommerce.cart.client.domain.Cart cart)
        Validates that the cart is in a valid Cart.getStatus() for rejection
        Parameters:
        cart - The Cart that's being rejected
        Throws:
        CartApprovalValidationException - if the cart status is not valid to request approval.
      • getValidRequestApprovalStatuses

        protected List<String> getValidRequestApprovalStatuses()
        Retrieve the list of statuses which are considered valid to request cart approval.

        Custom valid statuses to request cart for approval should be added here.

        Returns:
        the list of statuses which are considered valid to request cart approval
      • getValidRequestRejectionStatuses

        protected List<String> getValidRequestRejectionStatuses()
        Retrieve the list of statuses which are considered valid to reject a cart.

        Custom valid statuses to reject a cart should be added here.

        Returns:
        the list of statuses which are considered valid to reject a cart
      • getCartApproverPermissions

        protected String[] getCartApproverPermissions()
        Retrieves the permissions that a user should have to perform cart approver-specific actions, such as submitting cart or rejecting cart.

        Custom cart approver permissions should be added here.

        Returns:
        the permissions that a user should have to perform cart approver-specific actions
      • getMessage

        protected String getMessage​(@NonNull
                                    @NonNull String errorMessage,
                                    @Nullable
                                    Object... args)
      • getMessageSource

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

        @Nullable
        protected com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils getPolicyUtils()
      • setPolicyUtils

        @Autowired(required=false)
        public void setPolicyUtils​(@Nullable
                                   com.broadleafcommerce.data.tracking.core.policy.trackable.TrackablePolicyUtils policyUtils)