Class ContractService

java.lang.Object
es.kukenan.smartfi.microservice.contracts.service.ContractService

@Service public class ContractService extends Object
Contract service.
  • Field Details

    • CREDIT_PRODUCT

      private static final String CREDIT_PRODUCT
      Credit constant.
      See Also:
    • ADVANCE_PRODUCT

      private static final String ADVANCE_PRODUCT
      Advance constant.
      See Also:
    • jwtService

      @Autowired protected es.kukenan.smartfi.common.service.jwt.JwtService jwtService
      JWT service for create a bearer to call products.
    • ebContractRepository

      @Autowired private EbContractRepository ebContractRepository
      Eb contract DB repository.
    • userBackofficeRepository

      @Autowired private UserBackofficeRepository userBackofficeRepository
      User backoffice repository.
    • userRepository

      @Autowired private UserRepository userRepository
      User repository.
    • backofficeClientManager

      @Autowired private BackofficeClientManager backofficeClientManager
      Back office clients manager.
    • connectedContractCacheOperation

      @Autowired private ConnectedContractCacheOperation connectedContractCacheOperation
      Connected Contract Cache Operation.
    • contractCacheOperation

      @Autowired private ContractCacheOperation contractCacheOperation
      Contract Cache Operation.
  • Constructor Details

    • ContractService

      public ContractService()
  • Method Details

    • getContracts

      public es.kukenan.smartfi.common.api.dtos.ResultsPageDto<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract> getContracts(String userId, String sessionId, String parentSessionId, String userToken, Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.GetApplicationsRequestDto getApplicationsRequestDto)
      get contracts.
      Parameters:
      userId - user identifier.
      sessionId - session identifier.
      parentSessionId - parent session identifier.
      userToken - user bearer token.
      pageNumber - number of page to get.
      pageSize - size of list to return.
      sortedBy - sort param.
      getApplicationsRequestDto - body for filtering.
      Returns:
      ContractResponseDto.
    • getContractDetail

      public es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract getContractDetail(String userId, String userToken, String contractId)
      get contract detail.
      Parameters:
      userId - user identifier.
      userToken - user bearer token.
      contractId - contract identifier.
      Returns:
      ContractResponseDto.
    • getContract

      public EbContract getContract(String contractId)
      Get contract by id.
      Parameters:
      contractId - id.
      Returns:
      contract.
    • getContractStates

      public List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractStateDto> getContractStates(String userId, String userToken, String type)
      get contract staes.
      Parameters:
      userId - user identifier.
      userToken - user bearer token.
      type - type for filtering.
      Returns:
      ContractResponseDto.
    • validNewContract

      public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<Boolean>> validNewContract(String userId, String userToken, String type)
      Validation if user can create Contract.
      Parameters:
      userId - user identifier.
      userToken - user bearer token.
      type - contract type.
      Returns:
      the contract validation.
    • saveContract

      public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> saveContract(String userId, String userToken, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.NewApplicationRequestDto newApplicationRequestDto, String userIp, String userAgent)
      Create new application.
      Parameters:
      userId - user identifier.
      userToken - user bearer token.
      newApplicationRequestDto - new application data.
      userIp - user real ip
      userAgent - user-agent header
      Returns:
      ContractResponseDto.
    • uploadFile

      public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadFile(String contractId, String userId, List<org.springframework.web.multipart.MultipartFile> files, String userToken)
      Upload files.
      Parameters:
      contractId - application identifier.
      userId - user identifier.
      files - files uploaded.
      userToken - user token.
      Returns:
      upload files response.
    • uploadFile

      public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadFile(String contractDocumentId, String userId, org.springframework.web.multipart.MultipartFile file, String userToken)
      Upload files.
      Parameters:
      contractDocumentId - application identifier.
      userId - user identifier.
      file - file uploaded.
      userToken - user token.
      Returns:
      upload files response.
    • saveAppointment

      public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> saveAppointment(String userId, String userToken, String contractId, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.appointments.AppointmentAndBankRequest appointmentAndBankRequest)
      Create appointment for application.
      Parameters:
      userId - user identifier.
      userToken - user bearer token.
      contractId - contract identifier.
      appointmentAndBankRequest - appointment data.
      Returns:
      ContractResponseDto.
    • countApplications

      public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.CountInfoDto>> countApplications(String userId, String userToken)
      Application count.
      Parameters:
      userId - user identifier.
      userToken - user credentials.
      Returns:
      count object.
    • findBackofficeClient

      private BackofficeClient findBackofficeClient(String userId)
      Find backoffice client from User Identifier.
      Parameters:
      userId - user identifier.
      Returns:
      backoffice client found.
    • getContractDocumentFile

      public void getContractDocumentFile(String userId, String userToken, String contractDocumentId, javax.servlet.http.HttpServletResponse response) throws IOException
      Get contract document file.
      Parameters:
      userId - user identifier.
      userToken - user credentials.
      contractDocumentId - contract document identifier.
      response - response.
      Throws:
      IOException - file to write response.
    • getCompanyLogo

      public String getCompanyLogo(String userId, String userJwtToken, Integer companyId, javax.servlet.http.HttpServletResponse response) throws IOException
      Get company logo.
      Parameters:
      userId - user identifier.
      userJwtToken - user credentials.
      companyId - company identifier.
      response - response.
      Returns:
      Base64 logo image.
      Throws:
      IOException - file to write response.