Done ticket GEPAFINBE-210
This commit is contained in:
@@ -140,6 +140,12 @@ public class ApplicationAmendmentRequestDao {
|
||||
@Autowired
|
||||
private ApplicationDao applicationDao;
|
||||
|
||||
@Autowired
|
||||
private EmailLogRepository emailLogRepository;
|
||||
|
||||
@Autowired
|
||||
private EmailDao emailDao;
|
||||
|
||||
public ApplicationAmendmentRequestResponse getApplicationDataForAmendment(Long applicationEvaluationId) {
|
||||
log.info("Fetching the application data for the Amendment process {}", applicationEvaluationId);
|
||||
ApplicationEvaluationEntity applicationEvaluationEntity = applicationEvaluationService.validateApplicationEvaluation(applicationEvaluationId);
|
||||
@@ -300,6 +306,8 @@ public class ApplicationAmendmentRequestDao {
|
||||
log.info("Application submitted successfully for amendment", applicationAmendmentRequestResponse);
|
||||
if (Boolean.TRUE.equals(applicationAmendmentRequestResponse.getIsSendEmail())) {
|
||||
emailNotificationDao.sendMailToNotifyBeneficiaryRegardingNewAmendment(applicationAmendmentRequestEntity);
|
||||
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||
applicationAmendmentRequestResponse.setEmailSendResponse(emailSendResponse);
|
||||
}
|
||||
return applicationAmendmentRequestResponse;
|
||||
}
|
||||
@@ -1168,12 +1176,13 @@ public class ApplicationAmendmentRequestDao {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void sendReminderEmail(Long amendmentId) {
|
||||
public EmailReminderResponse sendReminderEmail(Long amendmentId) {
|
||||
|
||||
ApplicationAmendmentRequestEntity amendment = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(amendmentId)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));
|
||||
|
||||
Optional<ApplicationEvaluationEntity> entityOptional = applicationEvaluationRepository.findByIdAndIsDeletedFalse(amendment.getApplicationEvaluationEntity().getId());
|
||||
EmailReminderResponse emailReminderResponse = new EmailReminderResponse();
|
||||
if (entityOptional.isPresent()) {
|
||||
ApplicationEntity applicationEntity = applicationService.validateApplication(entityOptional.get().getApplicationId());
|
||||
UserEntity beneficiaryUser = userService.validateUser(applicationEntity.getUserId());
|
||||
@@ -1186,10 +1195,13 @@ public class ApplicationAmendmentRequestDao {
|
||||
EmailLogRequest emailLogRequest = emailLogDao.createEmailLogRequest(emailTemplate.getEmailScenario(), RecipientTypeEnum.USER, beneficiaryUser.getId(), email,
|
||||
beneficiaryUser.getId(), applicationEntity.getId(), amendment.getId(), applicationEntity.getCall().getId());
|
||||
emailNotificationDao.sendMail(hub.getId(), subject, body, List.of(email), emailLogRequest);
|
||||
EmailSendResponse emailSendResponse = emailDao.buildEmailSendResponseFromRequest(request);
|
||||
emailReminderResponse.setEmailSendResponse(emailSendResponse);
|
||||
} else {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.BENEFICIARY_EMAIL_NOT_FOUND_MSG));
|
||||
}
|
||||
}
|
||||
return emailReminderResponse;
|
||||
}
|
||||
|
||||
private String prepareSubject(SystemEmailTemplateResponse template, ApplicationAmendmentRequestEntity amendment, UserEntity beneficiary) {
|
||||
|
||||
Reference in New Issue
Block a user