diff --git a/apps/dolly-backend/config.test.yml b/apps/dolly-backend/config.test.yml index 148ba11ef25..44a619bad94 100644 --- a/apps/dolly-backend/config.test.yml +++ b/apps/dolly-backend/config.test.yml @@ -33,14 +33,12 @@ spec: cluster: dev-gcp outbound: rules: - - application: generer-navn-service - application: testnav-amelding-service - application: testnav-arbeidsforhold-service - application: testnav-inntektsmelding-service - application: testnav-miljoer-service - application: testnav-organisasjon-forvalter - application: testnav-organisasjon-service - - application: testnav-organisasjon-tilgang-service - application: testnav-pdl-forvalter-dev - application: testnav-person-service - application: testnav-synt-sykemelding-api @@ -64,7 +62,6 @@ spec: - host: testnav-pdl-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io - host: testnav-skjermingsregister-proxy.dev-fss-pub.nais.io - - host: testnav-statisk-data-forvalter-proxy.dev-fss-pub.nais.io - host: testnav-udistub-proxy.dev-fss-pub.nais.io - host: tps-forvalteren-dev-proxy.dev-fss-pub.nais.io webproxy: true diff --git a/apps/dolly-backend/config.yml b/apps/dolly-backend/config.yml index f40ca434ef0..bc6f805448a 100644 --- a/apps/dolly-backend/config.yml +++ b/apps/dolly-backend/config.yml @@ -40,15 +40,12 @@ spec: namespace: navdig outbound: rules: - - application: generer-navn-service - application: testnav-amelding-service - application: testnav-arbeidsforhold-service - application: testnav-inntektsmelding-service - application: testnav-miljoer-service - application: testnav-organisasjon-forvalter - application: testnav-organisasjon-service - - application: testnav-organisasjon-tilgang-service - cluster: prod-gcp - application: testnav-pdl-forvalter - application: testnav-person-service - application: testnav-synt-sykemelding-api @@ -72,7 +69,6 @@ spec: - host: testnav-pdl-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io - host: testnav-skjermingsregister-proxy.dev-fss-pub.nais.io - - host: testnav-statisk-data-forvalter-proxy.dev-fss-pub.nais.io - host: testnav-udistub-proxy.dev-fss-pub.nais.io - host: tps-forvalteren-proxy.dev-fss-pub.nais.io webproxy: true diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/ArbeidsplassenCVConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/ArbeidsplassenCVConsumer.java index 3d794c9401e..faf38ab8744 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/ArbeidsplassenCVConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/ArbeidsplassenCVConsumer.java @@ -4,7 +4,6 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.ConsumerStatus; import no.nav.dolly.bestilling.arbeidsplassencv.command.ArbeidsplassenDeleteCVCommand; -import no.nav.dolly.bestilling.arbeidsplassencv.command.ArbeidsplassenGetCVCommand; import no.nav.dolly.bestilling.arbeidsplassencv.command.ArbeidsplassenGodtaHjemmelCommand; import no.nav.dolly.bestilling.arbeidsplassencv.command.ArbeidsplassenGodtaVilkaarCommand; import no.nav.dolly.bestilling.arbeidsplassencv.command.ArbeidsplassenPostPersonCommand; @@ -48,14 +47,6 @@ public ArbeidsplassenCVConsumer( .build(); } - @Timed(name = "providers", tags = { "operation", "arbeidsplassen_getCV" }) - public Flux hentCV(String ident, String uuid) { - - return tokenService.exchange(serviceProperties) - .flatMapMany(token -> new ArbeidsplassenGetCVCommand(webClient, ident, uuid, token.getTokenValue()).call()) - .doOnNext(resultat -> log.info("Hentet CV for ident {} {}", ident, resultat)); - } - @Timed(name = "providers", tags = { "operation", "arbeidsplassen_oppdaterCV" }) public Flux oppdaterCV(String ident, PAMCVDTO arbeidsplassenCV, String uuid) { diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGetCVCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGetCVCommand.java deleted file mode 100644 index 6d5aac9de9d..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGetCVCommand.java +++ /dev/null @@ -1,59 +0,0 @@ -package no.nav.dolly.bestilling.arbeidsplassencv.command; - -import com.fasterxml.jackson.databind.JsonNode; -import lombok.RequiredArgsConstructor; -import no.nav.dolly.bestilling.arbeidsplassencv.dto.ArbeidsplassenCVStatusDTO; -import no.nav.dolly.util.WebClientFilter; -import no.nav.testnav.libs.securitycore.config.UserConstant; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.concurrent.Callable; - -import static no.nav.dolly.bestilling.arbeidsplassencv.ArbeidsplassenCVConsumer.ARBEIDSPLASSEN_CALL_ID; -import static no.nav.dolly.util.TokenXUtil.getUserJwt; - -@RequiredArgsConstructor -public class ArbeidsplassenGetCVCommand implements Callable> { - - private static final String ARBEIDSPLASSEN_CV_URL = "/rest/v2/cv"; - private static final String FNR = "fnr"; - - private final WebClient webClient; - private final String ident; - private final String uuid; - private final String token; - - @Override - public Flux call() { - - return webClient.get().uri( - uriBuilder -> uriBuilder - .path(ARBEIDSPLASSEN_CV_URL) - .build()) - .header(FNR, ident) - .header(ARBEIDSPLASSEN_CALL_ID, uuid) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) - .header(UserConstant.USER_HEADER_JWT, getUserJwt()) - .retrieve() - .bodyToFlux(JsonNode.class) - .map(resultat -> ArbeidsplassenCVStatusDTO.builder() - .jsonNode(resultat) - .status(HttpStatus.OK) - .uuid(uuid) - .build()) - .doOnError(WebClientFilter::logErrorMessage) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)) - .onErrorResume(throwable -> Mono.just(ArbeidsplassenCVStatusDTO.builder() - .feilmelding(WebClientFilter.getMessage(throwable)) - .status(WebClientFilter.getStatus(throwable)) - .uuid(uuid) - .build())); - } -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/InntektstubConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/InntektstubConsumer.java index adfc6981b4a..e1ad52933c4 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/InntektstubConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/InntektstubConsumer.java @@ -7,33 +7,24 @@ import no.nav.dolly.bestilling.inntektstub.command.InntektstubGetCommand; import no.nav.dolly.bestilling.inntektstub.command.InntektstubPostCommand; import no.nav.dolly.bestilling.inntektstub.domain.Inntektsinformasjon; -import no.nav.dolly.bestilling.inntektstub.domain.ValiderInntekt; import no.nav.dolly.config.credentials.InntektstubProxyProperties; import no.nav.dolly.metrics.Timed; -import no.nav.dolly.util.WebClientFilter; -import no.nav.testnav.libs.securitycore.config.UserConstant; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.HttpHeaders; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; import java.time.Duration; import java.util.List; import static no.nav.dolly.util.JacksonExchangeStrategyUtil.getJacksonStrategy; -import static no.nav.dolly.util.TokenXUtil.getUserJwt; @Service @Slf4j public class InntektstubConsumer implements ConsumerStatus { - private static final String VALIDER_INNTEKTER_URL = "/api/v2/valider"; - private static final int BLOCK_SIZE = 10; private final WebClient webClient; @@ -83,24 +74,6 @@ public Flux postInntekter(List inntekt .flatMapMany(token -> new InntektstubPostCommand(webClient, inntektsinformasjon, token.getTokenValue()).call()); } - @Timed(name = "providers", tags = { "operation", "inntk_validerInntekt" }) - public ResponseEntity validerInntekter(ValiderInntekt validerInntekt) { - - return tokenService.exchange(serviceProperties) - .flatMap(token -> webClient.post() - .uri(uriBuilder -> uriBuilder - .path(VALIDER_INNTEKTER_URL) - .build()) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + token.getTokenValue()) - .header(UserConstant.USER_HEADER_JWT, getUserJwt()) - .bodyValue(validerInntekt) - .retrieve() - .toEntity(Object.class) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException))) - .block(); - } - @Override public String serviceUrl() { return serviceProperties.getUrl(); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java index b4b9fa8435e..18a16dadfc1 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java @@ -1,15 +1,12 @@ package no.nav.dolly.bestilling.pensjonforvalter; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import io.netty.channel.ChannelOption; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.ConsumerStatus; import no.nav.dolly.bestilling.pensjonforvalter.command.AnnullerSamboerCommand; import no.nav.dolly.bestilling.pensjonforvalter.command.HentMiljoerCommand; -import no.nav.dolly.bestilling.pensjonforvalter.command.HentPoppInntekterCommand; import no.nav.dolly.bestilling.pensjonforvalter.command.HentSamboerCommand; -import no.nav.dolly.bestilling.pensjonforvalter.command.HentTpForholdCommand; import no.nav.dolly.bestilling.pensjonforvalter.command.LagreAlderspensjonCommand; import no.nav.dolly.bestilling.pensjonforvalter.command.LagrePoppInntektCommand; import no.nav.dolly.bestilling.pensjonforvalter.command.LagreSamboerCommand; @@ -141,14 +138,6 @@ public Flux lagreUforetrygd(PensjonUforetrygdRequest r .flatMapMany(token -> new LagreUforetrygdCommand(webClient, token.getTokenValue(), request).call()); } - @Timed(name = "providers", tags = {"operation", "pen_getInntekter"}) - public JsonNode getInntekter(String ident, String miljoe) { - - return tokenService.exchange(serviceProperties) - .flatMap(token -> new HentPoppInntekterCommand(webClient, token.getTokenValue(), ident, miljoe).call()) - .block(); - } - @Timed(name = "providers", tags = {"operation", "pen_lagreTpForhold"}) public Flux lagreTpForhold(PensjonTpForholdRequest pensjonTpForholdRequest) { @@ -169,14 +158,6 @@ public void sletteTpForhold(List identer) { .subscribe(response -> log.info("Slettet mot PESYS (tp) i alle miljoer")); } - @Timed(name = "providers", tags = {"operation", "pen_getTpForhold"}) - public JsonNode getTpForhold(String ident, String miljoe) { - - return tokenService.exchange(serviceProperties) - .flatMap(token -> new HentTpForholdCommand(webClient, token.getTokenValue(), ident, miljoe).call()) - .block(); - } - @Timed(name = "providers", tags = {"operation", "pen_lagreTpYtelse"}) public Flux lagreTpYtelse(PensjonTpYtelseRequest pensjonTpYtelseRequest) { diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentTpForholdCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentTpForholdCommand.java deleted file mode 100644 index f5c28b40351..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentTpForholdCommand.java +++ /dev/null @@ -1,56 +0,0 @@ -package no.nav.dolly.bestilling.pensjonforvalter.command; - -import com.fasterxml.jackson.databind.JsonNode; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; -import no.nav.testnav.libs.securitycore.config.UserConstant; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.concurrent.Callable; - -import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; -import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID; -import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID; -import static no.nav.dolly.util.CallIdUtil.generateCallId; -import static no.nav.dolly.util.TokenXUtil.getUserJwt; -import static org.springframework.http.HttpHeaders.AUTHORIZATION; - -@Slf4j -@RequiredArgsConstructor -public class HentTpForholdCommand implements Callable> { - - private static final String PENSJON_TP_FORHOLD_URL = "/api/v1/tp/forhold"; - - private static final String FNR_QUERY = "fnr"; - private static final String MILJO_QUERY = "miljo"; - - private final WebClient webClient; - - private final String token; - - private final String ident; - private final String miljoe; - - public Mono call() { - return webClient - .get() - .uri(uriBuilder -> uriBuilder - .path(PENSJON_TP_FORHOLD_URL) - .queryParam(FNR_QUERY, ident) - .queryParam(MILJO_QUERY, miljoe) - .build()) - .header(AUTHORIZATION, "Bearer " + token) - .header(UserConstant.USER_HEADER_JWT, getUserJwt()) - .header(HEADER_NAV_CALL_ID, generateCallId()) - .header(HEADER_NAV_CONSUMER_ID, CONSUMER) - .retrieve() - .bodyToMono(JsonNode.class) - .doOnError(WebClientFilter::logErrorMessage) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)); - } -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/SkjermingsRegisterConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/SkjermingsRegisterConsumer.java index bd764513c38..933d266969a 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/SkjermingsRegisterConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/SkjermingsRegisterConsumer.java @@ -46,14 +46,6 @@ public SkjermingsRegisterConsumer( .build(); } - @Timed(name = "providers", tags = {"operation", "skjermingsdata-hent"}) - public SkjermingDataResponse getSkjerming(String ident) { - - return tokenService.exchange(serviceProperties) - .flatMap(token -> new SkjermingsregisterGetCommand(webClient, ident, token.getTokenValue()).call()) - .block(); - } - @Timed(name = "providers", tags = {"operation", "skjermingsdata-slett"}) public Mono> deleteSkjerming(List identer) { diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/OrganisasjonTilgangProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/OrganisasjonTilgangProperties.java deleted file mode 100644 index 7bd126b886e..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/OrganisasjonTilgangProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-tilgang-service") -public class OrganisasjonTilgangProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/ProfilApiProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/ProfilApiProperties.java deleted file mode 100644 index f31cb7971f8..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/ProfilApiProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-profil-api") -public class ProfilApiProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/StatiskDataForvalterProxyProperties.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/StatiskDataForvalterProxyProperties.java deleted file mode 100644 index 4e400940c82..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/StatiskDataForvalterProxyProperties.java +++ /dev/null @@ -1,10 +0,0 @@ -package no.nav.dolly.config.credentials; - -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "consumers.testnav-statisk-data-forvalter-proxy") -public class StatiskDataForvalterProxyProperties extends ServerProperties { -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/fastedatasett/DatasettType.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/fastedatasett/DatasettType.java deleted file mode 100644 index 0aa2d3074f8..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/fastedatasett/DatasettType.java +++ /dev/null @@ -1,20 +0,0 @@ -package no.nav.dolly.consumer.fastedatasett; - -import lombok.Getter; -import lombok.NoArgsConstructor; - -@Getter -@NoArgsConstructor -public enum DatasettType { - - AAREG("/aareg"), - EREG("/ereg?gruppe=DOLLY"), - KRR("/krr"), - TPS("/tps"); - - private String url; - - DatasettType(String url) { - this.url = url; - } -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/fastedatasett/FasteDatasettConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/fastedatasett/FasteDatasettConsumer.java deleted file mode 100644 index 43f507309c8..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/fastedatasett/FasteDatasettConsumer.java +++ /dev/null @@ -1,91 +0,0 @@ -package no.nav.dolly.consumer.fastedatasett; - -import com.fasterxml.jackson.databind.JsonNode; -import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.config.credentials.StatiskDataForvalterProxyProperties; -import no.nav.dolly.metrics.Timed; -import no.nav.dolly.util.WebClientFilter; -import no.nav.testnav.libs.securitycore.config.UserConstant; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.HttpHeaders; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.util.retry.Retry; - -import java.time.Duration; - -import static no.nav.dolly.util.TokenXUtil.getUserJwt; - -@Component -@Slf4j -public class FasteDatasettConsumer { - - private static final String REQUEST_URL = "/api/v1/faste-data"; - private static final String GRUPPE_REQUEST_URL = REQUEST_URL + "/tps"; - private static final String EREG_REQUEST_URL = REQUEST_URL + "/ereg"; - private static final String GRUPPE_QUERY = "gruppe"; - private static final String BEARER = "Bearer "; - - private final TokenExchange tokenService; - private final WebClient webClient; - private final ServerProperties serviceProperties; - - public FasteDatasettConsumer( - TokenExchange tokenService, - StatiskDataForvalterProxyProperties serverProperties, - WebClient.Builder webClientBuilder - ) { - this.tokenService = tokenService; - this.serviceProperties = serverProperties; - this.webClient = webClientBuilder - .baseUrl(serverProperties.getUrl()) - .build(); - } - - @Timed(name = "providers", tags = {"operation", "hentFasteDatasett"}) - public ResponseEntity hentDatasett(DatasettType datasettType) { - - return tokenService.exchange(serviceProperties) - .flatMap(token -> webClient.get().uri(uriBuilder -> uriBuilder - .path(REQUEST_URL) - .pathSegment(datasettType.getUrl()) - .build()) - .header(HttpHeaders.AUTHORIZATION, BEARER + token.getTokenValue()) - .header(UserConstant.USER_HEADER_JWT, getUserJwt()) - .retrieve() - .toEntity(JsonNode.class) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException))) - .block(); - } - - @Timed(name = "providers", tags = {"operation", "hentOrgnummer"}) - public ResponseEntity hentOrgnummer() { - - return tokenService.exchange(serviceProperties) - .flatMap(token -> webClient.get().uri(uriBuilder -> uriBuilder - .path(EREG_REQUEST_URL) - .queryParam(GRUPPE_QUERY, "DOLLY") - .build()) - .header(HttpHeaders.AUTHORIZATION, BEARER + token.getTokenValue()) - .header(UserConstant.USER_HEADER_JWT, getUserJwt()) - .retrieve().toEntity(JsonNode.class)) - .block(); - } - - @Timed(name = "providers", tags = {"operation", "hentFasteDatasettGruppe"}) - public ResponseEntity hentDatasettGruppe(String gruppe) { - - return tokenService.exchange(serviceProperties) - .flatMap(token -> webClient.get().uri(uriBuilder -> uriBuilder - .path(GRUPPE_REQUEST_URL) - .queryParam(GRUPPE_QUERY, gruppe) - .build()) - .header(HttpHeaders.AUTHORIZATION, BEARER + token.getTokenValue()) - .header(UserConstant.USER_HEADER_JWT, getUserJwt()) - .retrieve().toEntity(JsonNode.class)) - .block(); - } -} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/generernavn/GenererNavnConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/generernavn/GenererNavnConsumer.java deleted file mode 100644 index 33a5d89654c..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/generernavn/GenererNavnConsumer.java +++ /dev/null @@ -1,64 +0,0 @@ -package no.nav.dolly.consumer.generernavn; - -import lombok.extern.slf4j.Slf4j; -import ma.glasnost.orika.MapperFacade; -import no.nav.dolly.config.credentials.GenererNavnServiceProperties; -import no.nav.dolly.consumer.generernavn.command.GenererNavnCommand; -import no.nav.dolly.domain.PdlPerson.Navn; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.List; -import java.util.UUID; - -import static java.lang.String.format; -import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; - -@Slf4j -@Component -public class GenererNavnConsumer { - - - private final TokenExchange tokenService; - private final WebClient webClient; - private final ServerProperties serviceProperties; - private final MapperFacade mapper; - - public GenererNavnConsumer( - TokenExchange tokenService, - GenererNavnServiceProperties serverProperties, - MapperFacade mapperFacade, - WebClient.Builder webClientBuilder - ) { - this.tokenService = tokenService; - this.serviceProperties = serverProperties; - this.mapper = mapperFacade; - this.webClient = webClientBuilder - .baseUrl(serverProperties.getUrl()) - .build(); - } - - public ResponseEntity> getPersonnavn(Integer antall) { - - - var response = tokenService.exchange(serviceProperties) - .flatMap(token -> new GenererNavnCommand(webClient, token.getTokenValue(), antall, getNavCallId()).call()) - .block(); - - if (!response.hasBody()) { - throw new HttpClientErrorException(HttpStatus.NOT_FOUND); - } - - return ResponseEntity.ok().body(mapper.mapAsList(response.getBody(), Navn.class)); - - } - - private static String getNavCallId() { - return format("%s %s", CONSUMER, UUID.randomUUID()); - } -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/generernavn/command/GenererNavnCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/generernavn/command/GenererNavnCommand.java deleted file mode 100644 index 7b9bf626f8c..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/generernavn/command/GenererNavnCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -package no.nav.dolly.consumer.generernavn.command; - -import com.fasterxml.jackson.databind.JsonNode; -import no.nav.dolly.util.WebClientFilter; -import no.nav.testnav.libs.securitycore.config.UserConstant; -import org.springframework.http.HttpHeaders; -import org.springframework.http.ResponseEntity; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.concurrent.Callable; - -import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; -import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID; -import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID; -import static no.nav.dolly.util.TokenXUtil.getUserJwt; - -public record GenererNavnCommand(WebClient webClient, - String token, Integer antall, - String callId) implements Callable>> { - - private static final String FIKTIVE_NAVN_URL = "/api/v1/navn"; - - @Override - public Mono> call() { - return webClient.get() - .uri(uriBuilder -> uriBuilder.path(FIKTIVE_NAVN_URL) - .queryParam("antall", antall) - .build()) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) - .header(UserConstant.USER_HEADER_JWT, getUserJwt()) - .header(HEADER_NAV_CALL_ID, callId) - .header(HEADER_NAV_CONSUMER_ID, CONSUMER) - .retrieve() - .toEntity(JsonNode.class) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)); - } -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/organisasjon/tilgang/OrganisasjonTilgangConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/organisasjon/tilgang/OrganisasjonTilgangConsumer.java deleted file mode 100644 index 9b7d46da21b..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/organisasjon/tilgang/OrganisasjonTilgangConsumer.java +++ /dev/null @@ -1,44 +0,0 @@ -package no.nav.dolly.consumer.organisasjon.tilgang; - -import no.nav.dolly.config.credentials.OrganisasjonTilgangProperties; -import no.nav.dolly.consumer.organisasjon.tilgang.command.OrganisasjonTilgangGetCommand; -import no.nav.dolly.consumer.organisasjon.tilgang.dto.OrganisasjonTilgang; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.stereotype.Service; -import org.springframework.web.reactive.function.client.ExchangeStrategies; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Flux; - -@Service -public class OrganisasjonTilgangConsumer { - - private WebClient webClient; - private ServerProperties serverProperties; - private TokenExchange tokenExchange; - - public OrganisasjonTilgangConsumer( - TokenExchange tokenExchange, - OrganisasjonTilgangProperties serverProperties, - WebClient.Builder webClientBuilder) { - - this.tokenExchange = tokenExchange; - this.serverProperties = serverProperties; - this.webClient = webClientBuilder - .exchangeStrategies( - ExchangeStrategies - .builder() - .codecs(configurer -> configurer - .defaultCodecs() - .maxInMemorySize(32 * 1024 * 1024)) - .build()) - .baseUrl(serverProperties.getUrl()) - .build(); - } - - public Flux getOrgansisjonTilganger() { - - return tokenExchange.exchange(serverProperties) - .flatMapMany(token -> new OrganisasjonTilgangGetCommand(webClient, token.getTokenValue()).call()); - } -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/organisasjon/tilgang/command/OrganisasjonTilgangGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/organisasjon/tilgang/command/OrganisasjonTilgangGetCommand.java deleted file mode 100644 index 7833b2f25fe..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/organisasjon/tilgang/command/OrganisasjonTilgangGetCommand.java +++ /dev/null @@ -1,38 +0,0 @@ -package no.nav.dolly.consumer.organisasjon.tilgang.command; - -import lombok.RequiredArgsConstructor; -import no.nav.dolly.consumer.organisasjon.tilgang.dto.OrganisasjonTilgang; -import no.nav.dolly.util.WebClientFilter; -import no.nav.testnav.libs.securitycore.config.UserConstant; -import org.springframework.http.HttpHeaders; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Flux; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.concurrent.Callable; - -import static no.nav.dolly.util.TokenXUtil.getUserJwt; - -@RequiredArgsConstructor -public class OrganisasjonTilgangGetCommand implements Callable> { - - private static final String ORGANISASJONER_URL = "/api/v1/organisasjoner"; - - private final WebClient webClient; - private final String token; - - @Override - public Flux call() { - - return webClient - .get() - .uri(uriBuilder -> uriBuilder.path(ORGANISASJONER_URL).build()) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) - .header(UserConstant.USER_HEADER_JWT, getUserJwt()) - .retrieve() - .bodyToFlux(OrganisasjonTilgang.class) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)); - } -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/organisasjon/tilgang/dto/OrganisasjonTilgang.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/organisasjon/tilgang/dto/OrganisasjonTilgang.java deleted file mode 100644 index 7a754d04470..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/organisasjon/tilgang/dto/OrganisasjonTilgang.java +++ /dev/null @@ -1,19 +0,0 @@ -package no.nav.dolly.consumer.organisasjon.tilgang.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class OrganisasjonTilgang { - - private String navn; - private Integer organisasjonsnummer; - private String organisasjonsform; - private LocalDateTime gyldigTil; - private String miljoe; -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/profil/ProfilApiConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/profil/ProfilApiConsumer.java deleted file mode 100644 index c267e5b910a..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/profil/ProfilApiConsumer.java +++ /dev/null @@ -1,66 +0,0 @@ -package no.nav.dolly.consumer.profil; - -import io.swagger.v3.core.util.Json; -import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.config.credentials.ProfilApiProperties; -import no.nav.dolly.consumer.profil.command.GetProfilCommand; -import no.nav.testnav.libs.dto.profil.v1.ProfilDTO; -import no.nav.testnav.libs.securitycore.domain.ServerProperties; -import no.nav.testnav.libs.servletsecurity.action.GetUserInfo; -import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.reactive.function.client.WebClient; - -import java.util.UUID; - -import static java.lang.String.format; -import static java.util.Objects.nonNull; -import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; - -@Slf4j -@Component -public class ProfilApiConsumer { - - private final TokenExchange tokenService; - private final WebClient webClient; - private final ServerProperties serviceProperties; - private final GetUserInfo getUserInfo; - - public ProfilApiConsumer( - TokenExchange tokenService, - ProfilApiProperties serverProperties, - GetUserInfo getUserInfo, - WebClient.Builder webClientBuilder - ) { - this.tokenService = tokenService; - this.serviceProperties = serverProperties; - this.getUserInfo = getUserInfo; - this.webClient = webClientBuilder - .baseUrl(serverProperties.getUrl()) - .build(); - } - - public ResponseEntity getProfil() { - - getUserInfo.call().ifPresent(userInfo -> log.info("UserInfo: {}", Json.pretty(userInfo))); - - var response = tokenService.exchange(serviceProperties) - .flatMap(token -> - new GetProfilCommand(webClient, - token.getTokenValue(), - getNavCallId()).call()) - .block(); - - if (nonNull(response) && !response.hasBody()) { - throw new HttpClientErrorException(HttpStatus.NOT_FOUND); - } - return response; - } - - private static String getNavCallId() { - return format("%s %s", CONSUMER, UUID.randomUUID()); - } -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/profil/command/GetProfilCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/profil/command/GetProfilCommand.java deleted file mode 100644 index ae71f72b179..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/profil/command/GetProfilCommand.java +++ /dev/null @@ -1,43 +0,0 @@ -package no.nav.dolly.consumer.profil.command; - -import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; -import no.nav.testnav.libs.dto.profil.v1.ProfilDTO; -import no.nav.testnav.libs.securitycore.config.UserConstant; -import org.springframework.http.HttpHeaders; -import org.springframework.http.ResponseEntity; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.concurrent.Callable; - -import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; -import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID; -import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID; -import static no.nav.dolly.util.TokenXUtil.getUserJwt; - -@Slf4j -public record GetProfilCommand(WebClient webClient, - String token, - String callId) implements Callable>> { - - private static final String PROFIL_URL = "/api/v1/profil"; - - @Override - public Mono> call() { - - return webClient.get() - .uri(uriBuilder -> uriBuilder.path(PROFIL_URL) - .build()) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) - .header(UserConstant.USER_HEADER_JWT, getUserJwt()) - .header(HEADER_NAV_CALL_ID, callId) - .header(HEADER_NAV_CONSUMER_ID, CONSUMER) - .retrieve() - .toEntity(ProfilDTO.class) - .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(WebClientFilter::is5xxException)); - } -} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java index 325d1327814..50300f718b1 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java @@ -1,10 +1,7 @@ package no.nav.dolly.domain.resultset; -import lombok.AllArgsConstructor; -import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.Setter; @Getter @NoArgsConstructor @@ -53,15 +50,4 @@ public enum SystemTyper { SystemTyper(String beskrivelse) { this.beskrivelse = beskrivelse; } - - @Getter - @Setter - @Builder - @NoArgsConstructor - @AllArgsConstructor - public static class SystemBeskrivelse { - - private String system; - private String beskrivelse; - } } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/pensjon/PensjonData.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/pensjon/PensjonData.java index 2c7ebaa81ec..dd2d4c7cfec 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/pensjon/PensjonData.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/pensjon/PensjonData.java @@ -18,7 +18,7 @@ @Builder @NoArgsConstructor @AllArgsConstructor -@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonInclude(JsonInclude.Include.NON_EMPTY) public class PensjonData { @Schema(description = "Inntekt i pensjonsopptjeningsregister (POPP)") diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/OppslagController.java b/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/OppslagController.java index b8a3ff71a39..af8e4f85640 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/OppslagController.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/OppslagController.java @@ -1,58 +1,27 @@ package no.nav.dolly.provider.api; -import com.fasterxml.jackson.databind.JsonNode; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import lombok.RequiredArgsConstructor; -import no.nav.dolly.bestilling.arbeidsplassencv.ArbeidsplassenCVConsumer; -import no.nav.dolly.bestilling.arenaforvalter.ArenaForvalterConsumer; -import no.nav.dolly.bestilling.arenaforvalter.dto.ArenaStatusResponse; -import no.nav.dolly.bestilling.inntektstub.InntektstubConsumer; -import no.nav.dolly.bestilling.inntektstub.domain.Inntektsinformasjon; -import no.nav.dolly.bestilling.inntektstub.domain.ValiderInntekt; -import no.nav.dolly.bestilling.pensjonforvalter.PensjonforvalterConsumer; -import no.nav.dolly.bestilling.skjermingsregister.SkjermingsRegisterConsumer; -import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataResponse; -import no.nav.dolly.bestilling.udistub.UdiStubConsumer; -import no.nav.dolly.bestilling.udistub.domain.UdiPersonResponse; -import no.nav.dolly.consumer.fastedatasett.DatasettType; -import no.nav.dolly.consumer.fastedatasett.FasteDatasettConsumer; -import no.nav.dolly.consumer.generernavn.GenererNavnConsumer; import no.nav.dolly.consumer.kodeverk.KodeverkConsumer; import no.nav.dolly.consumer.kodeverk.KodeverkMapper; -import no.nav.dolly.consumer.organisasjon.tilgang.OrganisasjonTilgangConsumer; -import no.nav.dolly.consumer.organisasjon.tilgang.dto.OrganisasjonTilgang; -import no.nav.dolly.consumer.profil.ProfilApiConsumer; -import no.nav.dolly.domain.PdlPerson.Navn; -import no.nav.dolly.domain.resultset.SystemTyper; import no.nav.dolly.domain.resultset.kodeverk.KodeverkAdjusted; -import no.nav.dolly.exceptions.NotFoundException; import no.nav.dolly.service.InntektsmeldingEnumService; import no.nav.dolly.service.InntektsmeldingEnumService.EnumTypes; import no.nav.dolly.service.RsTransaksjonMapping; import no.nav.dolly.service.TransaksjonMappingService; -import no.nav.dolly.util.CallIdUtil; -import no.nav.testnav.libs.dto.profil.v1.ProfilDTO; import org.springframework.cache.annotation.Cacheable; import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.server.ResponseStatusException; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.Set; -import static java.lang.String.format; import static no.nav.dolly.config.CachingConfig.CACHE_KODEVERK; @RestController @@ -62,44 +31,8 @@ public class OppslagController { private final KodeverkMapper kodeverkMapper; private final KodeverkConsumer kodeverkConsumer; - private final InntektstubConsumer inntektstubConsumer; - private final FasteDatasettConsumer fasteDatasettConsumer; - private final PensjonforvalterConsumer pensjonforvalterConsumer; - private final GenererNavnConsumer genererNavnConsumer; private final InntektsmeldingEnumService inntektsmeldingEnumService; - private final ProfilApiConsumer profilApiConsumer; private final TransaksjonMappingService transaksjonMappingService; - private final SkjermingsRegisterConsumer skjermingsRegisterConsumer; - private final UdiStubConsumer udiStubConsumer; - - private final ArbeidsplassenCVConsumer arbeidsplassenCVConsumer; - private final OrganisasjonTilgangConsumer organisasjonTilgangConsumer; - private final ArenaForvalterConsumer arenaForvalterConsumer; - - @GetMapping("/arena/ident/{ident}/miljoe/{miljoe}") - public Mono getArenaBruker(@PathVariable("ident") String ident, @PathVariable("miljoe") String miljoe) { - - return arenaForvalterConsumer.getArenaBruker(ident, miljoe); - } - - @GetMapping("/organisasjoner/tilgang") - public Flux getOrganisasjonerTilgang() { - - return organisasjonTilgangConsumer.getOrgansisjonTilganger(); - } - - @GetMapping("/arbeidsforholdcv/ident/{ident}") - public Flux getArbeidsforhold(@PathVariable("ident") String ident) { - - return arbeidsplassenCVConsumer.hentCV(ident, CallIdUtil.generateCallId()) - .map(response -> { - if (response.getStatus().is2xxSuccessful()) { - return response.getJsonNode(); - } else { - throw new ResponseStatusException(response.getStatus(), response.getFeilmelding()); - } - }); - } @Cacheable(CACHE_KODEVERK) @GetMapping("/kodeverk/{kodeverkNavn}") @@ -118,89 +51,6 @@ public Mono> fetchKodeverk(@RequestParam String kodeverk) { return kodeverkConsumer.getKodeverkByName(kodeverk); } - @GetMapping("/inntektstub/{ident}") - @Operation(description = "Hent inntekter tilhørende ident fra Inntektstub") - public List inntektstub(@PathVariable String ident) { - - return inntektstubConsumer.getInntekter(ident) - .collectList() - .block(); - } - - @PostMapping("/inntektstub") - @Operation(description = "Valider inntekt mot Inntektstub") - public ResponseEntity inntektstub(@RequestBody ValiderInntekt validerInntekt) { - return inntektstubConsumer.validerInntekter(validerInntekt); - } - - @GetMapping("/systemer") - @Operation(description = "Hent liste med systemer og deres beskrivelser") - public List getSystemTyper() { - return Arrays.stream(SystemTyper.values()) - .map(type -> SystemTyper.SystemBeskrivelse.builder().system(type.name()).beskrivelse(type.getBeskrivelse()).build()) - .toList(); - } - - @GetMapping("/skjerming/{ident}") - @Operation(description = "Hent skjerming på ident") - public SkjermingDataResponse getSkjerming(@PathVariable String ident) { - - var response = skjermingsRegisterConsumer.getSkjerming(ident); - if (response.isEksistererIkke()) { - throw new NotFoundException(format("Skjerming for ident %s ble ikke funnet", ident)); - } - return response; - } - - @GetMapping("/udistub/{ident}") - @Operation(description = "Hent udistub ident") - public UdiPersonResponse getUdistubIdent(@PathVariable String ident) { - return udiStubConsumer.getUdiPerson(ident).block(); - } - - @GetMapping("/fastedatasett/{datasettype}") - @Operation(description = "Hent faste datasett med beskrivelser") - public ResponseEntity getFasteDatasett(@PathVariable DatasettType datasettype) { - return fasteDatasettConsumer.hentDatasett(datasettype); - } - - @GetMapping("/fastedatasett/tps/{gruppe}") - @Operation(description = "Hent faste datasett gruppe med beskrivelser") - public ResponseEntity getFasteDatasettGruppe(@PathVariable String gruppe) { - return fasteDatasettConsumer.hentDatasettGruppe(gruppe); - } - - @GetMapping("/orgnummer") - @Operation(description = "Hent faste orgnummer") - public ResponseEntity getOrgnummer() { - return fasteDatasettConsumer.hentOrgnummer(); - } - - @GetMapping("/popp/inntekt/{ident}/{miljoe}") - @Operation(description = "Hent inntekter fra POPP-register") - public JsonNode getPoppInntekter(@PathVariable String ident, @PathVariable String miljoe) { - return pensjonforvalterConsumer.getInntekter(ident, miljoe); - } - - @GetMapping("/tp/forhold/{ident}/{miljoe}") - @Operation(description = "Hent ordning fra TP-register") - public JsonNode getTpForhold(@PathVariable String ident, @PathVariable String miljoe) { - return pensjonforvalterConsumer.getTpForhold(ident, miljoe); - } - - @GetMapping("/tp/miljoe") - @Operation(description = "Hent tilgjengelige miljøer for TP-register") - public Set getTpMiljoer() { - return pensjonforvalterConsumer.getMiljoer().block(); - } - - @GetMapping("/personnavn") - @Operation(description = "Henter et gitt antall syntetiske personnavn") - public ResponseEntity> getPersonnavn - (@RequestParam(required = false, defaultValue = "10") Integer antall) { - return genererNavnConsumer.getPersonnavn(antall); - } - @GetMapping("/inntektsmelding/{enumtype}") @Operation(description = "Henter enumtyper for inntektsmelding") public List getInntektsmeldingeTyper(@PathVariable EnumTypes enumtype) { @@ -208,13 +58,6 @@ public List getInntektsmeldingeTyper(@PathVariable EnumTypes enumtype) { return inntektsmeldingEnumService.getEnumType(enumtype); } - @GetMapping("/profil") - @Operation(description = "Henter profil for innlogget bruker") - public ProfilDTO getInntektsmeldingeTyper() { - - return profilApiConsumer.getProfil().getBody(); - } - @GetMapping("/transaksjonid") @Operation(description = "Henter transaksjon IDer for bestillingId, ident og system") public List getTransaksjonIderIdent( diff --git a/apps/dolly-backend/src/main/resources/application-dev.yaml b/apps/dolly-backend/src/main/resources/application-dev.yaml index 4054996ef53..1791bf94b59 100644 --- a/apps/dolly-backend/src/main/resources/application-dev.yaml +++ b/apps/dolly-backend/src/main/resources/application-dev.yaml @@ -9,9 +9,6 @@ spring: minimum-idle: 1 consumers: - testnav-profil-api: - name: testnorge-profil-api-dev - url: http://testnorge-profil-api-dev.dolly.svc.cluster.local testnav-pdl-forvalter: name: testnav-pdl-forvalter-dev url: http://testnav-pdl-forvalter-dev.dolly.svc.cluster.local diff --git a/apps/dolly-backend/src/main/resources/application-local.yaml b/apps/dolly-backend/src/main/resources/application-local.yaml index 1f2b0955e4d..3d27ef8cb0c 100644 --- a/apps/dolly-backend/src/main/resources/application-local.yaml +++ b/apps/dolly-backend/src/main/resources/application-local.yaml @@ -41,9 +41,6 @@ management: prometheus: "prometheus" consumers: - testnav-profil-api: - name: testnorge-profil-api-dev - url: https://testnorge-profil-api-dev.intern.dev.nav.no testnav-pdl-forvalter: name: testnav-pdl-forvalter-dev url: https://testnav-pdl-forvalter-dev.intern.dev.nav.no @@ -53,8 +50,6 @@ consumers: url: https://testnav-inntektsmelding-service.intern.dev.nav.no testnav-tps-messaging-service: url: https://testnav-tps-messaging-service.intern.dev.nav.no - testnav-generer-navn-service: - url: https://generer-navn-service.intern.dev.nav.no testnav-person-service: url: https://testnav-person-service.intern.dev.nav.no testnav-arbeidsforhold-service: @@ -66,7 +61,4 @@ consumers: testnav-synt-sykemelding-api: url: https://testnav-synt-sykemelding-api.intern.dev.nav.no testnav-miljoer-service: - url: https://testnav-miljoer-service.intern.dev.nav.no - testnav-organisasjon-tilgang-service: - cluster: dev-gcp - url: https://testnav-organisasjon-tilgang-service.intern.dev.nav.no \ No newline at end of file + url: https://testnav-miljoer-service.intern.dev.nav.no \ No newline at end of file diff --git a/apps/dolly-backend/src/main/resources/application.yaml b/apps/dolly-backend/src/main/resources/application.yaml index 9da09e66875..7dc9013a424 100644 --- a/apps/dolly-backend/src/main/resources/application.yaml +++ b/apps/dolly-backend/src/main/resources/application.yaml @@ -107,16 +107,6 @@ consumers: namespace: dolly url: https://testnav-norg2-proxy.dev-fss-pub.nais.io cluster: dev-fss - testnav-generer-navn-service: - name: generer-navn-service - namespace: dolly - url: http://generer-navn-service.dolly.svc.cluster.local - cluster: dev-gcp - testnav-profil-api: - name: testnorge-profil-api - namespace: dolly - url: http://testnorge-profil-api.dolly.svc.cluster.local - cluster: dev-gcp testnav-person-service: name: testnav-person-service namespace: dolly @@ -162,11 +152,6 @@ consumers: namespace: dolly url: https://testnav-inst-proxy.dev-fss-pub.nais.io cluster: dev-fss - testnav-statisk-data-forvalter-proxy: - name: testnav-statisk-data-forvalter-proxy - namespace: dolly - url: https://testnav-statisk-data-forvalter-proxy.dev-fss-pub.nais.io - cluster: dev-fss testnav-skjermingsregister-proxy: name: testnav-skjermingsregister-proxy namespace: dolly @@ -243,9 +228,4 @@ consumers: namespace: dolly url: https://testnav-arbeidsplassencv-proxy.dev-fss-pub.nais.io cluster: dev-fss - testnav-organisasjon-tilgang-service: - cluster: prod-gcp - namespace: dolly - name: testnav-organisasjon-tilgang-service - url: https://testnav-organisasjon-tilgang-service.intern.nav.no \ No newline at end of file diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumerTest.java index 6fad8cfcc7e..2a073d65358 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumerTest.java @@ -32,7 +32,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static org.mockito.Mockito.when; -import static wiremock.org.hamcrest.MatcherAssert.assertThat; @ActiveProfiles("test") @ExtendWith(SpringExtension.class) @@ -106,21 +105,6 @@ private void stubPostLagreTpForhold(boolean withError) { } } - private void stubGetGetInntekter() { - - stubFor(get(urlPathMatching("(.*)/api/v1/inntekt")) - .willReturn(ok() - .withBody("{\"miljo\":\"tx\",\"fnr\":\"00000\",\"inntekter\":[{\"belop\":12345,\"inntektAar\":2000}]}") - .withHeader("Content-Type", "application/json"))); - } - - private void stubGetGetTpForhold() { - stubFor(get(urlPathMatching("(.*)/api/v1/tp/forhold")) - .willReturn(ok() - .withBody("[{\"ordning\":\"0001\"},{\"ordning\":\"0002\"},{\"ordning\":\"0003\"},{\"ordning\":\"0004\"}]") - .withHeader("Content-Type", "application/json"))); - } - private void stubPostLagreTpYtelse(boolean withError) { if (!withError) { @@ -235,21 +219,6 @@ void testLagreInntekt_error() { .verifyComplete(); } - @Test - void testGetInntekter() { - - stubGetGetInntekter(); - - var response = pensjonforvalterConsumer.getInntekter(null, null); - - assertThat("Environment is 'tx'", response.get("miljo").asText().equals("tx")); - assertThat("Fnr is '00000'", response.get("fnr").asText().equals("00000")); - assertThat("inntekter is array", response.get("inntekter").isArray()); - assertThat("inntekter have 1 object", response.get("inntekter").size() == 1); - assertThat("inntekter 'belop' is 12345", response.get("inntekter").get(0).get("belop").asInt() == 12345); - assertThat("inntekter 'inntektAar' is 2000", response.get("inntekter").get(0).get("inntektAar").asInt() == 2000); - } - @Test void testLagreTpForhold_ok() { @@ -293,20 +262,6 @@ void testLagreTpForhold_error() { .verifyComplete(); } - @Test - void testGetTpForhold() { - stubGetGetTpForhold(); - - var response = pensjonforvalterConsumer.getTpForhold(null, null); - - assertThat("size of response list is 4", response.size() == 4); - - assertThat("ordning 1 is '0001'", response.get(0).get("ordning").asText().equals("0001")); - assertThat("ordning 2 is '0002'", response.get(1).get("ordning").asText().equals("0002")); - assertThat("ordning 3 is '0003'", response.get(2).get("ordning").asText().equals("0003")); - assertThat("ordning 4 is '0004'", response.get(3).get("ordning").asText().equals("0004")); - } - @Test void testLagreTpYtelse_ok() { diff --git a/apps/dolly-frontend/config.idporten.yml b/apps/dolly-frontend/config.idporten.yml index 121946ca91a..58d30d0df7d 100644 --- a/apps/dolly-frontend/config.idporten.yml +++ b/apps/dolly-frontend/config.idporten.yml @@ -45,6 +45,7 @@ spec: - application: testnav-helsepersonell-service - application: dolly-backend - application: testnav-person-service + - application: generer-navn-service external: - host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io diff --git a/apps/dolly-frontend/config.test.yml b/apps/dolly-frontend/config.test.yml index 1e3e29c522f..0108040511d 100644 --- a/apps/dolly-frontend/config.test.yml +++ b/apps/dolly-frontend/config.test.yml @@ -49,6 +49,7 @@ spec: - application: testnav-helsepersonell-service - application: dolly-backend-dev - application: testnav-person-service + - application: generer-navn-service external: - host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io diff --git a/apps/dolly-frontend/config.unstable.yml b/apps/dolly-frontend/config.unstable.yml index 2337055c6c2..5895ea7bd8a 100644 --- a/apps/dolly-frontend/config.unstable.yml +++ b/apps/dolly-frontend/config.unstable.yml @@ -49,6 +49,7 @@ spec: - application: testnav-helsepersonell-service - application: dolly-backend-dev - application: testnav-person-service + - application: generer-navn-service external: - host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io diff --git a/apps/dolly-frontend/config.yml b/apps/dolly-frontend/config.yml index 194c9011244..a183821f7fd 100644 --- a/apps/dolly-frontend/config.yml +++ b/apps/dolly-frontend/config.yml @@ -55,6 +55,7 @@ spec: - application: testnav-helsepersonell-service - application: dolly-backend - application: testnav-person-service + - application: generer-navn-service external: - host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/DollyFrontendApplicationStarter.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/DollyFrontendApplicationStarter.java index c7fbee3512c..901df742336 100644 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/DollyFrontendApplicationStarter.java +++ b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/DollyFrontendApplicationStarter.java @@ -73,6 +73,7 @@ public class DollyFrontendApplicationStarter { private final TestnavArbeidsplassenCvProxyProperties testnavArbeidsplassenCvProxyProperties; private final TestnavHelsePersonellServiceProperties testnavHelsePersonellServiceProperties; private final PersonServiceProperties personServiceProperties; + private final GenererNavnServiceProperties genererNavnServiceProperties; @Bean public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { @@ -112,6 +113,7 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { .route(createRoute(testnavArbeidsplassenCvProxyProperties)) .route(createRoute(testnavHelsePersonellServiceProperties)) .route(createRoute(personServiceProperties, "person-service")) + .route(createRoute(genererNavnServiceProperties)) .build(); } @@ -160,4 +162,4 @@ private Function> createRoute(String segment, St .filters(filter, addUserJwtHeaderFilter()) ).uri(host); } -} \ No newline at end of file +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/GenererNavnServiceProperties.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/GenererNavnServiceProperties.java similarity index 71% rename from apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/GenererNavnServiceProperties.java rename to apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/GenererNavnServiceProperties.java index 021e6630069..ac3010cde1b 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/credentials/GenererNavnServiceProperties.java +++ b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/credentials/GenererNavnServiceProperties.java @@ -1,10 +1,10 @@ -package no.nav.dolly.config.credentials; +package no.nav.dolly.web.credentials; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @Configuration -@ConfigurationProperties(prefix = "consumers.testnav-generer-navn-service") +@ConfigurationProperties(prefix = "consumers.generer-navn-service") public class GenererNavnServiceProperties extends ServerProperties { } \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/js/proxy-routes.json b/apps/dolly-frontend/src/main/js/proxy-routes.json index 1ef08d9e0f3..5756c511445 100644 --- a/apps/dolly-frontend/src/main/js/proxy-routes.json +++ b/apps/dolly-frontend/src/main/js/proxy-routes.json @@ -213,5 +213,10 @@ "target": "http://localhost:8020", "changeOrigin": true, "secure": false + }, + "/generer-navn-service": { + "target": "http://localhost:8020", + "changeOrigin": true, + "secure": false } } \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx index 5da2579ccd7..fe7ef703eed 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/bostedsadresse/Bostedsadresse.tsx @@ -25,6 +25,7 @@ import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/Datepi import { Adressetype } from '@/components/fagsystem/pdlf/PdlTypes' import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { getPlaceholder, setNavn } from '@/components/fagsystem/pdlf/form/partials/utils' +import { useGenererNavn } from '@/utils/hooks/useGenererNavn' interface BostedsadresseValues { formikBag: FormikProps<{}> @@ -122,7 +123,7 @@ export const BostedsadresseForm = ({ formikBag.setFieldValue(path, adresseClone) } - const navnInfo = SelectOptionsOppslag.hentPersonnavn() + const { navnInfo, loading } = useGenererNavn() const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) return ( @@ -164,7 +165,7 @@ export const BostedsadresseForm = ({ options={navnOptions} size="xlarge" placeholder={getPlaceholder(formikBag.values, `${path}.opprettCoAdresseNavn`)} - isLoading={navnInfo.loading} + isLoading={loading} onChange={(navn: Target) => setNavn(navn, `${path}.opprettCoAdresseNavn`, formikBag.setFieldValue) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/kontaktadresse/Kontaktadresse.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/kontaktadresse/Kontaktadresse.tsx index 777043452a5..710a2d25d91 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/kontaktadresse/Kontaktadresse.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/kontaktadresse/Kontaktadresse.tsx @@ -22,6 +22,7 @@ import { Adressetype } from '@/components/fagsystem/pdlf/PdlTypes' import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled' import { getPlaceholder, setNavn } from '@/components/fagsystem/pdlf/form/partials/utils' import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' +import { useGenererNavn } from '@/utils/hooks/useGenererNavn' interface KontaktadresseValues { formikBag: FormikProps<{}> @@ -89,7 +90,7 @@ export const KontaktadresseForm = ({ formikBag, path, idx }: KontaktadresseFormV formikBag.setFieldValue(path, adresseClone) } - const navnInfo = SelectOptionsOppslag.hentPersonnavn() + const { navnInfo, loading } = useGenererNavn() const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) return ( @@ -127,7 +128,7 @@ export const KontaktadresseForm = ({ formikBag, path, idx }: KontaktadresseFormV options={navnOptions} size="xlarge" placeholder={getPlaceholder(formikBag.values, `${path}.opprettCoAdresseNavn`)} - isLoading={navnInfo.loading} + isLoading={loading} onChange={(navn: Target) => setNavn(navn, `${path}.opprettCoAdresseNavn`, formikBag.setFieldValue) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/oppholdsadresse/Oppholdsadresse.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/oppholdsadresse/Oppholdsadresse.tsx index b4e561e011d..1d9facd075a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/oppholdsadresse/Oppholdsadresse.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/adresser/oppholdsadresse/Oppholdsadresse.tsx @@ -24,6 +24,7 @@ import { Adressetype } from '@/components/fagsystem/pdlf/PdlTypes' import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled' import { getPlaceholder, setNavn } from '@/components/fagsystem/pdlf/form/partials/utils' import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' +import { useGenererNavn } from '@/utils/hooks/useGenererNavn' interface OppholdsadresseValues { formikBag: FormikProps<{}> @@ -110,7 +111,7 @@ export const OppholdsadresseForm = ({ formikBag, path, idx }: OppholdsadresseFor formikBag.setFieldValue(path, adresseClone) } - const navnInfo = SelectOptionsOppslag.hentPersonnavn() + const { navnInfo, loading } = useGenererNavn() const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) return ( @@ -151,7 +152,7 @@ export const OppholdsadresseForm = ({ formikBag, path, idx }: OppholdsadresseFor options={navnOptions} size="xlarge" placeholder={getPlaceholder(formikBag.values, `${path}.opprettCoAdresseNavn`)} - isLoading={navnInfo.loading} + isLoading={loading} onChange={(navn: Target) => setNavn(navn, `${path}.opprettCoAdresseNavn`, formikBag.setFieldValue) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx index 67f88c579bb..89dd4ab513a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/identifikasjon/falskIdentitet/FalskIdentitet.tsx @@ -9,9 +9,10 @@ import { FormikDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFiel import { AvansertForm } from '@/components/fagsystem/pdlf/form/partials/avansert/AvansertForm' import { initialFalskIdentitetValues } from '@/components/fagsystem/pdlf/form/initialValues' import { PdlEksisterendePerson } from '@/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson' +import { useGenererNavn } from '@/utils/hooks/useGenererNavn' export const FalskIdentitet = ({ formikBag }) => { - const navnInfo = SelectOptionsOppslag.hentPersonnavn() + const { navnInfo , loading} = useGenererNavn() const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) const settIdentitetType = (e, path, advancedValues) => { @@ -92,19 +93,19 @@ export const FalskIdentitet = ({ formikBag }) => { size="xlarge" placeholder={getPlaceholder( formikBag.values, - `${path}.rettIdentitetVedOpplysninger.personnavn` + `${path}.rettIdentitetVedOpplysninger.personnavn`, )} - isLoading={navnInfo.loading} + isLoading={loading} onChange={(navn) => setNavn( navn, `${path}.rettIdentitetVedOpplysninger.personnavn`, - formikBag.setFieldValue + formikBag.setFieldValue, ) } value={_.get( formikBag.values, - `${path}.rettIdentitetVedOpplysninger.personnavn.fornavn` + `${path}.rettIdentitetVedOpplysninger.personnavn.fornavn`, )} /> @@ -57,7 +58,7 @@ export const Kontakt = ({ formikBag, path, eksisterendeNyPerson = null }: Kontak } else return null } - const navnInfo = SelectOptionsOppslag.hentPersonnavn() + const { navnInfo, loading } = useGenererNavn() const navnOptions = SelectOptionsOppslag.formatOptions('personnavn', navnInfo) useEffect(() => { @@ -129,7 +130,7 @@ export const Kontakt = ({ formikBag, path, eksisterendeNyPerson = null }: Kontak options={navnOptions} size="large" placeholder={getPlaceholder(formikBag.values, `${advokatPath}.kontaktperson`)} - isLoading={navnInfo.loading} + isLoading={loading} onChange={(navn: string) => setNavn(navn, `${advokatPath}.kontaktperson`, formikBag.setFieldValue) } @@ -150,7 +151,7 @@ export const Kontakt = ({ formikBag, path, eksisterendeNyPerson = null }: Kontak options={navnOptions} size="large" placeholder={getPlaceholder(formikBag.values, `${organisasjonPath}.kontaktperson`)} - isLoading={navnInfo.loading} + isLoading={loading} onChange={(navn: string) => setNavn(navn, `${organisasjonPath}.kontaktperson`, formikBag.setFieldValue) } @@ -183,7 +184,7 @@ export const Kontakt = ({ formikBag, path, eksisterendeNyPerson = null }: Kontak options={navnOptions} size="xlarge" placeholder={getPlaceholder(formikBag.values, `${personPath}.navn`)} - isLoading={navnInfo.loading} + isLoading={loading} onChange={(navn: string) => setNavn(navn, `${personPath}.navn`, formikBag.setFieldValue) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx index 6e145762104..4906f2a45a4 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/navn/Navn.tsx @@ -8,12 +8,12 @@ import * as _ from 'lodash-es' import { FormikProps } from 'formik' import { isEmpty } from 'lodash' import { useEffect, useState } from 'react' -import { DollyApi } from '@/service/Api' import { ArrowCirclepathIcon } from '@navikt/aksel-icons' import { Button } from '@navikt/ds-react' import styled from 'styled-components' import { DatepickerWrapper } from '@/components/ui/form/inputs/datepicker/DatepickerStyled' import { FormikDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker' +import { useGenererNavn } from '@/utils/hooks/useGenererNavn' type NavnTypes = { formikBag: FormikProps<{}> @@ -24,16 +24,16 @@ const RefreshButton = styled(Button)` margin: 8px 0 0 -10px; ` -const concatNavnMedTidligereValgt = (type, navnInfo, selectedFornavn) => { +const concatNavnMedTidligereValgt = (type, navnInfo, selectedNavn) => { if (!navnInfo) { return [] } const navnOptions = SelectOptionsOppslag.formatOptions(type, navnInfo) .concat( - selectedFornavn?.map((navn) => ({ + selectedNavn?.map((navn) => ({ value: navn, label: navn, - })) + })), ) ?.sort((first, second) => (first.label > second.label ? 1 : -1)) @@ -41,38 +41,35 @@ const concatNavnMedTidligereValgt = (type, navnInfo, selectedFornavn) => { } export const NavnForm = ({ formikBag, path }: NavnTypes) => { - if (!_.get(formikBag?.values, path)) { - return null - } - const [selectedFornavn, setSelectedFornavn] = useState( - _.get(formikBag?.values, `${path}.alleFornavn`) || [] + _.get(formikBag?.values, `${path}.alleFornavn`) || [], ) + const [selectedMellomnavn, setSelectedMellomnavn] = useState( - _.get(formikBag?.values, `${path}.alleMellomnavn`) || [] + _.get(formikBag?.values, `${path}.alleMellomnavn`) || [], ) const [selectedEtternavn, setSelectedEtternavn] = useState( - _.get(formikBag?.values, `${path}.alleEtternavn`) || [] + _.get(formikBag?.values, `${path}.alleEtternavn`) || [], ) - const [fornavnOptions, setFornavnOptions] = useState([]) + const [mellomnavnOptions, setMellomnavnOptions] = useState([]) const [etternavnOptions, setetternavnOptions] = useState([]) - const [navnInfo, setNavnInfo] = useState(null) + const { data, navnInfo, mutate } = useGenererNavn() - function refreshNavn() { - DollyApi.getPersonnavn().then((result) => setNavnInfo({ value: result, loading: false })) + if (!_.get(formikBag?.values, path)) { + return null } - useEffect(() => { - refreshNavn() - }, []) + const refreshNavn = () => { + mutate() + } useEffect(() => { setFornavnOptions(concatNavnMedTidligereValgt('fornavn', navnInfo, selectedFornavn)) setMellomnavnOptions(concatNavnMedTidligereValgt('mellomnavn', navnInfo, selectedMellomnavn)) setetternavnOptions(concatNavnMedTidligereValgt('etternavn', navnInfo, selectedEtternavn)) - }, [navnInfo]) + }, [data]) const { fornavn, mellomnavn, etternavn } = _.get(formikBag?.values, path) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx index 53c29180dd1..f55940cb8e0 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonUtenIdentifikator.tsx @@ -6,6 +6,7 @@ import * as React from 'react' import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' import { FormikProps } from 'formik' import * as _ from 'lodash-es' +import { useGenererNavn } from '@/utils/hooks/useGenererNavn' interface PdlPersonUtenIdentifikatorValues { formikBag: FormikProps<{}> @@ -16,7 +17,7 @@ export const PdlPersonUtenIdentifikator = ({ formikBag, path, }: PdlPersonUtenIdentifikatorValues) => { - const navnInfo = SelectOptionsOppslag.hentPersonnavn() + const { navnInfo, loading } = useGenererNavn() //@ts-ignore const fornavnOptions = SelectOptionsOppslag.formatOptions('fornavn', navnInfo) //@ts-ignore @@ -41,18 +42,21 @@ export const PdlPersonUtenIdentifikator = ({ label="Fornavn" placeholder={fornavn ? fornavn : 'Velg...'} options={fornavnOptions} + isLoading={loading} /> ) diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/button/DollyTooltip.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/button/DollyTooltip.tsx index c5f62fcb776..6cca56ac13a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/button/DollyTooltip.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/button/DollyTooltip.tsx @@ -22,13 +22,7 @@ const DollyTooltip = ({ } return useExternalTooltip ? ( - + {children} diff --git a/apps/dolly-frontend/src/main/js/src/ducks/fagsystem/index.tsx b/apps/dolly-frontend/src/main/js/src/ducks/fagsystem/index.tsx index 6b9b5d75bb5..ad70f230cb3 100644 --- a/apps/dolly-frontend/src/main/js/src/ducks/fagsystem/index.tsx +++ b/apps/dolly-frontend/src/main/js/src/ducks/fagsystem/index.tsx @@ -7,6 +7,7 @@ import { KrrApi, PdlforvalterApi, SigrunApi, + SkjermingApi, TpsMessagingApi, } from '@/service/Api' import { onSuccess } from '@/ducks/utils/requestActions' @@ -78,7 +79,7 @@ export const actions = createActions( }), ], getSkjermingsregister: [ - DollyApi.getSkjerming, + SkjermingApi.getSkjerming, (ident) => ({ ident, }), diff --git a/apps/dolly-frontend/src/main/js/src/ducks/redigertePersoner/index.tsx b/apps/dolly-frontend/src/main/js/src/ducks/redigertePersoner/index.tsx index 87b81c20fd2..b2787e10fb3 100644 --- a/apps/dolly-frontend/src/main/js/src/ducks/redigertePersoner/index.tsx +++ b/apps/dolly-frontend/src/main/js/src/ducks/redigertePersoner/index.tsx @@ -1,4 +1,4 @@ -import { DollyApi, PdlforvalterApi } from '@/service/Api' +import {PdlforvalterApi, SkjermingApi} from '@/service/Api' // @ts-ignore import { createActions } from 'redux-actions' import { handleActions } from '@/ducks/utils/immerHandleActions' @@ -15,7 +15,7 @@ export const actions = createActions({ }), ], getSkjermingsregister: [ - DollyApi.getSkjerming, + SkjermingApi.getSkjerming, (ident) => ({ ident, }), diff --git a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonListe/PersonListe.tsx b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonListe/PersonListe.tsx index c9fe475b683..edecda7baa7 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonListe/PersonListe.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/gruppe/PersonListe/PersonListe.tsx @@ -117,7 +117,7 @@ export default function PersonListe({ dataField: 'navn', formatter: (_cell, row) => { return ( - 23 ? row.navn : null} mouseEnterDelay={0}> + 23 ? row.navn : null}> {getNavnLimited(row.navn)} ) diff --git a/apps/dolly-frontend/src/main/js/src/service/Api.tsx b/apps/dolly-frontend/src/main/js/src/service/Api.tsx index 4553baee879..9571f3276c7 100644 --- a/apps/dolly-frontend/src/main/js/src/service/Api.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/Api.tsx @@ -47,5 +47,5 @@ export default { PdlforvalterApi: PdlForvalterService, SessionApi: SessionService, BankkontoApi: KontoregisterService, - SkjermingApi: SkjermingService, + SkjermingApi: SkjermingService } diff --git a/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx b/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx index f8f78c00fb0..a176a657156 100644 --- a/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/SelectOptionsOppslag.tsx @@ -82,10 +82,6 @@ export const SelectOptionsOppslag = { return useAsync(async () => KrrApi.getSdpLeverandoerListe(), [KrrApi.getSdpLeverandoerListe]) }, - hentPersonnavn: () => { - return useAsync(async () => DollyApi.getPersonnavn(), [DollyApi.getPersonnavn]) - }, - hentInntektsmeldingOptions: (enumtype: string) => Api.fetchJson(`${uri}/inntektsmelding/${enumtype}`, { method: 'GET' }), diff --git a/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyEndpoints.tsx b/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyEndpoints.tsx index 1df7221a8f6..f6ebd5896ef 100644 --- a/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyEndpoints.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyEndpoints.tsx @@ -11,14 +11,7 @@ const kodeverkBase = `${uri}/kodeverk` const udiBase = `${uri}/udistub` const bestillingBase = `${uri}/bestilling` const personoppslagBase = `${personUri}/personer` -const fasteOrgnummerBase = `${uri}/orgnummer` -const fasteDatasettBase = `${uri}/fastedatasett` -const dokarkivBase = `${uri}/dokarkiv` -const skjermingBase = `${uri}/skjerming` -const inntektsmeldingBase = `${uri}/inntektsmelding` const organisasjonBase = `${uri}/organisasjon` -const poppBase = `${uri}/popp` -const tpBase = `${uri}/tp` export default class DollyEndpoints { static gruppe() { @@ -65,10 +58,6 @@ export default class DollyEndpoints { return `${organisasjonBase}/bestilling` } - static skjermingByIdent(ident) { - return `${skjermingBase}/${ident}` - } - static gjenopprettOrganisasjonBestilling(bestillingId, envs) { return `${organisasjonBase}/gjenopprett/${bestillingId}?miljoer=${envs}` } @@ -178,10 +167,6 @@ export default class DollyEndpoints { return `${identBase}/${ident}/relasjon` } - static getPersonnavn() { - return `${uri}/personnavn` - } - static getTransaksjonsid(system, ident, bestillingsid) { if (bestillingsid) { return `${uri}/transaksjonid?system=${system}&ident=${ident}&bestillingId=${bestillingsid}` @@ -215,20 +200,4 @@ export default class DollyEndpoints { static malBestillingOrganisasjon(malId, malNavn) { return `${organisasjonBase}/bestilling/malbestilling/${malId}?malNavn=${malNavn}` } - - static getPoppMiljoer() { - return `${poppBase}/miljoe` - } - - static getPoppInntekter(ident, miljoe) { - return `${poppBase}/inntekt/${ident}/${miljoe}` - } - - static getTpMiljoer() { - return `${tpBase}/miljoe` - } - - static getTpOrdning(ident, miljoe) { - return `${tpBase}/forhold/${ident}/${miljoe}` - } } diff --git a/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyService.tsx b/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyService.tsx index e21c9484a42..1c235593fa4 100644 --- a/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyService.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/services/dolly/DollyService.tsx @@ -2,10 +2,6 @@ import Request from '@/service/services/Request' import Endpoints from './DollyEndpoints' export default { - getSkjerming(ident) { - return Request.get(Endpoints.skjermingByIdent(ident)) - }, - getGruppeById(gruppeId) { return Request.get(Endpoints.gruppeById(gruppeId)) }, @@ -156,10 +152,6 @@ export default { return Request.get(Endpoints.personoppslagMange(identer)) }, - getPersonnavn() { - return Request.get(Endpoints.getPersonnavn()) - }, - getTransaksjonid(system, ident, bestillingsid) { return Request.get(Endpoints.getTransaksjonsid(system, ident, bestillingsid)) }, @@ -287,21 +279,4 @@ export default { throw error }) }, - - // Pensjon-oppslag - getPoppMiljoer() { - return Request.get(Endpoints.getPoppMiljoer()) - }, - - getPoppInntekter(ident, miljoe) { - return Request.get(Endpoints.getPoppInntekter(ident, miljoe)) - }, - - getTpMiljoer() { - return Request.get(Endpoints.getTpMiljoer()) - }, - - getTpOrdning(ident, miljoe) { - return Request.get(Endpoints.getTpOrdning(ident, miljoe)) - }, } diff --git a/apps/dolly-frontend/src/main/js/src/service/services/skjerming/SkjermingService.tsx b/apps/dolly-frontend/src/main/js/src/service/services/skjerming/SkjermingService.tsx index b19eb03d378..824c0725699 100644 --- a/apps/dolly-frontend/src/main/js/src/service/services/skjerming/SkjermingService.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/services/skjerming/SkjermingService.tsx @@ -6,4 +6,8 @@ export default { deleteSkjerming(ident: string) { return Request.delete(`${skjermingUrl}/${ident}`) }, + + getSkjerming(ident: string) { + return Request.get(`${skjermingUrl}/${ident}`) + } } diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useGenererNavn.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useGenererNavn.tsx new file mode 100644 index 00000000000..180cb44e787 --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useGenererNavn.tsx @@ -0,0 +1,28 @@ +import useSWR from 'swr' +import { fetcher } from '@/api' + +const GenererNavnBaseUrl = '/generer-navn-service/api/v1/navn' + +export const useGenererNavn = () => { + const { data, isLoading, error, mutate } = useSWR( + [GenererNavnBaseUrl], + ([url, headers]) => fetcher(url, headers), + ) + + return { + data: data, + navnInfo: { + value: { + data: data?.map((element: any) => ({ + fornavn: element.adjektiv, + mellomnavn: element.adverb, + etternavn: element.substantiv, + })), + loading: isLoading, + }, + }, + loading: isLoading, + error: error, + mutate: mutate, + } +} diff --git a/apps/dolly-frontend/src/main/resources/application-local.yml b/apps/dolly-frontend/src/main/resources/application-local.yml index ae2e66730db..b6abc34b0e9 100644 --- a/apps/dolly-frontend/src/main/resources/application-local.yml +++ b/apps/dolly-frontend/src/main/resources/application-local.yml @@ -70,5 +70,7 @@ consumers: url: https://testnorge-tilbakemelding-api.intern.dev.nav.no testnav-helsepersonell-service: url: https://testnav-helsepersonell-service.intern.dev.nav.no + generer-navn-service: + url: https://generer-navn-service.intern.dev.nav.no testnav-person-service: url: https://testnav-person-service.intern.dev.nav.no \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/resources/application.yml b/apps/dolly-frontend/src/main/resources/application.yml index 40090a162ce..6eb3d830902 100644 --- a/apps/dolly-frontend/src/main/resources/application.yml +++ b/apps/dolly-frontend/src/main/resources/application.yml @@ -173,6 +173,11 @@ consumers: namespace: dolly name: testnav-helsepersonell-service url: http://testnav-helsepersonell-service.dolly.svc.cluster.local + generer-navn-service: + cluster: dev-gcp + namespace: dolly + name: generer-navn-service + url: http://generer-navn-service.dolly.svc.cluster.local testnav-kontoregister-person-proxy: name: testnav-kontoregister-person-proxy namespace: dolly diff --git a/apps/generer-navn-service/build.gradle b/apps/generer-navn-service/build.gradle index 087a4f44ce7..aba77fa6262 100644 --- a/apps/generer-navn-service/build.gradle +++ b/apps/generer-navn-service/build.gradle @@ -58,10 +58,8 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.boot:spring-boot-starter-security' - implementation 'org.springframework.cloud:spring-cloud-starter-vault-config' - implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap' // TODO remove legacy bootstrap config implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'io.micrometer:micrometer-registry-prometheus' diff --git a/apps/generer-navn-service/config.yml b/apps/generer-navn-service/config.yml index 6b8dc0371bd..103356f2a3b 100644 --- a/apps/generer-navn-service/config.yml +++ b/apps/generer-navn-service/config.yml @@ -27,6 +27,14 @@ spec: cluster: dev-gcp - application: dolly-backend-dev cluster: dev-gcp + - application: dolly-frontend + cluster: dev-gcp + - application: dolly-frontend-dev + cluster: dev-gcp + - application: dolly-idporten + cluster: dev-gcp + - application: dolly-frontend-dev-unstable + cluster: dev-gcp - application: testnorge-statisk-data-forvalter cluster: dev-fss - application: testnav-generer-organisasjon-populasjon-service diff --git a/apps/generer-navn-service/src/main/java/no/nav/registre/testnorge/generernavnservice/GenererNavnServiceApplicationStarter.java b/apps/generer-navn-service/src/main/java/no/nav/registre/testnorge/generernavnservice/GenererNavnServiceApplicationStarter.java index 44da59d3c81..0580485b5ad 100644 --- a/apps/generer-navn-service/src/main/java/no/nav/registre/testnorge/generernavnservice/GenererNavnServiceApplicationStarter.java +++ b/apps/generer-navn-service/src/main/java/no/nav/registre/testnorge/generernavnservice/GenererNavnServiceApplicationStarter.java @@ -6,7 +6,7 @@ @SpringBootApplication public class GenererNavnServiceApplicationStarter { public static void main(String[] args) { + SpringApplication.run(GenererNavnServiceApplicationStarter.class, args); } - -} \ No newline at end of file +} diff --git a/apps/generer-navn-service/src/main/java/no/nav/registre/testnorge/generernavnservice/provider/GenerateNavnController.java b/apps/generer-navn-service/src/main/java/no/nav/registre/testnorge/generernavnservice/provider/GenerateNavnController.java index 9cb4ca665d0..aed3fa2e462 100644 --- a/apps/generer-navn-service/src/main/java/no/nav/registre/testnorge/generernavnservice/provider/GenerateNavnController.java +++ b/apps/generer-navn-service/src/main/java/no/nav/registre/testnorge/generernavnservice/provider/GenerateNavnController.java @@ -24,9 +24,9 @@ public class GenerateNavnController { @GetMapping public List generateName( - @RequestParam(required = false) Long seed, - @RequestParam Integer antall - ) { + @RequestParam(required = false, defaultValue = "10") Integer antall, + @RequestParam(required = false) Long seed) { + return generateNavnService.getRandomNavn(seed, antall); } diff --git a/apps/generer-navn-service/src/main/resources/application-dev.yml b/apps/generer-navn-service/src/main/resources/application-dev.yml deleted file mode 100644 index a1cf247e4df..00000000000 --- a/apps/generer-navn-service/src/main/resources/application-dev.yml +++ /dev/null @@ -1,2 +0,0 @@ -azure.app.client.id: ${client_id} -azure.app.client.secret: ${client_secret} \ No newline at end of file diff --git a/apps/generer-navn-service/src/main/resources/application.yml b/apps/generer-navn-service/src/main/resources/application.yml index 2a7d29fe841..ed8733ceea6 100644 --- a/apps/generer-navn-service/src/main/resources/application.yml +++ b/apps/generer-navn-service/src/main/resources/application.yml @@ -18,6 +18,9 @@ spring: issuer-uri: https://tokenx.dev-gcp.nav.cloud.nais.io jwk-set-uri: https://tokenx.dev-gcp.nav.cloud.nais.io/jwks accepted-audience: dev-gcp:dolly:generer-navn-service + cloud: + vault: + enabled: false springdoc: swagger-ui: diff --git a/apps/generer-navn-service/src/main/resources/bootstrap.yml b/apps/generer-navn-service/src/main/resources/bootstrap.yml deleted file mode 100644 index 0451449ca23..00000000000 --- a/apps/generer-navn-service/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - cloud: - vault: - enabled: false \ No newline at end of file diff --git a/apps/organisasjon-tilgang-service/config.prod.yml b/apps/organisasjon-tilgang-service/config.prod.yml index 8044cb47347..8706cfaa963 100644 --- a/apps/organisasjon-tilgang-service/config.prod.yml +++ b/apps/organisasjon-tilgang-service/config.prod.yml @@ -26,8 +26,6 @@ spec: rules: - application: dolly-frontend cluster: dev-gcp - - application: dolly-backend - cluster: dev-gcp - application: team-dolly-lokal-app cluster: dev-gcp - application: testnav-oversikt-frontend diff --git a/apps/organisasjon-tilgang-service/config.yml b/apps/organisasjon-tilgang-service/config.yml index 4a41800e267..0f652c8fb81 100644 --- a/apps/organisasjon-tilgang-service/config.yml +++ b/apps/organisasjon-tilgang-service/config.yml @@ -26,8 +26,6 @@ spec: rules: - application: dolly-frontend-dev cluster: dev-gcp - - application: dolly-backend-dev - cluster: dev-gcp - application: team-dolly-lokal-app cluster: dev-gcp - application: testnav-oversikt-frontend diff --git a/proxies/statisk-data-forvalter-proxy/config.yml b/proxies/statisk-data-forvalter-proxy/config.yml index 19921b1a28f..290dcac8cc9 100644 --- a/proxies/statisk-data-forvalter-proxy/config.yml +++ b/proxies/statisk-data-forvalter-proxy/config.yml @@ -25,10 +25,6 @@ spec: cluster: dev-gcp - application: dolly-frontend-dev cluster: dev-gcp - - application: dolly-backend - cluster: dev-gcp - - application: dolly-backend-dev - cluster: dev-gcp - application: testnav-oversikt-frontend cluster: dev-gcp - application: app-1