Class BankIdentityServiceImpl

java.lang.Object
api.mpba.rastvdmy.service.generator.FinancialDataGenerator
api.mpba.rastvdmy.service.impl.BankIdentityServiceImpl
All Implemented Interfaces:
BankIdentityService

@Service public class BankIdentityServiceImpl extends FinancialDataGenerator implements BankIdentityService
Service implementation for managing bank identities, including retrieval, addition, and deletion of bank identities connected to a user's profile.
  • Constructor Details

    • BankIdentityServiceImpl

      @Autowired public BankIdentityServiceImpl(BankIdentityRepository identityRepository, UserProfileRepository userProfileRepository, JwtService jwtService, BankAccountService accountService)
      Constructs a new instance of BankIdentityServiceImpl.
      Parameters:
      identityRepository - the repository for bank identity operations
      userProfileRepository - the repository for user profile operations
      jwtService - the service for handling JWT operations
      accountService - the service for managing bank accounts
  • Method Details

    • getBanks

      @Cacheable("bankIdentity") public List<BankIdentity> getBanks(jakarta.servlet.http.HttpServletRequest request)
      Retrieves a list of bank identities associated with the user identified by the request.
      Specified by:
      getBanks in interface BankIdentityService
      Parameters:
      request - the HTTP request containing user information
      Returns:
      a list of bank identities
      Throws:
      ApplicationException - if the user is blocked or if no bank identities are found
    • getBankByName

      @Cacheable(value="bankIdentity", key="#request.userPrincipal.name + \'-\' + #name") public BankIdentity getBankByName(jakarta.servlet.http.HttpServletRequest request, String name)
      Retrieves a specific bank identity by name for the user identified by the request.
      Specified by:
      getBankByName in interface BankIdentityService
      Parameters:
      request - the HTTP request containing user information
      name - the name of the bank
      Returns:
      the bank identity
      Throws:
      ApplicationException - if the user is blocked or if the bank identity is not found
    • addBank

      @Transactional public BankIdentity addBank(jakarta.servlet.http.HttpServletRequest request, BankIdentityRequest identityRequest) throws Exception
      Adds a new bank identity for the user.
      Specified by:
      addBank in interface BankIdentityService
      Parameters:
      request - the HTTP request containing user information
      identityRequest - the bank identity request containing necessary information
      Returns:
      the created bank identity
      Throws:
      Exception - if the user is blocked, if the bank name is empty, or if an error occurs during account connection
    • deleteBank

      @CacheEvict(value="bankIdentity", key="#request.userPrincipal.name + \'-\' + #bankName") public void deleteBank(jakarta.servlet.http.HttpServletRequest request, String bankName)
      Deletes a bank identity associated with the user.
      Specified by:
      deleteBank in interface BankIdentityService
      Parameters:
      request - the HTTP request containing user information
      bankName - the name of the bank to delete
      Throws:
      ApplicationException - if the user is blocked, if the bank identity is not found, or if there are connected bank accounts