Interface B2BApproverService<T>

  • Type Parameters:
    T - the principal (customer)
    All Known Implementing Classes:
    DefaultB2BApproverService

    public interface B2BApproverService<T>
    The Interface B2BApproverService. Service is responsible for fetching approvers related to a B2BCustomer.
    Spring Bean ID:
    b2bApproverService
    • Method Detail

      • getAllApprovers

        java.util.List<T> getAllApprovers​(T principal)
        Gets the approvers assigned to principal(customer) directly or as approver groups including its parent unit and all the units assigned to its parent up to the root unit.
        Parameters:
        principal - the principal (customer)
        Returns:
        A collection of approvers
      • getAccountManagerApprovers

        java.util.List<UserModel> getAccountManagerApprovers​(PrincipalModel principal)
        Gets the list of account manager approvers.
        Parameters:
        principal - the principal
        Returns:
        the approvers
      • getAllActiveApprovers

        java.util.List<T> getAllActiveApprovers​(B2BCustomerModel principal)
        Gets all the active approvers for a given customer
        Parameters:
        principal -
        Returns:
        list of approvers
      • addApproverToCustomer

        B2BCustomerModel addApproverToCustomer​(java.lang.String user,
                                               java.lang.String approver)
        Add an approver for a given user and return the updated B2BCustomerModel object updated with approver details
        Parameters:
        user - A unique identifier for B2BCustomerModel representing a user
        approver - A unique identifier for B2BCustomerModel representing a approver
        Returns:
        Updated B2BCustomerModel object updated with approvers
      • removeApproverFromCustomer

        B2BCustomerModel removeApproverFromCustomer​(java.lang.String user,
                                                    java.lang.String approver)
        Remove an approver for a given user and return the updated B2BCustomerModel object updated with approver details
        Parameters:
        user - A unique identifier for B2BCustomerModel representing a user
        approver - A unique identifier for B2BCustomerModel representing a approver
        Returns:
        Updated B2BCustomerModel object removed with approver
      • addApproverToUnit

        B2BCustomerModel addApproverToUnit​(java.lang.String unitId,
                                           java.lang.String approverId)
        Add approver to given unit
        Parameters:
        unitId - A unique identifier for B2BUnitModel
        approverId - A unique identifier for B2BCustomerModel who is a approver
        Returns:
        Updated B2BCustomerModel object after adding approver to customer.
      • removeApproverFromUnit

        B2BCustomerModel removeApproverFromUnit​(java.lang.String unitUid,
                                                java.lang.String approverUid)
        If an approver is a member of the B2BUnit remove b2bapprovergroup role, if the approver is a member of the current branch of units the approver will be removed from B2BUnitModel.getApprovers() relationship
        Parameters:
        unitUid - A unique identifier of B2BUnitModel
        approverUid - A unique identifier of B2BCustomerModel
        Returns:
        An approver who was removed from a B2BUnitModel.getApprovers()