From 7ea949ecdf8c5884a6f9828fd6c1b93d959b5cad Mon Sep 17 00:00:00 2001 From: flaminiaScarciofolo Date: Thu, 7 Nov 2024 13:19:17 +0100 Subject: [PATCH] [SELC-5923] Added send selfcare fd event after user mail update --- .../user/event/UserGroupCdcService.java | 4 +- .../user/mapper/NotificationMapper.java | 25 +++- .../user/service/UserNotificationService.java | 4 + .../service/UserNotificationServiceImpl.java | 40 +++++- .../user/service/UserRegistryServiceImpl.java | 69 +++++++++- .../src/main/resources/application.properties | 2 + .../UserNotificationServiceImplTest.java | 55 +++++--- .../user/service/UserRegistryServiceTest.java | 120 +++++++++++++++++- .../src/test/resources/application.properties | 3 +- .../user-ms/env/dev/terraform.tfvars | 19 ++- .../user-ms/env/prod/terraform.tfvars | 25 +++- .../user-ms/env/uat/terraform.tfvars | 19 ++- .../constants/EventsName.java | 1 + 13 files changed, 350 insertions(+), 36 deletions(-) diff --git a/apps/user-group-cdc/src/main/java/it/pagopa/selfcare/user/event/UserGroupCdcService.java b/apps/user-group-cdc/src/main/java/it/pagopa/selfcare/user/event/UserGroupCdcService.java index c3cd24a9..11812d1d 100644 --- a/apps/user-group-cdc/src/main/java/it/pagopa/selfcare/user/event/UserGroupCdcService.java +++ b/apps/user-group-cdc/src/main/java/it/pagopa/selfcare/user/event/UserGroupCdcService.java @@ -150,11 +150,11 @@ public void consumerToSendScUserGroupEvent(ChangeStreamDocument mapPropsForTrackEvent(toTrackEventInputForUserGroup(userGroupNotificationToSend)), Map.of(EVENTS_USER_GROUP_PRODUCT_FAILURE, 1D))) .subscribe().with( result -> { - log.info("SendEvents successfully performed from UserInstitution document having id: {}", document.getDocumentKey().toJson()); + log.info("SendEvents successfully performed from user group document having id: {}", document.getDocumentKey().toJson()); telemetryClient.trackEvent(EVENT_USER_GROUP_CDC_NAME, mapPropsForTrackEvent(toTrackEventInputForUserGroup(userGroupNotificationToSend)), Map.of(EVENTS_USER_GROUP_SUCCESS, 1D)); }, failure -> { - log.error("Error during SendEvents from UserInstitution document having id: {} , message: {}", document.getDocumentKey().toJson(), failure.getMessage()); + log.error("Error during SendEvents from user group document having id: {} , message: {}", document.getDocumentKey().toJson(), failure.getMessage()); telemetryClient.trackEvent(EVENT_USER_GROUP_CDC_NAME, mapPropsForTrackEvent(toTrackEventInputForUserGroup(userGroupNotificationToSend)), Map.of(EVENTS_USER_GROUP_FAILURE, 1D)); }); } diff --git a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/mapper/NotificationMapper.java b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/mapper/NotificationMapper.java index 41c63ccd..db1a5956 100644 --- a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/mapper/NotificationMapper.java +++ b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/mapper/NotificationMapper.java @@ -1,14 +1,17 @@ package it.pagopa.selfcare.user.mapper; +import com.microsoft.applicationinsights.web.dependencies.apachecommons.lang3.StringUtils; import it.pagopa.selfcare.user.UserUtils; import it.pagopa.selfcare.user.entity.UserInstitution; -import it.pagopa.selfcare.user.model.OnboardedProduct; -import it.pagopa.selfcare.user.model.UserNotificationToSend; +import it.pagopa.selfcare.user.model.*; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Named; import org.openapi.quarkus.user_registry_json.model.UserResource; +import java.util.Collections; +import java.util.List; +import java.util.Optional; import java.util.UUID; @Mapper(componentModel = "cdi", imports = UUID.class) @@ -33,4 +36,22 @@ public interface NotificationMapper { default String toUniqueIdNotification(UserInstitution userInstitution, OnboardedProduct product) { return UserUtils.uniqueIdNotification(userInstitution.getId().toHexString(), product.getProductId(), product.getProductRole()); } + + @Mapping(target = "id", expression = "java(toUniqueIdNotification(userInstitutionChanged, product))") + @Mapping(target = "onboardingTokenId", source = "product.tokenId") + @Mapping(target = "product", source = "product.productId") + @Mapping(target = "createdAt", source = "product.createdAt") + @Mapping(target = "updatedAt", expression = "java((null == product.getUpdatedAt()) ? product.getCreatedAt() : product.getUpdatedAt())") + @Mapping(target = "user", expression = "java(mapUserForFD(userId, product))") + @Mapping(target = "type", source = "type") + FdUserNotificationToSend toFdUserNotificationToSend(UserInstitution userInstitutionChanged, OnboardedProduct product, String userId, NotificationUserType type); + + @Named("mapUserForFD") + default UserToNotify mapUserForFD(String userId, OnboardedProduct onboardedProduct) { + UserToNotify userToNotify = new UserToNotify(); + userToNotify.setUserId(userId); + userToNotify.setRoles(StringUtils.isNotBlank(onboardedProduct.getProductRole()) ? List.of(onboardedProduct.getProductRole()) : Collections.emptyList()); + userToNotify.setRole(Optional.ofNullable(onboardedProduct.getRole()).map(Enum::name).orElse(null)); + return userToNotify; + } } diff --git a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserNotificationService.java b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserNotificationService.java index 554a3981..82799c3c 100644 --- a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserNotificationService.java +++ b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserNotificationService.java @@ -3,7 +3,9 @@ import io.smallrye.mutiny.Uni; import it.pagopa.selfcare.product.entity.Product; import it.pagopa.selfcare.user.entity.UserInstitution; +import it.pagopa.selfcare.user.model.FdUserNotificationToSend; import it.pagopa.selfcare.user.model.LoggedUser; +import it.pagopa.selfcare.user.model.NotificationUserType; import it.pagopa.selfcare.user.model.UserNotificationToSend; import it.pagopa.selfcare.user.model.constants.OnboardedProductState; import org.openapi.quarkus.user_registry_json.model.UserResource; @@ -16,4 +18,6 @@ public interface UserNotificationService { Uni sendEmailNotification(UserResource user, UserInstitution institution, Product product, OnboardedProductState status, String productRole, String loggedUserName, String loggedUserSurname); Uni sendCreateUserNotification(String institutionDescription, List roleLabels, UserResource userResource, UserInstitution userInstitution, Product product, LoggedUser loggedUser); + + Uni sendSelfcareFdUserNotification(FdUserNotificationToSend fdUserNotificationToSend, NotificationUserType actionType); } \ No newline at end of file diff --git a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserNotificationServiceImpl.java b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserNotificationServiceImpl.java index 56452d61..7ce434e2 100644 --- a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserNotificationServiceImpl.java +++ b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserNotificationServiceImpl.java @@ -8,6 +8,7 @@ import it.pagopa.selfcare.product.entity.Product; import it.pagopa.selfcare.product.entity.ProductRole; import it.pagopa.selfcare.product.utils.ProductUtils; +import it.pagopa.selfcare.user.client.EventHubFdRestClient; import it.pagopa.selfcare.user.client.EventHubRestClient; import it.pagopa.selfcare.user.conf.CloudTemplateLoader; import it.pagopa.selfcare.user.entity.UserInstitution; @@ -25,15 +26,16 @@ import software.amazon.awssdk.utils.CollectionUtils; import java.io.StringWriter; +import java.time.Duration; import java.util.*; import java.util.stream.Collectors; import static it.pagopa.selfcare.user.UserUtils.mapPropsForTrackEvent; import static it.pagopa.selfcare.user.constant.TemplateMailConstant.*; import static it.pagopa.selfcare.user.model.TrackEventInput.toTrackEventInput; -import static it.pagopa.selfcare.user.model.constants.EventsMetric.EVENTS_USER_INSTITUTION_PRODUCT_FAILURE; -import static it.pagopa.selfcare.user.model.constants.EventsMetric.EVENTS_USER_INSTITUTION_PRODUCT_SUCCESS; -import static it.pagopa.selfcare.user.model.constants.EventsName.EVENT_USER_MS_NAME; +import static it.pagopa.selfcare.user.model.constants.EventsMetric.*; +import static it.pagopa.selfcare.user.model.constants.EventsMetric.FD_EVENTS_USER_INSTITUTION_PRODUCT_FAILURE; +import static it.pagopa.selfcare.user.model.constants.EventsName.*; @Slf4j @@ -44,16 +46,34 @@ public class UserNotificationServiceImpl implements UserNotificationService { @RestClient EventHubRestClient eventHubRestClient; + @Inject + @RestClient + EventHubFdRestClient eventHubFdRestClient; + + @ConfigProperty(name = "user-ms.retry.min-backoff") + Integer retryMinBackOff; + + @ConfigProperty(name = "user-ms.retry.max-backoff") + Integer retryMaxBackOff; + + @ConfigProperty(name = "user-ms.retry") + Integer maxRetry; + + private final MailService mailService; private final Configuration freemarkerConfig; private final boolean eventHubUsersEnabled; + private final boolean eventHubSelfcareFdEnabled; private final TelemetryClient telemetryClient; public UserNotificationServiceImpl(Configuration freemarkerConfig, CloudTemplateLoader cloudTemplateLoader, MailService mailService, - @ConfigProperty(name = "user-ms.eventhub.users.enabled") boolean eventHubUsersEnabled, TelemetryClient telemetryClient) { + @ConfigProperty(name = "user-ms.eventhub.users.enabled") boolean eventHubUsersEnabled, + @ConfigProperty(name = "user-ms.eventhub.selfcarefd.enabled") boolean eventHubSelfcareFdEnabled, + TelemetryClient telemetryClient) { this.mailService = mailService; this.freemarkerConfig = freemarkerConfig; + this.eventHubSelfcareFdEnabled = eventHubSelfcareFdEnabled; this.telemetryClient = telemetryClient; freemarkerConfig.setTemplateLoader(cloudTemplateLoader); this.eventHubUsersEnabled = eventHubUsersEnabled; @@ -101,6 +121,18 @@ public Uni sendCreateUserNotification(String institutionDescription, List< .onItem().invoke(() -> log.debug("sendCreateNotification end")); } + @Override + public Uni sendSelfcareFdUserNotification(FdUserNotificationToSend fdUserNotificationToSend, NotificationUserType actionType) { + return eventHubSelfcareFdEnabled + ? eventHubFdRestClient.sendMessage(fdUserNotificationToSend) + .onFailure().retry().withBackOff(Duration.ofSeconds(retryMinBackOff), Duration.ofSeconds(retryMaxBackOff)).atMost(maxRetry) + .onItem().invoke(() -> telemetryClient.trackEvent(FD_EVENT_USER_MS_NAME, mapPropsForTrackEvent(toTrackEventInput(fdUserNotificationToSend)), Map.of(FD_EVENTS_USER_INSTITUTION_PRODUCT_SUCCESS, 1D))) + .onFailure().invoke(() -> telemetryClient.trackEvent(FD_EVENT_USER_MS_NAME, mapPropsForTrackEvent(toTrackEventInput(fdUserNotificationToSend)), Map.of(FD_EVENTS_USER_INSTITUTION_PRODUCT_FAILURE, 1D))) + .onItem().invoke(() -> log.debug("Selfcare fd user notification sent successfully with actionType: {}", actionType)) + .onFailure().invoke(throwable -> log.warn("Failed to send selfcare fd user notification with actionType: {}", actionType)) + : Uni.createFrom().nullItem(); + } + private Map buildCreateEmailDataModel(LoggedUser loggedUser, Product product, String institutionDescription, List productRoleCodes) { Map dataModel = new HashMap<>(); dataModel.put("requesterName", Optional.ofNullable(loggedUser.getName()).orElse("")); diff --git a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserRegistryServiceImpl.java b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserRegistryServiceImpl.java index 0e93c13d..426b38b3 100644 --- a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserRegistryServiceImpl.java +++ b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/service/UserRegistryServiceImpl.java @@ -4,8 +4,11 @@ import io.smallrye.mutiny.Uni; import it.pagopa.selfcare.user.entity.UserInstitution; import it.pagopa.selfcare.user.entity.filter.UserInstitutionFilter; +import it.pagopa.selfcare.user.exception.ResourceNotFoundException; +import it.pagopa.selfcare.user.mapper.NotificationMapper; import it.pagopa.selfcare.user.mapper.UserMapper; -import it.pagopa.selfcare.user.model.UpdateUserRequest; +import it.pagopa.selfcare.user.model.*; +import it.pagopa.selfcare.user.model.constants.OnboardedProductState; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import jakarta.ws.rs.WebApplicationException; @@ -16,6 +19,8 @@ import org.eclipse.microprofile.rest.client.inject.RestClient; import org.gradle.internal.impldep.org.apache.commons.lang.StringUtils; import org.openapi.quarkus.user_registry_json.api.UserApi; +import org.openapi.quarkus.user_registry_json.model.*; +import org.openapi.quarkus.user_registry_json.model.CertifiableFieldResourceOfstring; import org.openapi.quarkus.user_registry_json.model.MutableUserFieldsDto; import org.openapi.quarkus.user_registry_json.model.SaveUserDto; import org.openapi.quarkus.user_registry_json.model.UserId; @@ -25,6 +30,7 @@ import java.time.Duration; import java.util.*; import java.util.concurrent.TimeoutException; +import java.util.stream.Collectors; import static it.pagopa.selfcare.user.constant.CollectionUtil.MAIL_ID_PREFIX; @@ -34,9 +40,12 @@ @Slf4j public class UserRegistryServiceImpl implements UserRegistryService { private static final String USERS_FIELD_LIST_WITHOUT_FISCAL_CODE = "name,familyName,email,workContacts"; + public static final String PROD_FD_GARANTITO = "prod-fd-garantito"; + public static final String PROD_FD = "prod-fd"; private final UserInstitutionService userInstitutionService; private final UserMapper userMapper; + private final NotificationMapper notificationMapper; @ConfigProperty(name = "user-ms.retry.min-backoff") Integer retryMinBackOff; @@ -47,6 +56,9 @@ public class UserRegistryServiceImpl implements UserRegistryService { @ConfigProperty(name = "user-ms.retry") Integer maxRetry; + @Inject + UserNotificationService userNotificationService; + @RestClient @Inject @@ -106,11 +118,64 @@ public Uni> updateUserRegistry(UpdateUserRequest updateUse .onItem().ifNotNull().invoke(() -> log.debug("UserInstitution founded for userId: {} and institutionId: {}", userId, institutionId))) .asTuple() .onItem().transformToMulti(tuple -> findMailUuidAndUpdateUserRegistry(tuple.getItem1(), updateUserRequest) - .onItem().transformToMulti(uuidMail -> updateUserInstitution(tuple.getItem2(), uuidMail))) + .onItem().transformToMulti(uuidMail -> { + if (Objects.nonNull(tuple.getItem2()) && !tuple.getItem2().isEmpty()) { + Map oldMailUuidMap = tuple.getItem2().stream().collect(Collectors.toMap(UserInstitution::getInstitutionId, + userInstitution -> Optional.ofNullable(userInstitution.getUserMailUuid()).orElse(""), (a, b) -> b)); + return updateUserInstitution(tuple.getItem2(), uuidMail) + .onItem().transformToUniAndMerge(userInstitution -> checkProductAndSendFdUserNotification(userInstitution, tuple.getItem1(), userId, updateUserRequest.getEmail(), oldMailUuidMap.get(userInstitution.getInstitutionId()))); + } + return Multi.createFrom().empty(); + })) .collect().asList() .onItem().invoke(items -> log.trace("update {} users on userRegistry", items.size())); } + + private Uni checkProductAndSendFdUserNotification(UserInstitution userInstitution, UserResource userResource, String userId, String email, String oldUserMailUuid) { + String oldMail = retrieveOldMail(userResource, oldUserMailUuid); + if (!email.equalsIgnoreCase(oldMail)) { + log.info("User email changed to {}, so start to check product to send selfcare fd event", email); + return Uni.createFrom().item(userInstitution.getProducts().stream() + .filter(this::checkIfExistActiveFdProduct) + .findFirst() + .orElse(null)) + .onItem().ifNull().failWith(new ResourceNotFoundException("User has not active FD product")) + .onItem().ifNotNull().transformToUni(onboardedProduct -> sendFdUserNotification(userId, onboardedProduct, userInstitution, NotificationUserType.DELETE_USER, userInstitution.getUserMailUuid()) + .replaceWith(onboardedProduct)) + .onItem().ifNotNull().transformToUni(onboardedProduct -> sendFdUserNotification(userId, onboardedProduct, userInstitution, NotificationUserType.ACTIVE_USER, email)) + .onFailure(ResourceNotFoundException.class).invoke(() -> log.info("User has not active FD product, so we haven't to send selfcare fd event")) + .onFailure().recoverWithNull() + .replaceWith(userInstitution); + } + log.info("User email not changed, so we haven't to send selfcare fd event"); + return Uni.createFrom().item(userInstitution); + } + + private boolean checkIfExistActiveFdProduct(OnboardedProduct product) { + return List.of(PROD_FD, PROD_FD_GARANTITO).contains(product.getProductId()) && OnboardedProductState.ACTIVE.equals(product.getStatus()); + } + + private String retrieveOldMail(UserResource userResource, String userMailUuid) { + if (Objects.nonNull(userResource.getWorkContacts()) && StringUtils.isNotBlank(userMailUuid)) { + return Optional.ofNullable(userResource.getWorkContacts().get(userMailUuid)) + .flatMap(workContactResource -> Optional.ofNullable(workContactResource.getEmail()) + .map(CertifiableFieldResourceOfstring::getValue)) + .orElse(null); + } + return null; + } + + private Uni sendFdUserNotification(String userId, OnboardedProduct onboardedProduct, UserInstitution userInstitution, NotificationUserType actionType, String mail) { + UserToNotify userToNotify = notificationMapper.mapUserForFD(userId, onboardedProduct); + userToNotify.setEmail(mail); + + FdUserNotificationToSend fdUserNotificationToSend = notificationMapper.toFdUserNotificationToSend(userInstitution, onboardedProduct, userId, actionType); + log.info("Start to send Event for selfcare-fd with action: [{}]", actionType); + return userNotificationService.sendSelfcareFdUserNotification(fdUserNotificationToSend, actionType); + + } + private Multi updateUserInstitution(List userInstitutions, String mailUuid) { return Multi.createFrom().iterable(userInstitutions.stream() .peek(userInstitution -> userInstitution.setUserMailUuid(mailUuid)) diff --git a/apps/user-ms/src/main/resources/application.properties b/apps/user-ms/src/main/resources/application.properties index f646a7ac..cb6e1312 100644 --- a/apps/user-ms/src/main/resources/application.properties +++ b/apps/user-ms/src/main/resources/application.properties @@ -25,6 +25,8 @@ quarkus.rest-client.event-hub-fd.url=${EVENT_HUB_BASE_PATH:test}${EVENT_HUB_SELF eventhubfd.rest-client.keyName=${FD_SHARED_ACCESS_KEY_NAME:test} eventhubfd.rest-client.key=${EVENTHUB_SELFCARE_FD_EXTERNAL_KEY_LC:test} +user-ms.eventhub.selfcarefd.enabled=${USER_MS_EVENTHUB_SELFCARE_FD_ENABLED:false} + user-ms.eventhub.users.enabled=${USER_MS_EVENTHUB_USERS_ENABLED:false} user-ms.eventhub.users.concurrency-level=${USER_MS_EVENTHUB_USERS_CONCURRENCY_LEVEL:1} user-ms.eventhub.users.page-size=${USER_MS_EVENTHUB_USERS_PAGE_SIZE:50} diff --git a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserNotificationServiceImplTest.java b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserNotificationServiceImplTest.java index 1fb79bab..ad523bb5 100644 --- a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserNotificationServiceImplTest.java +++ b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserNotificationServiceImplTest.java @@ -10,12 +10,11 @@ import it.pagopa.selfcare.product.entity.Product; import it.pagopa.selfcare.product.entity.ProductRole; import it.pagopa.selfcare.product.entity.ProductRoleInfo; +import it.pagopa.selfcare.user.client.EventHubFdRestClient; import it.pagopa.selfcare.user.client.EventHubRestClient; import it.pagopa.selfcare.user.conf.CloudTemplateLoader; import it.pagopa.selfcare.user.entity.UserInstitution; -import it.pagopa.selfcare.user.model.LoggedUser; -import it.pagopa.selfcare.user.model.OnboardedProduct; -import it.pagopa.selfcare.user.model.UserNotificationToSend; +import it.pagopa.selfcare.user.model.*; import it.pagopa.selfcare.user.model.constants.OnboardedProductState; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Produces; @@ -35,7 +34,9 @@ import java.util.UUID; import static it.pagopa.selfcare.user.model.constants.EventsMetric.EVENTS_USER_INSTITUTION_PRODUCT_SUCCESS; +import static it.pagopa.selfcare.user.model.constants.EventsMetric.FD_EVENTS_USER_INSTITUTION_PRODUCT_SUCCESS; import static it.pagopa.selfcare.user.model.constants.EventsName.EVENT_USER_MS_NAME; +import static it.pagopa.selfcare.user.model.constants.EventsName.FD_EVENT_USER_MS_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; @@ -51,7 +52,11 @@ class UserNotificationServiceImplTest { @InjectMock @RestClient private EventHubRestClient eventHubRestClient; - + + @InjectMock + @RestClient + private EventHubFdRestClient eventHubFdRestClient; + @InjectMock TelemetryClient telemetryClient; @@ -128,7 +133,7 @@ void testSendMailNotificationForActivateUserProduct() throws IOException { when(freemarkerConfig.getTemplate(anyString())).thenReturn(mock(freemarker.template.Template.class)); when(freemarkerConfig.getTemplateLoader()).thenReturn(cloudTemplateLoader); - UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, telemetryClient); + UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, true, telemetryClient); when(mailService.sendMail(anyString(), anyString(), anyString())).thenReturn(Uni.createFrom().voidItem()); userNotificationServiceImpl.sendEmailNotification( @@ -157,7 +162,7 @@ void testSendMailNotificationForDeleteUserProduct() throws IOException { when(freemarkerConfig.getTemplate(anyString())).thenReturn(mock(freemarker.template.Template.class)); when(freemarkerConfig.getTemplateLoader()).thenReturn(cloudTemplateLoader); - UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, telemetryClient); + UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, true, telemetryClient); when(mailService.sendMail(anyString(), anyString(), anyString())).thenReturn(Uni.createFrom().voidItem()); userNotificationServiceImpl.sendEmailNotification( @@ -187,7 +192,7 @@ void testSendMailNotificationForSuspendUserProduct() throws IOException { when(freemarkerConfig.getTemplate(anyString())).thenReturn(mock(freemarker.template.Template.class)); when(freemarkerConfig.getTemplateLoader()).thenReturn(cloudTemplateLoader); - UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, telemetryClient); + UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, true, telemetryClient); when(mailService.sendMail(anyString(), anyString(), anyString())).thenReturn(Uni.createFrom().voidItem()); userNotificationServiceImpl.sendEmailNotification( @@ -216,7 +221,7 @@ void testSendMailNotificationForRejectUserProduct() throws IOException { when(freemarkerConfig.getTemplate(anyString())).thenReturn(mock(freemarker.template.Template.class)); when(freemarkerConfig.getTemplateLoader()).thenReturn(cloudTemplateLoader); - UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, telemetryClient); + UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, true, telemetryClient); userNotificationServiceImpl.sendEmailNotification( userResource, @@ -244,7 +249,7 @@ void testSendMailNotificationWithNullInstitutionDescription() throws IOException when(freemarkerConfig.getTemplate(anyString())).thenReturn(mock(freemarker.template.Template.class)); when(freemarkerConfig.getTemplateLoader()).thenReturn(cloudTemplateLoader); - UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, telemetryClient); + UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, true, telemetryClient); when(mailService.sendMail(anyString(), anyString(), anyString())).thenReturn(Uni.createFrom().voidItem()); userNotificationServiceImpl.sendEmailNotification( @@ -300,7 +305,7 @@ void testSendMailNotificationWithNullInstitutionDescription() throws IOException @Test - void testSendKafkaNotification(){ + void testSendKafkaNotification() { UserNotificationToSend userNotificationToSend = new UserNotificationToSend(); userNotificationToSend.setId("userId"); @@ -316,6 +321,26 @@ void testSendKafkaNotification(){ assertEquals(EVENTS_USER_INSTITUTION_PRODUCT_SUCCESS, metricsName.getValue().keySet().stream().findFirst().orElse(null)); } + + @Test + void testSendSelfcareFdNotification(){ + + FdUserNotificationToSend userNotificationToSend = new FdUserNotificationToSend(); + userNotificationToSend.setId("userId"); + + when(eventHubFdRestClient.sendMessage(any())).thenReturn(Uni.createFrom().voidItem()); + + UniAssertSubscriber subscriber = userNotificationService.sendSelfcareFdUserNotification( + userNotificationToSend, NotificationUserType.ACTIVE_USER + ).subscribe().withSubscriber(UniAssertSubscriber.create()); + subscriber.assertCompleted(); + verify(eventHubFdRestClient, times(1)).sendMessage(userNotificationToSend); + ArgumentCaptor> metricsName = ArgumentCaptor.forClass(Map.class); + verify(telemetryClient, times(1)).trackEvent(eq(FD_EVENT_USER_MS_NAME), any(), metricsName.capture()); + assertEquals(FD_EVENTS_USER_INSTITUTION_PRODUCT_SUCCESS, metricsName.getValue().keySet().stream().findFirst().orElse(null)); + + } + @Test void testSendCreateUserNotification() throws IOException { String loggedUserName = "loggedUserName"; @@ -330,7 +355,7 @@ void testSendCreateUserNotification() throws IOException { when(freemarkerConfig.getTemplate(anyString())).thenReturn(mock(freemarker.template.Template.class)); when(freemarkerConfig.getTemplateLoader()).thenReturn(cloudTemplateLoader); - UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, telemetryClient); + UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, true, telemetryClient); when(mailService.sendMail(anyString(), anyString(), anyString())).thenReturn(Uni.createFrom().voidItem()); List roleLabels = List.of("code2", "code3"); @@ -362,7 +387,7 @@ void testSendCreateUserNotificationWith2RoleLabel() throws IOException { when(freemarkerConfig.getTemplate(anyString())).thenReturn(mock(freemarker.template.Template.class)); when(freemarkerConfig.getTemplateLoader()).thenReturn(cloudTemplateLoader); - UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, telemetryClient); + UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, true, telemetryClient); when(mailService.sendMail(anyString(), anyString(), anyString())).thenReturn(Uni.createFrom().voidItem()); List roleLabels = List.of("code2", "code3"); @@ -394,10 +419,10 @@ void testSendCreateUserNotificationWithRoleNotFound() throws IOException { when(freemarkerConfig.getTemplate(anyString())).thenReturn(mock(freemarker.template.Template.class)); when(freemarkerConfig.getTemplateLoader()).thenReturn(cloudTemplateLoader); - UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, telemetryClient); + UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, true, telemetryClient); when(mailService.sendMail(anyString(), anyString(), anyString())).thenReturn(Uni.createFrom().voidItem()); - List roleLabels = List.of("code5","code6"); + List roleLabels = List.of("code5", "code6"); userNotificationServiceImpl.sendCreateUserNotification( userInstitution.getInstitutionDescription(), roleLabels, @@ -426,7 +451,7 @@ void testSendCreateUserNotificationWithNullInstitutionDescription() throws IOExc when(freemarkerConfig.getTemplate(anyString())).thenReturn(mock(freemarker.template.Template.class)); when(freemarkerConfig.getTemplateLoader()).thenReturn(cloudTemplateLoader); - UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, telemetryClient); + UserNotificationServiceImpl userNotificationServiceImpl = new UserNotificationServiceImpl(freemarkerConfig, cloudTemplateLoader, mailService, true, true, telemetryClient); when(mailService.sendMail(anyString(), anyString(), anyString())).thenReturn(Uni.createFrom().voidItem()); List roleLabels = List.of("label"); diff --git a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserRegistryServiceTest.java b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserRegistryServiceTest.java index 586c4f1d..59bd9cdf 100644 --- a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserRegistryServiceTest.java +++ b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserRegistryServiceTest.java @@ -9,9 +9,7 @@ import io.smallrye.mutiny.helpers.test.UniAssertSubscriber; import io.smallrye.reactive.messaging.memory.InMemoryConnector; import it.pagopa.selfcare.user.entity.UserInstitution; -import it.pagopa.selfcare.user.model.OnboardedProduct; -import it.pagopa.selfcare.user.model.UpdateUserRequest; -import it.pagopa.selfcare.user.model.UserNotificationToSend; +import it.pagopa.selfcare.user.model.*; import jakarta.inject.Inject; import jakarta.ws.rs.core.Response; import org.bson.types.ObjectId; @@ -19,13 +17,19 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.openapi.quarkus.user_registry_json.model.*; +import org.openapi.quarkus.user_registry_json.model.MutableUserFieldsDto; +import org.openapi.quarkus.user_registry_json.model.SaveUserDto; +import org.openapi.quarkus.user_registry_json.model.UserId; +import org.openapi.quarkus.user_registry_json.model.UserResource; +import org.openapi.quarkus.user_registry_json.model.UserSearchDto; import java.util.List; import java.util.Map; import java.util.UUID; import static io.smallrye.common.constraint.Assert.assertNotNull; +import static it.pagopa.selfcare.user.model.constants.OnboardedProductState.ACTIVE; +import static it.pagopa.selfcare.user.model.constants.OnboardedProductState.DELETED; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; @@ -208,6 +212,114 @@ void testSendUpdateUserNotificationToQueue() { subscriber.assertCompleted(); } + @Test + void testSendUpdateUserNotificationToFdQueue() { + final String userId = userResource.getId().toString(); + final String institutionId = "institutionId"; + when(userNotificationService.sendKafkaNotification(any(UserNotificationToSend.class))).thenReturn(Uni.createFrom().item(new UserNotificationToSend())); + userInstitution.getProducts().get(0).setProductId("prod-fd"); + userInstitution.getProducts().get(0).setStatus(ACTIVE); + + UpdateUserRequest updateUserRequest = new UpdateUserRequest(); + updateUserRequest.setEmail("test2@test.it"); + when(userInstitutionService.findAllWithFilter(anyMap())).thenReturn(Multi.createFrom().item(userInstitution)); + when(userInstitutionService.persistOrUpdate(any(UserInstitution.class))).thenReturn(Uni.createFrom().item(userInstitution)); + when(userRegistryApi.updateUsingPATCH(eq(userId), any(MutableUserFieldsDto.class))).thenReturn(Uni.createFrom().item(Response.accepted().build())); + when(userRegistryApi.findByIdUsingGET(USERS_FIELD_LIST_WITHOUT_FISCAL_CODE, userId)).thenReturn(Uni.createFrom().item(userResource)); + + UniAssertSubscriber> subscriber = userRegistryService.updateUserRegistry(updateUserRequest, userId, institutionId) + .subscribe().withSubscriber(UniAssertSubscriber.create()); + subscriber.assertCompleted(); + verify(userNotificationService, times(1)).sendSelfcareFdUserNotification(any(FdUserNotificationToSend.class), eq(NotificationUserType.DELETE_USER)); + verify(userNotificationService, times(1)).sendSelfcareFdUserNotification(any(FdUserNotificationToSend.class), eq(NotificationUserType.ACTIVE_USER)); + } + + @Test + void testSendUpdateUserNotificationToFdQueue2() { + final String userId = userResource.getId().toString(); + final String institutionId = "institutionId"; + when(userNotificationService.sendKafkaNotification(any(UserNotificationToSend.class))).thenReturn(Uni.createFrom().item(new UserNotificationToSend())); + userInstitution.getProducts().get(0).setProductId("prod-fd-garantito"); + userInstitution.getProducts().get(0).setStatus(ACTIVE); + + UpdateUserRequest updateUserRequest = new UpdateUserRequest(); + updateUserRequest.setEmail("test2@test.it"); + when(userInstitutionService.findAllWithFilter(anyMap())).thenReturn(Multi.createFrom().item(userInstitution)); + when(userInstitutionService.persistOrUpdate(any(UserInstitution.class))).thenReturn(Uni.createFrom().item(userInstitution)); + when(userRegistryApi.updateUsingPATCH(eq(userId), any(MutableUserFieldsDto.class))).thenReturn(Uni.createFrom().item(Response.accepted().build())); + when(userRegistryApi.findByIdUsingGET(USERS_FIELD_LIST_WITHOUT_FISCAL_CODE, userId)).thenReturn(Uni.createFrom().item(userResource)); + + UniAssertSubscriber> subscriber = userRegistryService.updateUserRegistry(updateUserRequest, userId, institutionId) + .subscribe().withSubscriber(UniAssertSubscriber.create()); + subscriber.assertCompleted(); + verify(userNotificationService, times(1)).sendSelfcareFdUserNotification(any(FdUserNotificationToSend.class), eq(NotificationUserType.DELETE_USER)); + verify(userNotificationService, times(1)).sendSelfcareFdUserNotification(any(FdUserNotificationToSend.class), eq(NotificationUserType.ACTIVE_USER)); + } + + @Test + void testNotSendUpdateUserNotificationToFdQueue() { + final String userId = userResource.getId().toString(); + final String institutionId = "institutionId"; + when(userNotificationService.sendKafkaNotification(any(UserNotificationToSend.class))).thenReturn(Uni.createFrom().item(new UserNotificationToSend())); + userInstitution.getProducts().get(0).setProductId("prod-fd-garantito"); + userInstitution.getProducts().get(0).setStatus(DELETED); + + UpdateUserRequest updateUserRequest = new UpdateUserRequest(); + updateUserRequest.setEmail("test2@test.it"); + when(userInstitutionService.findAllWithFilter(anyMap())).thenReturn(Multi.createFrom().item(userInstitution)); + when(userInstitutionService.persistOrUpdate(any(UserInstitution.class))).thenReturn(Uni.createFrom().item(userInstitution)); + when(userRegistryApi.updateUsingPATCH(eq(userId), any(MutableUserFieldsDto.class))).thenReturn(Uni.createFrom().item(Response.accepted().build())); + when(userRegistryApi.findByIdUsingGET(USERS_FIELD_LIST_WITHOUT_FISCAL_CODE, userId)).thenReturn(Uni.createFrom().item(userResource)); + + UniAssertSubscriber> subscriber = userRegistryService.updateUserRegistry(updateUserRequest, userId, institutionId) + .subscribe().withSubscriber(UniAssertSubscriber.create()); + subscriber.assertCompleted(); + verify(userNotificationService, times(0)).sendSelfcareFdUserNotification(any(FdUserNotificationToSend.class), any()); + } + + @Test + void testNotSendUpdateUserNotificationToFdQueueForUnchangedMail() { + final String userId = userResource.getId().toString(); + final String institutionId = "institutionId"; + when(userNotificationService.sendKafkaNotification(any(UserNotificationToSend.class))).thenReturn(Uni.createFrom().item(new UserNotificationToSend())); + userInstitution.getProducts().get(0).setProductId("prod-fd-garantito"); + userInstitution.getProducts().get(0).setStatus(DELETED); + userInstitution.setUserMailUuid(userMailUuidDefault); + + UpdateUserRequest updateUserRequest = new UpdateUserRequest(); + updateUserRequest.setEmail("test@test.it"); + when(userInstitutionService.findAllWithFilter(anyMap())).thenReturn(Multi.createFrom().item(userInstitution)); + when(userInstitutionService.persistOrUpdate(any(UserInstitution.class))).thenReturn(Uni.createFrom().item(userInstitution)); + when(userRegistryApi.updateUsingPATCH(eq(userId), any(MutableUserFieldsDto.class))).thenReturn(Uni.createFrom().item(Response.accepted().build())); + when(userRegistryApi.findByIdUsingGET(USERS_FIELD_LIST_WITHOUT_FISCAL_CODE, userId)).thenReturn(Uni.createFrom().item(userResource)); + + UniAssertSubscriber> subscriber = userRegistryService.updateUserRegistry(updateUserRequest, userId, institutionId) + .subscribe().withSubscriber(UniAssertSubscriber.create()); + subscriber.assertCompleted(); + verify(userNotificationService, times(0)).sendSelfcareFdUserNotification(any(FdUserNotificationToSend.class), any()); + } + + @Test + void testNotSendUpdateUserNotificationToFdQueueForEmptyUserInstitutions() { + final String userId = userResource.getId().toString(); + final String institutionId = "institutionId"; + when(userNotificationService.sendKafkaNotification(any(UserNotificationToSend.class))).thenReturn(Uni.createFrom().item(new UserNotificationToSend())); + userInstitution.getProducts().get(0).setProductId("prod-fd-garantito"); + userInstitution.getProducts().get(0).setStatus(DELETED); + userInstitution.setUserMailUuid(userMailUuidDefault); + + UpdateUserRequest updateUserRequest = new UpdateUserRequest(); + updateUserRequest.setEmail("test@test.it"); + when(userInstitutionService.findAllWithFilter(anyMap())).thenReturn(Multi.createFrom().empty()); + when(userRegistryApi.updateUsingPATCH(eq(userId), any(MutableUserFieldsDto.class))).thenReturn(Uni.createFrom().item(Response.accepted().build())); + when(userRegistryApi.findByIdUsingGET(USERS_FIELD_LIST_WITHOUT_FISCAL_CODE, userId)).thenReturn(Uni.createFrom().item(userResource)); + + UniAssertSubscriber> subscriber = userRegistryService.updateUserRegistry(updateUserRequest, userId, institutionId) + .subscribe().withSubscriber(UniAssertSubscriber.create()); + subscriber.assertCompleted(); + verify(userNotificationService, times(0)).sendSelfcareFdUserNotification(any(FdUserNotificationToSend.class), any()); + } + @Test void testSendUpdateUserNotificationToQueue2() { when(userNotificationService.sendKafkaNotification(any(UserNotificationToSend.class))).thenReturn(Uni.createFrom().item(new UserNotificationToSend())); diff --git a/apps/user-ms/src/test/resources/application.properties b/apps/user-ms/src/test/resources/application.properties index dc67087b..a3905401 100644 --- a/apps/user-ms/src/test/resources/application.properties +++ b/apps/user-ms/src/test/resources/application.properties @@ -5,4 +5,5 @@ rest-client.event-hub.uri=baseUri eventhub.rest-client.keyName=keyName eventhub.rest-client.key=key -user-ms.eventhub.users.enabled=true \ No newline at end of file +user-ms.eventhub.users.enabled=true +user-ms.eventhub.selfcarefd.enabled=true \ No newline at end of file diff --git a/infra/container_apps/user-ms/env/dev/terraform.tfvars b/infra/container_apps/user-ms/env/dev/terraform.tfvars index 672f3aaa..e2194d0f 100644 --- a/infra/container_apps/user-ms/env/dev/terraform.tfvars +++ b/infra/container_apps/user-ms/env/dev/terraform.tfvars @@ -46,16 +46,32 @@ app_settings = [ }, { name = "EVENT_HUB_BASE_PATH" - value = "https://selc-d-eventhub-ns.servicebus.windows.net/sc-users" + value = "https://selc-d-eventhub-ns.servicebus.windows.net/" + }, + { + name = "EVENT_HUB_SC_USERS_TOPIC" + value = "sc-users" + }, + { + name = "EVENT_HUB_SELFCARE_FD_TOPIC" + value = "selfcare-fd" }, { name = "SHARED_ACCESS_KEY_NAME" value = "selfcare-wo" }, + { + name = "FD_SHARED_ACCESS_KEY_NAME" + value = "external-interceptor-wo" + }, { name = "USER_MS_EVENTHUB_USERS_ENABLED" value = true }, + { + name = "USER_MS_EVENTHUB_SELFCARE_FD_ENABLED" + value = true + }, { name = "USER_MS_RETRY_MIN_BACKOFF" value = 5 @@ -81,5 +97,6 @@ secrets_names = { "BLOB-STORAGE-PRODUCT-CONNECTION-STRING" = "blob-storage-product-connection-string" "BLOB-STORAGE-CONTRACT-CONNECTION-STRING" = "blob-storage-contract-connection-string" "EVENTHUB-SC-USERS-SELFCARE-WO-KEY-LC" = "eventhub-sc-users-selfcare-wo-key-lc" + "EVENTHUB_SELFCARE_FD_EXTERNAL_KEY_LC" = "eventhub-selfcare-fd-external-interceptor-wo-key-lc" } diff --git a/infra/container_apps/user-ms/env/prod/terraform.tfvars b/infra/container_apps/user-ms/env/prod/terraform.tfvars index 2f280b5d..f840f8be 100644 --- a/infra/container_apps/user-ms/env/prod/terraform.tfvars +++ b/infra/container_apps/user-ms/env/prod/terraform.tfvars @@ -40,14 +40,34 @@ app_settings = [ name = "APPLICATIONINSIGHTS_ROLE_NAME" value = "user-ms", }, + { + name = "EVENT_HUB_BASE_PATH" + value = "https://selc-p-eventhub-ns.servicebus.windows.net/" + }, + { + name = "EVENT_HUB_SC_USERS_TOPIC" + value = "sc-users" + }, + { + name = "EVENT_HUB_SELFCARE_FD_TOPIC" + value = "selfcare-fd" + }, { name = "SHARED_ACCESS_KEY_NAME" value = "selfcare-wo" }, + { + name = "FD_SHARED_ACCESS_KEY_NAME" + value = "external-interceptor-wo" + }, { name = "USER_MS_EVENTHUB_USERS_ENABLED" value = true }, + { + name = "USER_MS_EVENTHUB_SELFCARE_FD_ENABLED" + value = true + }, { name = "STORAGE_CONTAINER_PRODUCT" value = "selc-p-product" @@ -56,10 +76,6 @@ app_settings = [ name = "USER_REGISTRY_URL" value = "https://api.pdv.pagopa.it/user-registry/v1" }, - { - name = "EVENT_HUB_BASE_PATH" - value = "https://selc-p-eventhub-ns.servicebus.windows.net/sc-users" - }, { name = "USER_MS_RETRY_MIN_BACKOFF" value = 5 @@ -85,4 +101,5 @@ secrets_names = { "BLOB-STORAGE-PRODUCT-CONNECTION-STRING" = "blob-storage-product-connection-string" "BLOB-STORAGE-CONTRACT-CONNECTION-STRING" = "blob-storage-contract-connection-string" "EVENTHUB-SC-USERS-SELFCARE-WO-KEY-LC" = "eventhub-sc-users-selfcare-wo-key-lc" + "EVENTHUB_SELFCARE_FD_EXTERNAL_KEY_LC" = "eventhub-selfcare-fd-external-interceptor-wo-key-lc" } diff --git a/infra/container_apps/user-ms/env/uat/terraform.tfvars b/infra/container_apps/user-ms/env/uat/terraform.tfvars index 9241d09c..f2e38909 100644 --- a/infra/container_apps/user-ms/env/uat/terraform.tfvars +++ b/infra/container_apps/user-ms/env/uat/terraform.tfvars @@ -33,16 +33,32 @@ app_settings = [ }, { name = "EVENT_HUB_BASE_PATH" - value = "https://selc-u-eventhub-ns.servicebus.windows.net/sc-users" + value = "https://selc-u-eventhub-ns.servicebus.windows.net/" + }, + { + name = "EVENT_HUB_SC_USERS_TOPIC" + value = "sc-users" + }, + { + name = "EVENT_HUB_SELFCARE_FD_TOPIC" + value = "selfcare-fd" }, { name = "SHARED_ACCESS_KEY_NAME" value = "selfcare-wo" }, + { + name = "FD_SHARED_ACCESS_KEY_NAME" + value = "external-interceptor-wo" + }, { name = "USER_MS_EVENTHUB_USERS_ENABLED" value = true }, + { + name = "USER_MS_EVENTHUB_SELFCARE_FD_ENABLED" + value = true + }, { name = "STORAGE_CONTAINER_PRODUCT" value = "selc-u-product" @@ -73,4 +89,5 @@ secrets_names = { "BLOB-STORAGE-PRODUCT-CONNECTION-STRING" = "blob-storage-product-connection-string" "BLOB-STORAGE-CONTRACT-CONNECTION-STRING" = "blob-storage-contract-connection-string" "EVENTHUB-SC-USERS-SELFCARE-WO-KEY-LC" = "eventhub-sc-users-selfcare-wo-key-lc" + "EVENTHUB_SELFCARE_FD_EXTERNAL_KEY_LC" = "eventhub-selfcare-fd-external-interceptor-wo-key-lc" } diff --git a/libs/user-sdk-model/src/main/java/it.pagopa.selfcare.user.model/constants/EventsName.java b/libs/user-sdk-model/src/main/java/it.pagopa.selfcare.user.model/constants/EventsName.java index 820ae2aa..1a3a314d 100644 --- a/libs/user-sdk-model/src/main/java/it.pagopa.selfcare.user.model/constants/EventsName.java +++ b/libs/user-sdk-model/src/main/java/it.pagopa.selfcare.user.model/constants/EventsName.java @@ -6,5 +6,6 @@ public class EventsName { public static final String EVENT_USER_CDC_NAME = "USER_CDC"; public static final String FD_EVENT_USER_CDC_NAME = "FD_USER_CDC"; + public static final String FD_EVENT_USER_MS_NAME = "FD_USER_MS"; public static final String EVENT_USER_GROUP_CDC_NAME = "USER_GROUP_CDC"; }