Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

fix: Avoid send PEC when application are not under NAT #478

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/resources/config/core-config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mscore.logoPath = ${PAGOPA_LOGO_URL:resources/logo.png}
mscore.infoCamereEnable = ${INFOCAMERE_ENABLE:false}
mscore.sender-mail = ${MAIL_SENDER_ADDRESS:test@test.it}
mscore.destination-mails = ${DESTINATION_MAILS:}

mscore.enableSendDelegationMail=${SEND_DELEGATION_PEC:false}
mscore.sendEmailToInstitution = ${ONBOARDING_SEND_EMAIL_TO_INSTITUTION:false}
mscore.institutionAlternativeEmail = ${ONBOARDING_INSTITUTION_ALTERNATIVE_EMAIL}
mscore.onboarding-expiring-date = ${ONBOARDING_EXPIRING_DATE:60}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ public class CoreConfig {
private boolean sendEmailToInstitution;
private Integer onboardingExpiringDate;
private boolean infoCamereEnable;
private boolean enableSendDelegationMail;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ public void sendMailForDelegation(String institutionName, String productId, Stri
userNotificationService.sendDelegationUserNotification(userDestinationMail, mailParametersMapper.getDelegationUserNotificationPath(), product.getTitle(), mailParameters);
log.info("create-delegation-user-email-notification :: Email successful sent");

List<String> institutionDestinationMail = getDestinationMails(partnerInstitution);
log.info(DESTINATION_MAIL_LOG, institutionDestinationMail);
emailConnector.sendMail(mailParametersMapper.getDelegationNotificationPath(), institutionDestinationMail, null, product.getTitle(), mailParameters, null);
log.info("create-delegation-institution-email-notification :: Email successful sent");
if (coreConfig.isEnableSendDelegationMail()) {
List<String> institutionDestinationMail = getDestinationMails(partnerInstitution);
log.info(DESTINATION_MAIL_LOG, institutionDestinationMail);
emailConnector.sendMail(mailParametersMapper.getDelegationNotificationPath(), institutionDestinationMail, null, product.getTitle(), mailParameters, null);
log.info("create-delegation-institution-email-notification :: Email successful sent");
}
} catch (Exception e) {
log.error("create-delegation-email-notification :: Impossible to send email. Error: {}", e.getMessage(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void sendNotificationDelegationMail() {
when(institutionConnector.findById(anyString())).thenReturn(institution);
when(userApiConnector.getUserEmails(institution.getId(), product.getId())).thenReturn(userEmails);
when(coreConfig.isSendEmailToInstitution()).thenReturn(true);
when(coreConfig.isEnableSendDelegationMail()).thenReturn(true);
Assertions.assertDoesNotThrow(() -> notificationService.sendMailForDelegation("institutionName", "productId", "partnerId"));
}

Expand Down
Loading