Class ApplicationsRestController
java.lang.Object
es.kukenan.smartfi.microservice.backoffice.controller.ApplicationsRestController
Applications Rest API controller.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAdvance application update list of id state path.static final StringNew Credit/Advance Application path.static final StringAuthority (role) required in order to be able to invoke greeting API.static final StringAuthority (role) required in order to be able to invoke change application status.static final StringBase path for backoffice Rest API.static final StringChange Application status path.static final StringNew Credit/Advance Application path.static final StringApplication detail path.static final StringApplication detail path.static final StringApplication generate contract path.static final StringApplication upload payment proof path.static final StringApplication upload signed contract path.static final StringApplication path.static final StringCredit application update list of id state path.private es.kukenan.smartfi.common.service.jwt.JwtServiceImplJWT service for create a bearer to call products.private es.kukenan.smartfi.common.context.RequestContextManagerRequest context manager.private UserServiceUsers service. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>>changeAdvanceToPaymentReturn(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateListOfContractsRequestDto updateListOfContractsRequestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Change a list of application identifier from APPROVED_PAYMENT_PENDING_NAME (advance) to PAYED (advance).org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>>changeCreditsToActive(es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateListOfContractsRequestDto updateListOfContractsRequestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Change a list of application identifier from PAYMENT_PENDING (credit) to ACTIVE (credit).org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.CountInfoDto>>countApplications(es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application count.voiddownloadContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String contractDocumentId, javax.servlet.http.HttpServletResponse response) Download document.voiddownloadGeneratedContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String applicationId, javax.servlet.http.HttpServletResponse response) Download generated contract pdf document.org.springframework.http.ResponseEntity<Object>findAllApplications(Integer pageNumber, Integer pageSize, String sortedBy, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.GetApplicationsRequestDto getApplicationsRequestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application list endpoint.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>findApplicationDetail(String applicationId, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application detail endpoint.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>saveApplication(es.kukenan.smartfi.common.security.WalletAuthentication authentication, es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.NewUserAndApplicationRequestDto newApplicationRequestDto, String userIp, String userAgent) Create new Application.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>updateContractDocumentStatus(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String contractDocumentId, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateContractDocumentRequestDto updateContractDocumentRequestDto) Change application document status.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>updateContractStatus(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String contractId, es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractStatusRequestDto contractStatusRequestDto) Change application status.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>uploadContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String contractDocumentId, org.springframework.web.multipart.MultipartFile file) Save specific contract document file.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>uploadFiles(es.kukenan.smartfi.common.security.WalletAuthentication authentication, String userId, String contractId, List<org.springframework.web.multipart.MultipartFile> files) Upload files.org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>uploadPaymentProofFile(String applicationId, org.springframework.web.multipart.MultipartFile file, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Change application from PAYMENT_PENDING (credit) or APPROVED_PAYMENT_PENDING_NAME (advance) to PAYED (advance) or ACTIVE (credit).org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>uploadSignedContractFile(String applicationId, org.springframework.web.multipart.MultipartFile file, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Change application from PENDING_SIGNATURE (credit) or APPROVED (advance) to PAYMENT_PENDING (credit) and APPROVED_PAYMENT_PENDING (advance).
-
Field Details
-
API_BASE_PATH
Base path for backoffice Rest API.- See Also:
-
APPLICATIONS_PATH
Application path.- See Also:
-
APPLICATION_DETAIL_PATH
Application detail path.- See Also:
-
API_APPLICATION_PATH
New Credit/Advance Application path.- See Also:
-
API_UPLOAD_FILES_APPLICATION_PATH
New Credit/Advance Application path.- See Also:
-
API_CHANGE_APPLICATION_STATUS_PATH
Change Application status path.- See Also:
-
APPLICATION_CHANGE_DOCUMENT_STATUS_PATH
Application detail path.- See Also:
-
APPLICATION_UPLOAD_SIGNED_CONTRACT_PATH
Application upload signed contract path.- See Also:
-
APPLICATION_UPLOAD_PAYMENT_PROOF_PATH
Application upload payment proof path.- See Also:
-
APPLICATION_GENERATE_CONTRACT_PATH
Application generate contract path.- See Also:
-
ADVANCE_APPLICATION_LIST_SET_PAYED
Advance application update list of id state path.- See Also:
-
CREDIT_APPLICATION_LIST_SET_PAYED
Credit application update list of id state path.- See Also:
-
jwtService
@Autowired private es.kukenan.smartfi.common.service.jwt.JwtServiceImpl jwtServiceJWT service for create a bearer to call products. -
userService
Users service. -
requestContextManager
@Autowired private es.kukenan.smartfi.common.context.RequestContextManager requestContextManagerRequest context manager. -
API_AUTHORITIES
Authority (role) required in order to be able to invoke greeting API.- See Also:
-
API_BACKOFFICE_AUTHORITIES
Authority (role) required in order to be able to invoke change application status.- See Also:
-
-
Constructor Details
-
ApplicationsRestController
public ApplicationsRestController()
-
-
Method Details
-
countApplications
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_CONSULTANT\') and hasRole(\'ROLE_LEVEL_USER_CONSULTANT\')) or (hasRole(\'ROLE_ACCESS_COMPANY\') and hasRole(\'ROLE_LEVEL_USER_COMPANY\'))") @GetMapping(produces="application/json", path="/api/v1/backoffice/applications") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.CountInfoDto>> countApplications(es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application count.- Parameters:
authentication- user credentials.- Returns:
- user list.
-
findAllApplications
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_CONSULTANT\') and hasRole(\'ROLE_LEVEL_USER_CONSULTANT\')) or (hasRole(\'ROLE_ACCESS_COMPANY\') and hasRole(\'ROLE_LEVEL_USER_COMPANY\'))") @PostMapping(produces="application/json", consumes="application/json", path="/api/v1/backoffice/applications") public org.springframework.http.ResponseEntity<Object> findAllApplications(@RequestParam(name="pageNumber",required=false,defaultValue="0") Integer pageNumber, @RequestParam(name="pageSize",required=false,defaultValue="20") Integer pageSize, @RequestParam(name="sortedBy",required=false,defaultValue="") String sortedBy, @RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.GetApplicationsRequestDto getApplicationsRequestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application list endpoint.- Parameters:
pageNumber- the page to searchpageSize- max number of rows per pagesortedBy- field to sortgetApplicationsRequestDto- fields to filterauthentication- user credentials.- Returns:
- user list.
-
findApplicationDetail
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_CONSULTANT\') and hasRole(\'ROLE_LEVEL_USER_CONSULTANT\')) or (hasRole(\'ROLE_ACCESS_COMPANY\') and hasRole(\'ROLE_LEVEL_USER_COMPANY\'))") @GetMapping(produces="application/json", path="/api/v1/backoffice/applications/{applicationId}") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> findApplicationDetail(@PathVariable(name="applicationId") String applicationId, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Application detail endpoint.- Parameters:
applicationId- application identifier.authentication- user credentials.- Returns:
- user list.
-
saveApplication
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_CONSULTANT\') and hasRole(\'ROLE_LEVEL_USER_CONSULTANT\')) or (hasRole(\'ROLE_ACCESS_COMPANY\') and hasRole(\'ROLE_LEVEL_USER_COMPANY\'))") @PostMapping(path="/api/v1/backoffice/application", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> saveApplication(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.backoffice.NewUserAndApplicationRequestDto newApplicationRequestDto, @RequestHeader(name="X-SKYLINE-USER-IP",defaultValue="N/A") String userIp, @RequestHeader(name="X-USER-AGENT",defaultValue="N/A") String userAgent) Create new Application.- Parameters:
authentication- user credentials.newApplicationRequestDto- application data.userIp- user real ipuserAgent- user-agent header- Returns:
- the created contract.
-
uploadFiles
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\')) or (hasRole(\'ROLE_ACCESS_CONSULTANT\') and hasRole(\'ROLE_LEVEL_USER_CONSULTANT\')) or (hasRole(\'ROLE_ACCESS_COMPANY\') and hasRole(\'ROLE_LEVEL_USER_COMPANY\'))") @PostMapping(path="/api/v1/backoffice/application/{userId}/{contractId}/upload-files", consumes="multipart/form-data", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadFiles(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="userId") String userId, @PathVariable(name="contractId") String contractId, @RequestPart("file") List<org.springframework.web.multipart.MultipartFile> files) Upload files.- Parameters:
authentication- user credentials.userId- user identifier.contractId- application identifier.files- list of files received.- Returns:
- upload files response.
-
updateContractStatus
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PutMapping(path="/api/v1/backoffice/applications/{applicationId}/status", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> updateContractStatus(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="applicationId") String contractId, @RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.ContractStatusRequestDto contractStatusRequestDto) Change application status.- Parameters:
authentication- user credentials.contractId- contract id.contractStatusRequestDto- list of files received.- Returns:
- ok.
-
updateContractDocumentStatus
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PutMapping(path="/api/v1/backoffice/applications/documents/{contractDocumentId}", consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> updateContractDocumentStatus(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="contractDocumentId") String contractDocumentId, @RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateContractDocumentRequestDto updateContractDocumentRequestDto) Change application document status.- Parameters:
authentication- user credentials.contractDocumentId- contract document id.updateContractDocumentRequestDto- update application document data.- Returns:
- ok.
-
downloadContractDocument
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @GetMapping(path="/api/v1/backoffice/applications/documents/{contractDocumentId}", produces="application/octet-stream") public void downloadContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="contractDocumentId") String contractDocumentId, javax.servlet.http.HttpServletResponse response) throws IOException Download document.- Parameters:
authentication- user credentials.contractDocumentId- contract document id.response- response.- Throws:
IOException- file to write response.
-
uploadContractDocument
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PostMapping(path="/api/v1/backoffice/applications/documents/{contractDocumentId}", consumes="multipart/form-data") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="contractDocumentId") String contractDocumentId, @RequestPart("file") org.springframework.web.multipart.MultipartFile file) Save specific contract document file.- Parameters:
authentication- user credentials.contractDocumentId- contract document id.file- file received.- Returns:
- contract updated.
-
uploadSignedContractFile
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PutMapping(path="/api/v1/backoffice/application/sign-contract/{applicationId}", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadSignedContractFile(@PathVariable(name="applicationId") String applicationId, @RequestPart("file") org.springframework.web.multipart.MultipartFile file, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Change application from PENDING_SIGNATURE (credit) or APPROVED (advance) to PAYMENT_PENDING (credit) and APPROVED_PAYMENT_PENDING (advance).- Parameters:
applicationId- application identifier.file- file received.authentication- user credentials.- Returns:
- user list.
-
uploadPaymentProofFile
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PutMapping(path="/api/v1/backoffice/application/payment-proof/{applicationId}", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>> uploadPaymentProofFile(@PathVariable(name="applicationId") String applicationId, @RequestPart("file") org.springframework.web.multipart.MultipartFile file, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Change application from PAYMENT_PENDING (credit) or APPROVED_PAYMENT_PENDING_NAME (advance) to PAYED (advance) or ACTIVE (credit).- Parameters:
applicationId- application identifier.file- file received.authentication- user credentials.- Returns:
- user list.
-
downloadGeneratedContractDocument
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @GetMapping(path="/api/v1/backoffice/application/generate-contract/{applicationId}", produces="application/octet-stream") public void downloadGeneratedContractDocument(es.kukenan.smartfi.common.security.WalletAuthentication authentication, @PathVariable(name="applicationId") String applicationId, javax.servlet.http.HttpServletResponse response) throws IOException Download generated contract pdf document.- Parameters:
authentication- user credentials.applicationId- application identifier.response- response.- Throws:
IOException- file to write response.
-
changeAdvanceToPaymentReturn
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PutMapping(path="/api/v1/backoffice/application/advance/set-payment-return", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>> changeAdvanceToPaymentReturn(@RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateListOfContractsRequestDto updateListOfContractsRequestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Change a list of application identifier from APPROVED_PAYMENT_PENDING_NAME (advance) to PAYED (advance).- Parameters:
updateListOfContractsRequestDto- contract id list.authentication- user credentials.- Returns:
- ok.
-
changeCreditsToActive
@PreAuthorize("(hasRole(\'ROLE_ACCESS_ADMIN\') and hasRole(\'ROLE_LEVEL_BACKOFFICE_ADMIN\')) or (hasRole(\'ROLE_ACCESS_MODERATOR\') and hasRole(\'ROLE_LEVEL_USER_MODERATOR\'))") @PutMapping(path="/api/v1/backoffice/application/credit/set-active", produces="application/json") public org.springframework.http.ResponseEntity<es.kukenan.smartfi.dto.ResponseDTO<List<es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.Contract>>> changeCreditsToActive(@RequestBody es.kukenan.smartfi.microservice.backoffice.dtos.core.contract.UpdateListOfContractsRequestDto updateListOfContractsRequestDto, es.kukenan.smartfi.common.security.WalletAuthentication authentication) Change a list of application identifier from PAYMENT_PENDING (credit) to ACTIVE (credit).- Parameters:
updateListOfContractsRequestDto- contract id list.authentication- user credentials.- Returns:
- user list.
-