Class CoreBackofficeClientAdapter

java.lang.Object
es.kukenan.smartfi.microservice.contracts.service.backoffice.core.CoreBackofficeClientAdapter
All Implemented Interfaces:
BackofficeClient, ExtendedBackofficeClient

@Component public class CoreBackofficeClientAdapter extends Object implements ExtendedBackofficeClient
Core client to ExtendedBackofficeClient adapter.
  • Field Details

    • coreClient

      @Autowired private CoreClient coreClient
      Core client.
    • productsSearchPostProcessRunner

      @Autowired private ProductsSearchPostProcessRunner productsSearchPostProcessRunner
      Products query post-process runner.
    • cardsCoreApiClient

      @Autowired private CardsCoreApiClient cardsCoreApiClient
      cards CoreApi Client.
    • cashFlowCoreApiClient

      @Autowired private CashFlowCoreApiClient cashFlowCoreApiClient
      cashflow CoreApi Client.
    • contractCoreApiClient

      @Autowired private ContractCoreApiClient contractCoreApiClient
      contract CoreApi Client.
    • backofficeApiClient

      @Autowired private BackofficeApiClient backofficeApiClient
      Backoffice api Client.
    • accountBankCoreApiClient

      @Autowired private AccountBankCoreApiClient accountBankCoreApiClient
      Account bank CoreApi Client.
    • bankCoreApiClient

      @Autowired private BankCoreApiClient bankCoreApiClient
      Bank CoreApi Client.
    • companyCoreApiClient

      @Autowired private CompanyCoreApiClient companyCoreApiClient
      Company CoreApi Client.
    • requestContextManager

      @Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManager
      Request context manager.
    • threadPoolTaskExecutor

      @Autowired private org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor threadPoolTaskExecutor
      ThreadPoolTaskExecutor.
  • Constructor Details

    • CoreBackofficeClientAdapter

      public CoreBackofficeClientAdapter()
  • Method Details

    • getBackOfficeId

      public Integer getBackOfficeId()
      Description copied from interface: BackofficeClient
      The back office internal identifier.
      Specified by:
      getBackOfficeId in interface BackofficeClient
      Returns:
      back office internal identifier.
    • findProducts

      @Async public Future<List<ProductDomain>> findProducts(UserBackoffice userBackoffice, List<String> subsystems)
      Description copied from interface: BackofficeClient
      Extract the user product list from the given back office (must be supported, see wants method). This method should be annotated with @Asyng to allow concurrent data querying.
      Specified by:
      findProducts in interface BackofficeClient
      Parameters:
      userBackoffice - the user back office to extract products from.
      subsystems - subsystems from which the products are to retrieved. Set it to null to retrieve all API products.
      Returns:
      the user product list from the given extract products.
    • findProducts

      @Async("threadPoolTaskExecutor") public Future<List<ProductDomain>> findProducts(UserBackoffice userBackoffice, List<String> subsystems, ProductSearchFilter productSearchFilter, String userToken, String userIp)
      Description copied from interface: BackofficeClient
      Extract the user product list from the given back office (must be supported, see wants method). This method should be annotated with @Asyng to allow concurrent data querying.
      Specified by:
      findProducts in interface BackofficeClient
      Parameters:
      userBackoffice - the user back office to extract products from.
      subsystems - subsystems from which the products are to retrieved. Set it to null to retrieve all API products.
      productSearchFilter - the criteria to filter the products.
      userToken - user bearer.
      userIp - user Ip.
      Returns:
      the user product list from the given extract products.
    • createWalletProduct

      public List<ProductDomain> createWalletProduct(String userId, String userToken)
      Description copied from interface: BackofficeClient
      Extract the given user product details from the given (registered) product (must be supported, see wants method).
      Specified by:
      createWalletProduct in interface BackofficeClient
      Parameters:
      userId - user identifier.
      userToken - user bearer.
      Returns:
      the user product details extracted from the backoffice.
    • createCardProduct

      public List<ProductDomain> createCardProduct(String userId, String userToken)
      Description copied from interface: BackofficeClient
      Extract the given user product details from the given (registered) product (must be supported, see wants method).
      Specified by:
      createCardProduct in interface BackofficeClient
      Parameters:
      userId - user identifier.
      userToken - user bearer.
      Returns:
      the user product details extracted from the backoffice.
    • findProduct

      public ProductDetailDomain<? extends es.kukenan.smartfi.microservice.contracts.api.products.ProductDto> findProduct(ProductSearchRequest searchRequest, String userToken)
      Description copied from interface: BackofficeClient
      Extract the given user product details from the given (registered) product (must be supported, see wants method).
      Specified by:
      findProduct in interface BackofficeClient
      Parameters:
      searchRequest - the required data to find a product and build a full ProductDetailDomain.
      userToken - user bearer.
      Returns:
      the user product details extracted from the backoffice.
    • findWithheldMovements

      public List<es.kukenan.smartfi.microservice.contracts.api.movement.MovementDto> findWithheldMovements(ProductSearchRequest productSearchRequest, String userToken)
      Description copied from interface: BackofficeClient
      Extract the given user product id will search all the account withheld movements.
      Specified by:
      findWithheldMovements in interface BackofficeClient
      Parameters:
      productSearchRequest - searchRequest.
      userToken - userToken.
      Returns:
      user withholding movement list.
    • findDepositImpositions

      public ImpositionDomain findDepositImpositions(ProductSearchRequest productSearchRequest, String token)
      Extract the given user product id will search all the product impositions.
      Specified by:
      findDepositImpositions in interface BackofficeClient
      Parameters:
      productSearchRequest - the product search request.
      token - token.
      Returns:
      the user product impositions extracted.
    • findRepayments

      public es.kukenan.smartfi.microservice.contracts.api.repayment.LoanRepaymentsResponseDto findRepayments(ProductSearchRequest searchRequest, String userToken, String dateFrom, String dateTo)
      Description copied from interface: ExtendedBackofficeClient
      Get the repayments of the given product.
      Specified by:
      findRepayments in interface ExtendedBackofficeClient
      Parameters:
      searchRequest - product search data.
      userToken - userToken.
      dateFrom - dateFrom.
      dateTo - dateTo.
      Returns:
      product repayments.
    • findMovements

      public MovementDomain findMovements(ProductSearchRequest searchRequest, String userToken, String dateFrom, String dateTo, String type, String paginationKey, String number, String state, String reason, Boolean allMovements)
      Extract the given user product id will search all the account movements.
      Specified by:
      findMovements in interface BackofficeClient
      Parameters:
      searchRequest - the product search request.
      userToken - user bearer.
      dateFrom - params searching.
      dateTo - params searching.
      type - params searching.
      paginationKey - params searching.
      number - imposition number.
      state - imposition state.
      reason - reason.
      allMovements - all movements.
      Returns:
      the user product details extracted from the backoffice.
    • findMovement

      public es.kukenan.smartfi.microservice.contracts.api.movement.MovementDto findMovement(Product product, String movementId, String userToken)
      Extract the given movement id will search detail movement.
      Specified by:
      findMovement in interface BackofficeClient
      Parameters:
      product - the (registered) product.
      movementId - params movementId.
      userToken - bearer.
      Returns:
      the user movement detail extracted from the backoffice.
    • collectApiClients

      private List<AbstractCoreApiClient> collectApiClients(List<String> subsystems)
      Collect the API clients for the given subsystems or all API clients if the argument is null.
      Parameters:
      subsystems - subsystems which API client are to be retrieved. Set it to null to retrieve all API clients.
      Returns:
      the API clients for the given subsystems or all API clients if the argument is null.
    • findReceipts

      public ReceiptsDomain findReceipts(ProductSearchRequest searchRequest, String paginationKey, String token)
      Description copied from interface: ExtendedBackofficeClient
      Get the receipts for a given product.
      Specified by:
      findReceipts in interface ExtendedBackofficeClient
      Parameters:
      searchRequest - product search data.
      paginationKey - pagination Key.
      token - token
      Returns:
      product receipts.
    • findProductAssets

      public List<es.kukenan.smartfi.microservice.contracts.api.assets.AssetDto> findProductAssets(ProductSearchRequest searchRequest)
      Description copied from interface: ExtendedBackofficeClient
      Find the assets of the given product.
      Specified by:
      findProductAssets in interface ExtendedBackofficeClient
      Parameters:
      searchRequest - the (registered) product.
      Returns:
      the user product assets extracted from the backoffice.
    • findProductAssetDetail

      public es.kukenan.smartfi.microservice.contracts.api.assets.AssetDto findProductAssetDetail(ProductSearchRequest searchRequest, String assetId)
      Description copied from interface: ExtendedBackofficeClient
      Find a single of the given product by the given asset identifier.
      Specified by:
      findProductAssetDetail in interface ExtendedBackofficeClient
      Parameters:
      searchRequest - the (registered) product.
      assetId - the asset identifier..
      Returns:
      the user product assets detail extracted from the backoffice.
    • findProductAssetMovements

      public MovementDomain findProductAssetMovements(ProductSearchRequest searchRequest, String assetId, String dateFrom, String dateTo, String paginationKey)
      Description copied from interface: ExtendedBackofficeClient
      Find the movements of the given asset in the given product.
      Specified by:
      findProductAssetMovements in interface ExtendedBackofficeClient
      Parameters:
      searchRequest - the (registered) product.
      assetId - the asset identifier.
      dateFrom - params searching.
      dateTo - params searching.
      paginationKey - pagination key used to request next result page.
      Returns:
      the user product assets movements extracted from the backoffice.
    • findProductPosition

      public ProductDetailDomain<? extends es.kukenan.smartfi.microservice.contracts.api.products.ProductDto> findProductPosition(ProductSearchRequest searchRequest, String userToken)
      Description copied from interface: ExtendedBackofficeClient
      Extract the given user product details from the given (registered) product (must be supported, see wants method).
      Specified by:
      findProductPosition in interface ExtendedBackofficeClient
      Parameters:
      searchRequest - the required data to find a product and build a full ProductDetailDomain.
      userToken - userToken.
      Returns:
      the user product details extracted from the backoffice.
    • findProductComposition

      public List<es.kukenan.smartfi.microservice.contracts.api.products.ProductDto> findProductComposition(ProductSearchRequest searchRequest, String userToken)
      Description copied from interface: ExtendedBackofficeClient
      Extract the given user product composition from the given (registered) product (must be supported, see wants method).
      Specified by:
      findProductComposition in interface ExtendedBackofficeClient
      Parameters:
      searchRequest - the required data to find a product.
      userToken - user bearer token.
      Returns:
      the user product composition extracted from the backoffice.
    • findCashFlow

      public List<es.kukenan.smartfi.microservice.contracts.api.cashflow.CashFlowDto> findCashFlow(UserBackoffice userBackoffice, String contractId, String userToken)
      Description copied from interface: ExtendedBackofficeClient
      Extract the user cashflow list from the given back office.
      Specified by:
      findCashFlow in interface ExtendedBackofficeClient
      Parameters:
      userBackoffice - the user back office.
      contractId - contract identifier.
      userToken - user bearer.
      Returns:
      the cashflow information for userbackoffice.
    • generatePinOperationId

      public int generatePinOperationId(String userId, String bankCode, String panToken, es.kukenan.smartfi.common.security.WalletAuthentication auth)
      Description copied from interface: ExtendedBackofficeClient
      Generate PIN Operation Id.
      Specified by:
      generatePinOperationId in interface ExtendedBackofficeClient
      Parameters:
      userId - userId.
      bankCode - codigoEntidad.
      panToken - panToken.
      auth - auth.
      Returns:
      operation ID.
    • generateCvvOperationId

      public int generateCvvOperationId(String userId, String bankCode, String panToken, es.kukenan.smartfi.common.security.WalletAuthentication auth)
      Description copied from interface: ExtendedBackofficeClient
      Generate CVV Operation Id.
      Specified by:
      generateCvvOperationId in interface ExtendedBackofficeClient
      Parameters:
      userId - userId.
      bankCode - bank code.
      panToken - panToken.
      auth - auth.
      Returns:
      operation ID.
    • findContract

      public es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract> findContract(String idUserBackoffice, String userToken, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.GetApplicationsRequestDto getApplicationsRequestDto)
      Description copied from interface: BackofficeClient
      Get be contract from user backoffice.
      Specified by:
      findContract in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer token.
      pageNumber - number of page to get.
      pageSize - size of list to return.
      sortedBy - sort param.
      getApplicationsRequestDto - body for filtering.
      Returns:
      the contract.
    • findContractDetail

      public es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract findContractDetail(String idUserBackoffice, String userToken, String contractId)
      Description copied from interface: BackofficeClient
      Get contract detail from user backoffice.
      Specified by:
      findContractDetail in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer token.
      contractId - contract identifier.
      Returns:
      the contract.
    • saveContract

      public es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract> saveContract(String idUserBackoffice, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.NewApplicationRequestDto newApplicationRequestDto, String userIp, String userAgent)
      Description copied from interface: BackofficeClient
      Create new application from user backoffice.
      Specified by:
      saveContract in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer token.
      newApplicationRequestDto - new application data.
      userIp - user real ip
      userAgent - user-agent header
      Returns:
      the contract.
    • validNewContract

      public es.kukenan.smartfi.dto.ResponseDTO<Boolean> validNewContract(String idUserBackoffice, String userToken, String type)
      Description copied from interface: BackofficeClient
      Validation if user can create Contract.
      Specified by:
      validNewContract in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer token.
      type - contract type.
      Returns:
      the contract validation.
    • saveFilesToContract

      public es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract> saveFilesToContract(String idUserBackoffice, String userToken, String contractId, List<org.springframework.web.multipart.MultipartFile> files)
      Description copied from interface: BackofficeClient
      Save files to application.
      Specified by:
      saveFilesToContract in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer token.
      contractId - contract identifier.
      files - list of files to save.
      Returns:
      response object.
    • saveAppointment

      public es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.appointments.AppointmentDto> saveAppointment(String userId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.appointments.AppointmentRequest appointmentAndBankRequest)
      Description copied from interface: BackofficeClient
      Save appointment to application.
      Specified by:
      saveAppointment in interface BackofficeClient
      Parameters:
      userId - the user back office.
      userToken - user bearer token.
      appointmentAndBankRequest - appointment request data.
      Returns:
      response object.
    • updateContractAppointment

      public es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract> updateContractAppointment(String idUserBackoffice, String userToken, String contractId, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.appointments.AppointmentDto appointment)
      Description copied from interface: BackofficeClient
      Save appointment to application.
      Specified by:
      updateContractAppointment in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer token.
      contractId - contract identifier.
      appointment - appointment to save.
      Returns:
      response object.
    • findContractState

      public List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractStateDto> findContractState(String idUserBackoffice, String userToken, String type)
      Description copied from interface: BackofficeClient
      Get contract states from user backoffice.
      Specified by:
      findContractState in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer token.
      type - applcation type.
      Returns:
      the contract.
    • updateConnectedContract

      public void updateConnectedContract(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractCacheDto contractCacheDto, String token)
      Description copied from interface: BackofficeClient
      Get be contract from user backoffice.
      Specified by:
      updateConnectedContract in interface BackofficeClient
      Parameters:
      contractCacheDto - dto for change connected contract.
      token - authentication info.
    • saveAccountBank

      public es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.AccountBank saveAccountBank(String idUserBackoffice, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.AccountBankRequestDto accountBankRequestDto)
      Description copied from interface: BackofficeClient
      Create new account bank from user backoffice.
      Specified by:
      saveAccountBank in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer token.
      accountBankRequestDto - new Account bank data.
      Returns:
      the contract.
    • findAccountBanks

      public es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.AccountBank> findAccountBanks(String idUserBackoffice)
      Description copied from interface: BackofficeClient
      Create new account bank from user backoffice.
      Specified by:
      findAccountBanks in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      Returns:
      the contract.
    • findActiveBankAccount

      public es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.AccountBank findActiveBankAccount(String idUserBackoffice, String userToken)
      Description copied from interface: BackofficeClient
      Get active bank account from user backoffice.
      Specified by:
      findActiveBankAccount in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer.
      Returns:
      the contract.
    • findAccountDetail

      public es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.AccountBank findAccountDetail(String idUserBackoffice, String accountBankId)
      Description copied from interface: BackofficeClient
      Create new account bank from user backoffice.
      Specified by:
      findAccountDetail in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      accountBankId - account bank id.
      Returns:
      the contract.
    • countContracts

      public es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.CountInfoDto> countContracts(String userId, String userToken)
      Description copied from interface: BackofficeClient
      Application count.
      Specified by:
      countContracts in interface BackofficeClient
      Parameters:
      userId - user identifier.
      userToken - user credentials.
      Returns:
      count object.
    • getContractDocumentFile

      public File getContractDocumentFile(String userId, String userToken, String contractDocumentId)
      Description copied from interface: BackofficeClient
      Get contract document file.
      Specified by:
      getContractDocumentFile in interface BackofficeClient
      Parameters:
      userId - user identifier.
      userToken - user credentials.
      contractDocumentId - contract document identifier.
      Returns:
      File object.
    • saveFileToContract

      public es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract> saveFileToContract(String userId, String userToken, String contractDocumentId, org.springframework.web.multipart.MultipartFile file)
      Description copied from interface: BackofficeClient
      Upload files.
      Specified by:
      saveFileToContract in interface BackofficeClient
      Parameters:
      userId - user identifier.
      userToken - user token.
      contractDocumentId - application identifier.
      file - file uploaded.
      Returns:
      upload files response.
    • findActiveBanks

      public List<es.kukenan.smartfi.microservice.backoffice.dtos.core.common.BankDto> findActiveBanks(String idUserBackoffice, String userToken)
      Description copied from interface: BackofficeClient
      Get active banks.
      Specified by:
      findActiveBanks in interface BackofficeClient
      Parameters:
      idUserBackoffice - the user back office.
      userToken - user bearer.
      Returns:
      list of active banks.
    • getCompanyLogo

      public File getCompanyLogo(String coreUserId, String userJwtToken, Integer companyId)
      Description copied from interface: BackofficeClient
      Get company logo.
      Specified by:
      getCompanyLogo in interface BackofficeClient
      Parameters:
      coreUserId - user identifier.
      userJwtToken - user credentials.
      companyId - company identifier.
      Returns:
      File company logo.