diff --git a/.github/workflows/proxy.fullmakt-proxy.yml b/.github/workflows/proxy.fullmakt-proxy.yml new file mode 100644 index 00000000000..61fcec6e944 --- /dev/null +++ b/.github/workflows/proxy.fullmakt-proxy.yml @@ -0,0 +1,24 @@ +name: fullmakt-proxy + +on: + push: + paths: + - "plugins/**" + - "libs/reactive-core/**" + - "libs/reactive-proxy/**" + - "libs/reactive-security/**" + - "libs/security-core/**" + - "proxies/fullmakt-proxy/**" + - ".github/workflows/proxy.fullmakt-proxy.yml" + +jobs: + workflow: + uses: ./.github/workflows/common.workflow.backend.yml + with: + cluster: "dev-fss" + working-directory: "proxies/fullmakt-proxy" + deploy-tag: "#deploy-proxy-fullmakt" + permissions: + contents: read + id-token: write + secrets: inherit diff --git a/apps/budpro-service/Dockerfile b/apps/budpro-service/Dockerfile index c120cde561e..ee674571057 100644 --- a/apps/budpro-service/Dockerfile +++ b/apps/budpro-service/Dockerfile @@ -1,8 +1,10 @@ FROM ghcr.io/navikt/baseimages/temurin:21 LABEL maintainer="Team Dolly" -ADD build/libs/app.jar /app/app.jar +COPY build/libs/app.jar /app/app.jar -ENV JAVA_OPTS="-Dspring.profiles.active=prod" +RUN wget -q https://storage.googleapis.com/cloud-profiler/java/latest/profiler_java_agent.tar.gz -P /app/agent && tar xzf /app/agent/profiler_java_agent.tar.gz -C /app/agent && rm /app/agent/profiler_java_agent.tar.gz + +ENV JAVA_OPTS="-Dspring.profiles.active=prod -agentpath:/app/agent/profiler_java_agent.so=-cprof_project_id=dolly-dev-ff83,-cprof_service=testnav-budpro-service,-cprof_enable_heap_sampling=true,-logtostderr,-minloglevel=1" EXPOSE 8080 \ No newline at end of file diff --git a/apps/budpro-service/config.yml b/apps/budpro-service/config.yml index d950398921c..78ea66f500d 100644 --- a/apps/budpro-service/config.yml +++ b/apps/budpro-service/config.yml @@ -40,4 +40,10 @@ spec: path: "/internal/health/readiness" replicas: min: 1 - max: 1 \ No newline at end of file + max: 1 + gcp: + permissions: + - resource: + apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1 + kind: Project + role: roles/cloudprofiler.agent \ No newline at end of file diff --git a/apps/dolly-backend/README.md b/apps/dolly-backend/README.md index 8dc51e7463d..060a153a43d 100644 --- a/apps/dolly-backend/README.md +++ b/apps/dolly-backend/README.md @@ -24,7 +24,7 @@ https://dolly-backend.intern.dev.nav.no/swagger-ui.html ## Kjør lokalt * Se [generell informasjon](../../docs/local_general.md). * Applikasjonen er avhengig av en database i GCP, se [egen dokumentasjon](../../docs/gcp_db.md). -* Applikasjonen er avhengig av Elasticsearch: +* Applikasjonen er avhengig av OpenSearch: ```aiexclude > docker run -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "plugins.security.disabled=true" -e "OPENSEARCH_INITIAL_ADMIN_PASSWORD=YLAgOm}rz#o6#Aq" --name opensearch -d opensearchproject/opensearch:latest ``` diff --git a/apps/dolly-backend/build.gradle b/apps/dolly-backend/build.gradle index dd6d924a330..e54384a2308 100644 --- a/apps/dolly-backend/build.gradle +++ b/apps/dolly-backend/build.gradle @@ -21,6 +21,7 @@ dependencies { implementation 'no.nav.testnav.libs:data-transfer-objects' implementation 'no.nav.testnav.libs:data-transfer-search-objects' implementation 'no.nav.testnav.libs:reactive-core' + implementation 'no.nav.testnav.libs:vault' implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:$versions.springdoc" implementation "io.swagger.core.v3:swagger-annotations-jakarta:$versions.swagger" diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/util/AaregUtility.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/util/AaregUtility.java index b57ac8a83df..b2bd7c67339 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/util/AaregUtility.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/util/AaregUtility.java @@ -24,7 +24,7 @@ public static boolean isEqualArbeidsforhold(Arbeidsforhold response, Arbeidsforh return (isArbeidsgiverOrganisasjonAlike(response, request) || isArbeidsgiverPersonAlike(response, request)) && - response.getType().equals(request.getType()); + response.getArbeidsforholdId().equals(request.getArbeidsforholdId()); } public static ArbeidsforholdEksistens doEksistenssjekk(ArbeidsforholdRespons response, diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/FullmaktClient.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/FullmaktClient.java new file mode 100644 index 00000000000..5b48dade5c8 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/FullmaktClient.java @@ -0,0 +1,101 @@ +package no.nav.dolly.bestilling.fullmakt; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import no.nav.dolly.bestilling.ClientFuture; +import no.nav.dolly.bestilling.ClientRegister; +import no.nav.dolly.bestilling.fullmakt.dto.FullmaktResponse; +import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; +import no.nav.dolly.domain.jpa.BestillingProgress; +import no.nav.dolly.domain.resultset.RsDollyUtvidetBestilling; +import no.nav.dolly.domain.resultset.dolly.DollyPerson; +import no.nav.dolly.errorhandling.ErrorStatusDecoder; +import no.nav.dolly.util.TransactionHelperService; +import no.nav.testnav.libs.data.pdlforvalter.v1.PersonDTO; +import no.nav.testnav.libs.data.pdlforvalter.v1.RelasjonType; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; + +import static java.util.Objects.isNull; +import static no.nav.dolly.errorhandling.ErrorStatusDecoder.getInfoVenter; +import static org.apache.http.util.TextUtils.isBlank; + +@Slf4j +@Service +@RequiredArgsConstructor +public class FullmaktClient implements ClientRegister { + + private static final String FULLMAKT_REPRESENTASJON = "FULLMAKT_REPR#"; + + private final ErrorStatusDecoder errorStatusDecoder; + private final TransactionHelperService transactionHelperService; + private final FullmaktConsumer fullmaktConsumer; + private final PdlDataConsumer pdlDataConsumer; + + @Override + public Flux gjenopprett(RsDollyUtvidetBestilling bestilling, DollyPerson dollyPerson, BestillingProgress progress, boolean isOpprettEndre) { + + if (!bestilling.getFullmakt().isEmpty()) { + + return Flux.fromIterable(bestilling.getFullmakt()) + .doOnNext(ordre -> + transactionHelperService.persister(progress, BestillingProgress::setFullmaktStatus, + getInfoVenter("Fullmakt (Representasjon)"))) + .flatMap(fullmakt -> { + fullmakt.setFullmaktsgiver(dollyPerson.getIdent()); + if (isBlank(fullmakt.getFullmektig())) { + return pdlDataConsumer.getPersoner(List.of(dollyPerson.getIdent())) + .flatMap(person -> Flux.fromIterable(person.getRelasjoner()) + .filter(relasjon -> relasjon.getRelasjonType().equals(RelasjonType.FULLMEKTIG))) + .next() + .map(relasjon -> { + fullmakt.setFullmektigsNavn(getFullName(relasjon.getRelatertPerson())); + fullmakt.setFullmektig(relasjon.getRelatertPerson().getIdent()); + return fullmakt; + }); + } else { + return Mono.just(fullmakt); + } + }) + .collectList() + .flatMapMany(fullmakter -> fullmaktConsumer.createFullmaktData(fullmakter, dollyPerson.getIdent())) + .map(this::getStatus) + .map(status -> futurePersist(progress, status)); + } + + return Flux.empty(); + } + + @Override + public void release(List identer) { + + identer.forEach(ident -> fullmaktConsumer.getFullmaktData(List.of(ident)).subscribe( + fullmakter -> fullmakter.getFullmakt() + .forEach(fullmakt -> fullmaktConsumer + .deleteFullmaktData(ident, fullmakt.getFullmaktId()).subscribe()))); + } + + private ClientFuture futurePersist(BestillingProgress progress, String status) { + + return () -> { + transactionHelperService.persister(progress, BestillingProgress::setFullmaktStatus, status); + return progress; + }; + } + + private String getStatus(FullmaktResponse response) { + + return isNull(response.getStatus()) ? "OK" : + errorStatusDecoder.getErrorText(response.getStatus(), response.getMelding()); + } + + private String getFullName(PersonDTO person) { + var navn = person.getNavn().getFirst(); + return (isBlank(navn.getMellomnavn())) + ? "%s %s".formatted(navn.getFornavn(), navn.getEtternavn()) + : "%s %s %s".formatted(navn.getFornavn(), navn.getMellomnavn(), navn.getEtternavn()); + } +} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/FullmaktConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/FullmaktConsumer.java new file mode 100644 index 00000000000..e70a37d621b --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/FullmaktConsumer.java @@ -0,0 +1,87 @@ +package no.nav.dolly.bestilling.fullmakt; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import no.nav.dolly.bestilling.ConsumerStatus; +import no.nav.dolly.bestilling.fullmakt.command.DeleteFullmaktDataCommand; +import no.nav.dolly.bestilling.fullmakt.command.GetFullmaktDataCommand; +import no.nav.dolly.bestilling.fullmakt.command.PostFullmaktDataCommand; +import no.nav.dolly.bestilling.fullmakt.dto.FullmaktResponse; +import no.nav.dolly.config.Consumers; +import no.nav.dolly.domain.resultset.fullmakt.RsFullmakt; +import no.nav.dolly.metrics.Timed; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; +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 java.time.Duration; +import java.util.List; + +import static no.nav.dolly.util.JacksonExchangeStrategyUtil.getJacksonStrategy; + +@Slf4j +@Service +public class FullmaktConsumer implements ConsumerStatus { + + private final WebClient webClient; + private final TokenExchange tokenService; + private final ServerProperties serverProperties; + + public FullmaktConsumer( + TokenExchange tokenService, + Consumers consumers, + ObjectMapper objectMapper, + WebClient.Builder webClientBuilder + ) { + this.tokenService = tokenService; + serverProperties = consumers.getTestnavFullmaktProxy(); + this.webClient = webClientBuilder + .baseUrl(serverProperties.getUrl()) + .exchangeStrategies(getJacksonStrategy(objectMapper)) + .build(); + } + + @Timed(name = "providers", tags = { "operation", "fullmakt_createData" }) + public Flux createFullmaktData(List fullmakter, String ident) { + + log.info("Fullmakt opprett {}", fullmakter); + return tokenService.exchange(serverProperties) + .flatMapMany(token -> + Flux.range(0, fullmakter.size()) + .delayElements(Duration.ofMillis(100)) + .flatMap(idx -> new PostFullmaktDataCommand(webClient, token.getTokenValue(), ident, fullmakter.get(idx)).call())); + } + + @Timed(name = "providers", tags = { "operation", "fullmakt_getData" }) + public Flux getFullmaktData(List identer) { + + return tokenService.exchange(serverProperties) + .flatMapMany(token -> Flux.range(0, identer.size()) + .delayElements(Duration.ofMillis(50)) + .flatMap(idx -> new GetFullmaktDataCommand(webClient, identer.get(idx), + token.getTokenValue()).call())); + } + + @Timed(name = "providers", tags = { "operation", "fullmakt_getData" }) + public Mono> deleteFullmaktData(String ident, Integer fullmaktId) { + + return tokenService.exchange(serverProperties) + .flatMap(token -> new DeleteFullmaktDataCommand(webClient, ident, fullmaktId, + token.getTokenValue()).call()); + } + + @Override + public String serviceUrl() { + return serverProperties.getUrl(); + } + + @Override + public String consumerName() { + return "testnav-fullmakt-proxy"; + } + +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/command/DeleteFullmaktDataCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/command/DeleteFullmaktDataCommand.java new file mode 100644 index 00000000000..12af028bd13 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/command/DeleteFullmaktDataCommand.java @@ -0,0 +1,52 @@ +package no.nav.dolly.bestilling.fullmakt.command; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import no.nav.dolly.util.RequestHeaderUtil; +import no.nav.testnav.libs.reactivecore.utils.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; + +@Slf4j +@RequiredArgsConstructor +public class DeleteFullmaktDataCommand implements Callable>> { + + private static final String DELETE_FULLMAKT_URL = "/api/fullmakt/{fullmaktId}"; + + private final WebClient webClient; + private final String ident; + private final Integer fullmaktId; + private final String token; + + public Mono> call() { + + return webClient.get() + .uri(uriBuilder -> uriBuilder + .path(DELETE_FULLMAKT_URL) + .build(fullmaktId)) + .header(HEADER_NAV_CALL_ID, RequestHeaderUtil.getNavCallId()) + .header(HEADER_NAV_CONSUMER_ID, CONSUMER) + .header("fnr", ident) + .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) + .header(UserConstant.USER_HEADER_JWT, getUserJwt()) + .retrieve() + .toBodilessEntity() + .doOnError(WebClientFilter::logErrorMessage) + .doOnSuccess(response -> log.info("Fullmakt with id {} deleted for person with ident {}", fullmaktId, ident)) + .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) + .filter(WebClientFilter::is5xxException)) + .doOnError(WebClientFilter::logErrorMessage); + } +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/command/GetFullmaktDataCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/command/GetFullmaktDataCommand.java new file mode 100644 index 00000000000..9281463a988 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/command/GetFullmaktDataCommand.java @@ -0,0 +1,50 @@ +package no.nav.dolly.bestilling.fullmakt.command; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import no.nav.dolly.bestilling.fullmakt.dto.FullmaktResponse; +import no.nav.dolly.util.RequestHeaderUtil; +import no.nav.testnav.libs.reactivecore.utils.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.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 +@RequiredArgsConstructor +public class GetFullmaktDataCommand implements Callable> { + + private static final String HENT_FULLMAKT_URL = "/api/fullmektig"; + + private final WebClient webClient; + private final String ident; + private final String token; + + public Flux call() { + + return webClient.get() + .uri(uriBuilder -> uriBuilder + .path(HENT_FULLMAKT_URL) + .build()) + .header(HEADER_NAV_CALL_ID, RequestHeaderUtil.getNavCallId()) + .header(HEADER_NAV_CONSUMER_ID, CONSUMER) + .header("fnr", ident) + .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) + .header(UserConstant.USER_HEADER_JWT, getUserJwt()) + .retrieve() + .bodyToFlux(FullmaktResponse.class) + .doOnError(WebClientFilter::logErrorMessage) + .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) + .filter(WebClientFilter::is5xxException)) + .doOnError(WebClientFilter::logErrorMessage); + } +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/command/PostFullmaktDataCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/command/PostFullmaktDataCommand.java new file mode 100644 index 00000000000..b5f9c68bf3a --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/command/PostFullmaktDataCommand.java @@ -0,0 +1,73 @@ +package no.nav.dolly.bestilling.fullmakt.command; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import no.nav.dolly.bestilling.fullmakt.dto.FullmaktResponse; +import no.nav.dolly.domain.resultset.fullmakt.RsFullmakt; +import no.nav.dolly.util.RequestHeaderUtil; +import no.nav.testnav.libs.reactivecore.utils.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.BodyInserters; +import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.web.reactive.function.client.WebClientResponseException; +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; +import static org.apache.http.util.TextUtils.isBlank; + +@Slf4j +@RequiredArgsConstructor +public class PostFullmaktDataCommand implements Callable> { + + private static final String POST_FULLMAKT_URL = "/api/fullmakt"; + + private final WebClient webClient; + private final String token; + private final String ident; + private final RsFullmakt request; + + public Mono call() { + + if (isBlank(request.getFullmektig())) { + log.error("Klarte ikke å hente fullmektig relasjon for ident: {} fra PDL forvalter ", ident); + return Mono.just(FullmaktResponse.builder() + .status(HttpStatus.BAD_REQUEST) + .melding("Fullmakt mangler fullmektig for ident: " + ident) + .build()); + } + + return webClient.post() + .uri(uriBuilder -> uriBuilder + .path(POST_FULLMAKT_URL) + .build()) + .body(BodyInserters.fromValue(request)) + .header(HEADER_NAV_CALL_ID, RequestHeaderUtil.getNavCallId()) + .header(HEADER_NAV_CONSUMER_ID, CONSUMER) + .header("fnr", ident) + .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) + .header(UserConstant.USER_HEADER_JWT, getUserJwt()) + .retrieve() + .bodyToMono(FullmaktResponse.class) + .doOnError(WebClientFilter::logErrorMessage) + .doOnError(throwable -> { + if (throwable instanceof WebClientResponseException ex) { + if (ex.getStatusCode() == HttpStatus.BAD_REQUEST) { + log.error("Bad request mot pdl-fullmakt, response: {}", ex.getResponseBodyAsString()); + } + } + }) + .doOnSuccess(response -> log.info("Fullmakt opprettet for person {}, response: {}", ident, response)) + .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) + .filter(WebClientFilter::is5xxException)) + .doOnError(WebClientFilter::logErrorMessage); + } +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/dto/FullmaktResponse.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/dto/FullmaktResponse.java new file mode 100644 index 00000000000..24f9df82217 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/fullmakt/dto/FullmaktResponse.java @@ -0,0 +1,75 @@ +package no.nav.dolly.bestilling.fullmakt.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.http.HttpStatus; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +import static java.util.Objects.isNull; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class FullmaktResponse { + + private HttpStatus status; + private String melding; + private List fullmakt; + + public List getFullmakt() { + if (isNull(fullmakt)) { + fullmakt = new ArrayList<>(); + } + return fullmakt; + } + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class Fullmakt { + + private Integer fullmaktId; + private LocalDateTime registrert; + private String registrertAv; + private LocalDateTime endret; + private String endretAv; + private Boolean opphoert; + private String fullmaktsgiver; + private String fullmektig; + private List omraade; + private LocalDate gyldigFraOgMed; + private LocalDate gyldigTilOgMed; + private String fullmaktUuid; + private String opplysningsId; + private Integer endringsId; + private String status; + private String kilde; + private String fullmaktsgiverNavn; + private String fullmektigsNavn; + + + public List getOmraade() { + if (isNull(omraade)) { + omraade = new ArrayList<>(); + } + return omraade; + } + } + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class Omraade { + private String tema; + private List handling; + } +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterClient.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterClient.java index 96127319d0d..44a268944c0 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterClient.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterClient.java @@ -410,12 +410,6 @@ private Flux lagreAlderspensjon(PensjonData pensjonDat .flatMap(Flux::from); } - private static boolean hasVedtak(List pensjonsvedtak, SakType type) { - - return pensjonsvedtak.stream().anyMatch(entry -> entry.getSakType() == type && - entry.getSisteOppdatering().contains("opprettet")); - } - private Flux lagreUforetrygd(PensjonData pensjondata, String navEnhetNr, String ident, Set miljoer, Long bestillingId) { @@ -559,7 +553,7 @@ private Flux lagreAfpOffentlig(PensjonData pensjonData var context = MappingContextUtils.getMappingContext(); context.setProperty(IDENT, ident); var request = mapperFacade.map(pensjon, AfpOffentligRequest.class, context); - return pensjonforvalterConsumer.lagreAfpOffentlig(request, miljoe); + return pensjonforvalterConsumer.lagreAfpOffentlig(request, ident, miljoe); })); } @@ -584,6 +578,12 @@ private String toJson(Object object) { return null; } + private static boolean hasVedtak(List pensjonsvedtak, SakType type) { + + return pensjonsvedtak.stream().anyMatch(entry -> entry.getSakType() == type && + entry.getSisteOppdatering().contains("opprettet")); + } + private static Mono> getPdlPerson(Flux persondata) { return persondata 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 b7e83723674..af14b85f811 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 @@ -193,10 +193,10 @@ public Flux hentVedtak(String ident, String miljoe) { } @Timed(name = "providers", tags = {"operation", "pen_lagreAfpOffentlig"}) - public Flux lagreAfpOffentlig(AfpOffentligRequest afpOffentligRequest, String miljoe) { + public Flux lagreAfpOffentlig(AfpOffentligRequest afpOffentligRequest, String ident, String miljoe) { return tokenService.exchange(serverProperties) - .flatMapMany(token -> new LagreAfpOffentligCommand(webClient, afpOffentligRequest, miljoe, token.getTokenValue()).call()); + .flatMapMany(token -> new LagreAfpOffentligCommand(webClient, afpOffentligRequest, ident, miljoe, token.getTokenValue()).call()); } @Timed(name = "providers", tags = {"operation", "pen_sletteAfpOffentlig"}) diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreAfpOffentligCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreAfpOffentligCommand.java index 8bcbe60a52b..5fa541bc19b 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreAfpOffentligCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreAfpOffentligCommand.java @@ -25,16 +25,12 @@ public class LagreAfpOffentligCommand implements Callable call() { - var ident = afpOffentligRequest - .getMocksvar().stream() - .map(AfpOffentligRequest.AfpOffentligStub::getFnr) - .findFirst().orElse(null); - var callId = generateCallId(); log.info("Pensjon afp-offentlig {} {}, callId: {}", miljoe, afpOffentligRequest, callId); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java index 552dd1854e0..48751cb8787 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java @@ -28,6 +28,7 @@ public class Consumers { private ServerProperties testnavInstProxy; private ServerProperties testnavKodeverkService; private ServerProperties testnavKontoregisterPersonProxy; + private ServerProperties testnavFullmaktProxy; private ServerProperties testnavKrrstubProxy; private ServerProperties testnavMedlProxy; private ServerProperties testnavMiljoerService; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/LocalConfig.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/LocalConfig.java index 2a2cedf8ceb..00c3ffa14e7 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/LocalConfig.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/config/LocalConfig.java @@ -1,10 +1,12 @@ package no.nav.dolly.config; + import no.nav.testnav.libs.database.config.FlywayConfiguration; import no.nav.testnav.libs.database.config.VaultHikariConfiguration; import no.nav.testnav.libs.vault.AbstractLocalVaultConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Profile; + @Configuration @Profile("local") @Import({ diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java index b7d5586db10..cf897a72623 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java @@ -58,6 +58,9 @@ public class BestillingProgress implements Serializable { @Column(name = "KRRSTUB_STATUS") private String krrstubStatus; + @Column(name = "FULLMAKT_STATUS") + private String fullmaktStatus; + @Column(name = "MEDL_STATUS") private String medlStatus; @@ -173,6 +176,7 @@ public boolean equals(Object o) { .append(getBestilling(), that.getBestilling()) .append(getIdent(), that.getIdent()) .append(getSigrunstubStatus(), that.getSigrunstubStatus()) + .append(getFullmaktStatus(), that.getFullmaktStatus()) .append(getKrrstubStatus(), that.getKrrstubStatus()) .append(getMedlStatus(), that.getMedlStatus()) .append(getUdistubStatus(), that.getUdistubStatus()) @@ -208,6 +212,7 @@ public int hashCode() { .append(getIdent()) .append(getSigrunstubStatus()) .append(getKrrstubStatus()) + .append(getFullmaktStatus()) .append(getMedlStatus()) .append(getUdistubStatus()) .append(getAaregStatus()) @@ -242,6 +247,7 @@ public String toString() { ", ident='" + ident + '\'' + ", sigrunstubStatus='" + sigrunstubStatus + '\'' + ", krrstubStatus='" + krrstubStatus + '\'' + + ", fullmaktStatus='" + fullmaktStatus + '\'' + ", medlStatus='" + medlStatus + '\'' + ", udistubStatus='" + udistubStatus + '\'' + ", aaregStatus='" + aaregStatus + '\'' + diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/BestilteKriterier.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/BestilteKriterier.java index fe57c6e9900..be5175bd55d 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/BestilteKriterier.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/BestilteKriterier.java @@ -10,6 +10,7 @@ import no.nav.dolly.domain.resultset.arenaforvalter.Arenadata; import no.nav.dolly.domain.resultset.breg.RsBregdata; import no.nav.dolly.domain.resultset.dokarkiv.RsDokarkiv; +import no.nav.dolly.domain.resultset.fullmakt.RsFullmakt; import no.nav.dolly.domain.resultset.histark.RsHistark; import no.nav.dolly.domain.resultset.inntektsmeldingstub.RsInntektsmelding; import no.nav.dolly.domain.resultset.inntektstub.InntektMultiplierWrapper; @@ -54,6 +55,7 @@ public class BestilteKriterier { private RsInntektsmelding inntektsmelding; private RsBregdata brregstub; private RsDokarkiv dokarkiv; + private List fullmakt; private RsMedl medl; private RsHistark histark; private RsTpsMessaging tpsMessaging; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/RsDollyBestilling.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/RsDollyBestilling.java index 048cde79b94..a59a8123373 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/RsDollyBestilling.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/RsDollyBestilling.java @@ -11,6 +11,7 @@ import no.nav.dolly.domain.resultset.arenaforvalter.Arenadata; import no.nav.dolly.domain.resultset.breg.RsBregdata; import no.nav.dolly.domain.resultset.dokarkiv.RsDokarkiv; +import no.nav.dolly.domain.resultset.fullmakt.RsFullmakt; import no.nav.dolly.domain.resultset.histark.RsHistark; import no.nav.dolly.domain.resultset.inntektsmeldingstub.RsInntektsmelding; import no.nav.dolly.domain.resultset.inntektstub.InntektMultiplierWrapper; @@ -59,6 +60,7 @@ public class RsDollyBestilling { private String malBestillingNavn; private PdlPersondata pdldata; private RsDigitalKontaktdata krrstub; + private List fullmakt; private RsMedl medl; private List instdata; private List aareg; @@ -115,6 +117,13 @@ public List getInstdata() { return instdata; } + public List getFullmakt() { + if (isNull(fullmakt)) { + fullmakt = new ArrayList<>(); + } + return fullmakt; + } + public List getYrkesskader() { if (isNull(yrkesskader)) { yrkesskader = new ArrayList<>(); 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 016e3966b17..2d6f4a2d8c4 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 @@ -23,6 +23,7 @@ public enum SystemTyper { INST2("Institusjonsopphold (INST2)"), KONTOREGISTER("Bankkontoregister"), KRRSTUB("Digital kontaktinformasjon (DKIF)"), + FULLMAKT("Fullmakt (Representasjon)"), MEDL("Medlemskap (MEDL)"), ORGANISASJON_FORVALTER("Enhetsregisteret (EREG)"), PDLIMPORT("Import av personer (TESTNORGE)"), diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/fullmakt/RsFullmakt.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/fullmakt/RsFullmakt.java new file mode 100644 index 00000000000..e33601537c2 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/fullmakt/RsFullmakt.java @@ -0,0 +1,54 @@ +package no.nav.dolly.domain.resultset.fullmakt; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.elasticsearch.annotations.DateFormat; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +import static java.util.Objects.isNull; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class RsFullmakt { + + @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second, pattern = "uuuu-MM-dd'T'HH:mm:ss") + private LocalDateTime gyldigFraOgMed; + @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second, pattern = "uuuu-MM-dd'T'HH:mm:ss") + private LocalDateTime gyldigTilOgMed; + private String fullmektig; + private String fullmektigsNavn; + private String fullmaktsgiver; + private List omraade; + + public List getOmraade() { + if (isNull(omraade)) { + omraade = new ArrayList<>(); + } + return omraade; + } + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class Omraade { + private String tema; + private List handling; + + public List getHandling() { + if (isNull(handling)) { + handling = new ArrayList<>(); + } + return handling; + } + } +} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java index 15a18aaeaab..3215136f78e 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java @@ -10,6 +10,7 @@ import no.nav.dolly.domain.resultset.arenaforvalter.Arenadata; import no.nav.dolly.domain.resultset.breg.RsBregdata; import no.nav.dolly.domain.resultset.dokarkiv.RsDokarkiv; +import no.nav.dolly.domain.resultset.fullmakt.RsFullmakt; import no.nav.dolly.domain.resultset.histark.RsHistark; import no.nav.dolly.domain.resultset.inntektsmeldingstub.RsInntektsmelding; import no.nav.dolly.domain.resultset.inntektstub.InntektMultiplierWrapper; @@ -48,20 +49,13 @@ public class ElasticBestilling implements Persistable { @Id private Long id; - - @Override - @JsonIgnore - @Transient - public boolean isNew() { - - return false; - } - @Field private PdlPersondata pdldata; @Field private RsDigitalKontaktdata krrstub; @Field + private List fullmakt; + @Field private RsMedl medl; @Field private List instdata; @@ -101,11 +95,18 @@ public boolean isNew() { private List yrkesskader; @Field private List identer; - @Transient @JsonIgnore private boolean ignore; + @Override + @JsonIgnore + @Transient + public boolean isNew() { + + return false; + } + public List getIdenter() { if (isNull(identer)) { identer = new ArrayList<>(); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticTyper.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticTyper.java index 958aea25af3..3aec2c68ca8 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticTyper.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticTyper.java @@ -1,35 +1,39 @@ package no.nav.dolly.elastic; +import lombok.Getter; + +@Getter public enum ElasticTyper { - AAREG("Arbeidsregister (AAREG)"), - INST("Institusjonsopphold (INST2)"), - KRRSTUB("Digital kontaktinformasjon (DKIF)"), - SIGRUN_LIGNET("Lignet skatteinntekt (Sigrunstub)"), - SIGRUN_PENSJONSGIVENDE("Pensjonsgivende inntekt (Sigrunstub)"), + AAREG("Arbeidsgiver/arbeidstaker-register (AAREG)"), + ARBEIDSPLASSENCV("Arbeidsplassen CV"), ARENA_AAP("Arena AAP ytelse"), ARENA_AAP115("Arena AAP115 rettighet"), ARENA_DAGP("Arena dagpenger"), - UDISTUB("Utlendingsdirektoratet (UDI)"), - INNTK("Inntektskomponenten (INNTK)"), - PEN_INNTEKT("Pensjonsopptjening (POPP)"), - PEN_TP("Tjenestepensjon (TP)"), - PEN_AP("Alderspensjon (AP)"), - PEN_UT("Uføretrygd (UT)"), - PEN_AFP_OFFENTLIG("AFP offentlig (PEN"), - PEN_PENSJONSAVTALE("Pensjonsavtaler (PEN)"), - INNTKMELD("Inntektsmelding (ALTINN/JOARK)"), + BANKKONTO("Bankkontoregister"), + BANKKONTO_NORGE("Bankkonto i Norge"), + BANKKONTO_UTLAND("Bankkonto i utlandet"), BRREGSTUB("Brønnøysundregistrene (BRREGSTUB)"), DOKARKIV("Dokumentarkiv (JOARK)"), + FULLMAKT("Fullmakt (Representasjon)"), + HISTARK("Historisk arkiv (HISTARK)"), + INNTK("Inntektskomponenten/stub (INNTK)"), + INNTKMELD("Inntektsmelding (ALTINN/JOARK)"), + INST("Institusjonsopphold (INST2)"), + KRRSTUB("Kontakt- og reservasjonsregister-stub"), MEDL("Medlemskap (MEDL)"), - HISTARK("Saksmappearkiv (HISTARK)"), - SYKEMELDING("NAV sykemelding"), + PEN_AFP_OFFENTLIG("Pensjon - AFP offentlig"), + PEN_AP("Pensjon - Alderspensjon (AP)"), + PEN_INNTEKT("Pensjon - Pensjonsinntekt/opptjening"), + PEN_PENSJONSAVTALE("Pensjon - Pensjonsavtaler"), + PEN_TP("Pensjon - Tjenestepensjon (TP)"), + PEN_UT("Pensjon - Uføretrygd (UT)"), + SIGRUN_LIGNET("Sigrunstub - Lignet skatteinntekt"), + SIGRUN_PENSJONSGIVENDE("Sigrunstub - Pensjonsgivende inntekt"), + SKATTEKORT("Skattekort (SOKOS)"), SKJERMING("Skjermingsregisteret"), - BANKKONTO("Bankkontoregister"), - BANKKONTO_NORGE("Norsk bankkonto"), - BANKKONTO_UTLAND("Utenlandsk bankkonto"), - ARBEIDSPLASSENCV("Arbeidsplassen CV"), - SKATTEKORT("SOKOS"), + SYKEMELDING("Sykemelding"), + UDISTUB("Udistub - Utlendingsdirektoratet"), YRKESSKADE("Yrkesskade"); private final String beskrivelse; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/dto/Kategori.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/dto/Kategori.java new file mode 100644 index 00000000000..dc24cf3e4ac --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/dto/Kategori.java @@ -0,0 +1,16 @@ +package no.nav.dolly.elastic.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class Kategori { + + private String type; + private String beskrivelse; +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/dto/PersonRequest.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/dto/PersonRequest.java index 33aaec8a904..bae94357878 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/dto/PersonRequest.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/dto/PersonRequest.java @@ -26,7 +26,6 @@ public class PersonRequest { private Boolean harDoedfoedtBarn; private Boolean harForeldreAnsvar; private Boolean harVerge; - private Boolean harFullmakt; private Boolean harDoedsfall; private Boolean harInnflytting; private Boolean harUtflytting; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/mapper/ElasticBestillingStrategyMapping.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/mapper/ElasticBestillingStrategyMapping.java index cf5c281b160..1eb230775fa 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/mapper/ElasticBestillingStrategyMapping.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/mapper/ElasticBestillingStrategyMapping.java @@ -14,6 +14,7 @@ import no.nav.dolly.mapper.MappingStrategy; import org.springframework.stereotype.Component; +import static java.util.Objects.nonNull; import static org.apache.logging.log4j.util.Strings.isBlank; @Slf4j @@ -26,6 +27,7 @@ public class ElasticBestillingStrategyMapping implements MappingStrategy { @Override public void register(MapperFactory factory) { + // Denne brukes ved initiell indexering av eksisterende bestillinger factory.classMap(Bestilling.class, ElasticBestilling.class) .customize(new CustomMapper<>() { @Override @@ -60,5 +62,27 @@ public void mapAtoB(Bestilling bestilling, ElasticBestilling elasticBestilling, } ) .register(); + + // Denne brukes ved fortløpende nyoppretting av bestillinger + factory.classMap(RsDollyBestilling.class, ElasticBestilling.class) + .customize(new CustomMapper<>() { + @Override + public void mapAtoB(RsDollyBestilling bestilling, ElasticBestilling elasticBestilling, MappingContext context) { + + if (nonNull(elasticBestilling.getDokarkiv())) { + elasticBestilling.getDokarkiv().getDokumenter() + .forEach(dokument -> dokument.getDokumentvarianter() + .forEach(dokumentVariant -> dokumentVariant.setFysiskDokument(null))); + } + + if (nonNull(elasticBestilling.getHistark())) { + elasticBestilling.getHistark().getDokumenter() + .forEach(dokument -> dokument.setFysiskDokument(null)); + } + } + } + ) + .byDefault() + .register(); } } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchQueryBuilder.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchQueryBuilder.java index 19af194e985..11d58149360 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchQueryBuilder.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchQueryBuilder.java @@ -24,7 +24,6 @@ import static no.nav.dolly.elastic.utils.OpenSearchPersonQueryUtils.addBostedUtlandQuery; import static no.nav.dolly.elastic.utils.OpenSearchPersonQueryUtils.addDoedsfallQuery; import static no.nav.dolly.elastic.utils.OpenSearchPersonQueryUtils.addForeldreQuery; -import static no.nav.dolly.elastic.utils.OpenSearchPersonQueryUtils.addFullmaktQuery; import static no.nav.dolly.elastic.utils.OpenSearchPersonQueryUtils.addHarBostedBydelsnrQuery; import static no.nav.dolly.elastic.utils.OpenSearchPersonQueryUtils.addHarDeltBostedQuery; import static no.nav.dolly.elastic.utils.OpenSearchPersonQueryUtils.addHarDoedfoedtbarnQuery; @@ -54,7 +53,7 @@ public class OpenSearchQueryBuilder { public static BoolQueryBuilder buildSearchQuery(SearchRequest request) { var queryBuilder = buildTyperQuery(request.getTyper().toArray(ElasticTyper[]::new)); - setPersonQuery(queryBuilder, request); + setPersonQuery(queryBuilder, request); return queryBuilder; } @@ -81,7 +80,6 @@ private void setPersonQuery(BoolQueryBuilder queryBuilder, SearchRequest request addHarDoedfoedtbarnQuery(queryBuilder, request); addHarForeldreansvarQuery(queryBuilder, request); addVergemaalQuery(queryBuilder, request); - addFullmaktQuery(queryBuilder, request); addDoedsfallQuery(queryBuilder, request); addHarInnflyttingQuery(queryBuilder, request); addHarUtflyttingQuery(queryBuilder, request); @@ -108,6 +106,7 @@ private void setPersonQuery(BoolQueryBuilder queryBuilder, SearchRequest request addIdenttypeQuery(queryBuilder, request); }); } + private QueryBuilder getFagsystemQuery(ElasticTyper type) { return switch (type) { @@ -130,6 +129,7 @@ private QueryBuilder getFagsystemQuery(ElasticTyper type) { case INNTKMELD -> QueryBuilders.existsQuery("inntektsmelding"); case BRREGSTUB -> QueryBuilders.existsQuery("brregstub"); case DOKARKIV -> QueryBuilders.existsQuery("dokarkiv"); + case FULLMAKT -> QueryBuilders.existsQuery("fullmakt"); case MEDL -> QueryBuilders.existsQuery("medl"); case HISTARK -> QueryBuilders.existsQuery("histark"); case SYKEMELDING -> QueryBuilders.existsQuery("sykemelding"); @@ -139,7 +139,7 @@ private QueryBuilder getFagsystemQuery(ElasticTyper type) { case BANKKONTO_UTLAND -> QueryBuilders.existsQuery("bankkonto.utenlandskBankkonto"); case ARBEIDSPLASSENCV -> QueryBuilders.existsQuery("arbeidsplassenCV"); case SKATTEKORT -> QueryBuilders.existsQuery("skattekort"); - case YRKESSKADE -> QueryBuilders.existsQuery("yrkesskade"); + case YRKESSKADE -> QueryBuilders.existsQuery("yrkesskader"); }; } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchService.java index 9fb08af57f1..1ee57bdc8e1 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/OpenSearchService.java @@ -9,6 +9,7 @@ import no.nav.dolly.elastic.consumer.ElasticParamsConsumer; import no.nav.dolly.elastic.dto.SearchRequest; import no.nav.dolly.elastic.dto.SearchResponse; +import no.nav.dolly.elastic.dto.Kategori; import org.opensearch.client.RequestOptions; import org.opensearch.client.RestHighLevelClient; import org.opensearch.index.query.BoolQueryBuilder; @@ -22,8 +23,9 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; +import java.util.Comparator; import java.util.List; +import java.util.stream.Stream; import static java.util.Objects.nonNull; @@ -61,6 +63,17 @@ public Mono deleteIndex() { return elasticParamsConsumer.deleteIndex(); } + public List getTyper() { + + return Stream.of(ElasticTyper.values()) + .map(entry -> Kategori.builder() + .type(entry.name()) + .beskrivelse(entry.getBeskrivelse()) + .build()) + .sorted(Comparator.comparing(Kategori::getBeskrivelse)) + .toList(); + } + private SearchResponse execQuery(BoolQueryBuilder query) { var searchRequest = new org.opensearch.action.search.SearchRequest(index); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/utils/OpenSearchPersonQueryUtils.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/utils/OpenSearchPersonQueryUtils.java index ddebb9927cf..1009c204cde 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/utils/OpenSearchPersonQueryUtils.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/utils/OpenSearchPersonQueryUtils.java @@ -65,13 +65,6 @@ public static void addDoedsfallQuery(BoolQueryBuilder queryBuilder, SearchReques } } - public static void addFullmaktQuery(BoolQueryBuilder queryBuilder, SearchRequest request) { - - if (isTrue(request.getPersonRequest().getHarFullmakt())) { - queryBuilder.must(existQuery("pdldata.person.fullmakt")); - } - } - public static void addHarInnflyttingQuery(BoolQueryBuilder queryBuilder, SearchRequest request) { if (isTrue(request.getPersonRequest().getHarInnflytting())) { diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingFullmaktStatusMapper.java b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingFullmaktStatusMapper.java new file mode 100644 index 00000000000..e67577ce6db --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingFullmaktStatusMapper.java @@ -0,0 +1,48 @@ +package no.nav.dolly.mapper; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import no.nav.dolly.domain.jpa.BestillingProgress; +import no.nav.dolly.domain.resultset.RsStatusRapport; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static java.util.Collections.emptyList; +import static java.util.Collections.singletonList; +import static no.nav.dolly.domain.resultset.SystemTyper.FULLMAKT; +import static no.nav.dolly.mapper.AbstractRsStatusMiljoeIdentForhold.decodeMsg; +import static no.nav.dolly.util.ListUtil.listOf; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class BestillingFullmaktStatusMapper { + + private static final String OK_STATUS = "Synkronisering mot fullmakt (Representasjon) tok"; + + public static List buildFullmaktStatusMap(List progressList) { + + Map> statusMap = new HashMap<>(); + + progressList.forEach(progress -> { + if (isNotBlank(progress.getFullmaktStatus())) { + var status = progress.getFullmaktStatus().contains(OK_STATUS) ? "OK" : progress.getFullmaktStatus(); + if (statusMap.containsKey(status)) { + statusMap.get(progress.getFullmaktStatus()).add(progress.getIdent()); + } else { + statusMap.put(progress.getFullmaktStatus(), listOf(progress.getIdent())); + } + } + }); + + return statusMap.isEmpty() ? emptyList() : + singletonList(RsStatusRapport.builder().id(FULLMAKT).navn(FULLMAKT.getBeskrivelse()) + .statuser(statusMap.entrySet().stream().map(entry -> RsStatusRapport.Status.builder() + .melding(decodeMsg(entry.getKey())) + .identer(entry.getValue()) + .build()) + .toList()) + .build()); + } +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingPdlOrdreStatusMapper.java b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingPdlOrdreStatusMapper.java index 78c77a4474e..1ac90d2a835 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingPdlOrdreStatusMapper.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingPdlOrdreStatusMapper.java @@ -17,6 +17,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Stream; import static java.lang.String.format; import static java.util.Collections.emptyList; @@ -57,22 +58,42 @@ private static void extractStatus(Map> meldingIdents, Besti var response = objectMapper.readValue(progress.getPdlOrdreStatus(), OrdreResponseDTO.class); var errors = collectErrors(response); - if (errors.isEmpty()) { - addElement(meldingIdents, "OK", progress.getIdent()); + if (errors.isEmpty() || response.getHovedperson().getOrdrer().stream() + .noneMatch(ordre -> ordre.getHendelser().stream() + .anyMatch(hendelse -> PdlStatus.FEIL == hendelse.getStatus()))) { - } else { - errors.forEach(error -> - addElement(meldingIdents, format(ELEMENT_ERROR_FMT, - error.getArtifact(), error.getId(), error.getError()), progress.getIdent()) - ); + addElement(meldingIdents, "OK", progress.getIdent()); } + errors.forEach(error -> + addElement(meldingIdents, format(ELEMENT_ERROR_FMT, + error.getArtifact(), error.getId(), error.getError()), + markRelation(error.getIdent(), progress.getIdent())) + ); + } catch (JsonProcessingException e) { addElement(meldingIdents, JSON_PARSE_ERROR, progress.getIdent()); log.error("Json parsing feilet: {}", e.getMessage(), e); } } + private static String markRelation(String ident, String hovedperson) { + + var person = new StringBuilder(); + + if (!hovedperson.equals(ident)) { + person.append('('); + } + + person.append(ident); + + if (!hovedperson.equals(ident)) { + person.append(')'); + } + + return person.toString(); + } + private static void addElement(Map> rapport, String melding, String ident) { if (rapport.containsKey(melding)) { @@ -85,16 +106,20 @@ private static void addElement(Map> rapport, String melding private static List collectErrors(OrdreResponseDTO response) { - return response.getHovedperson().getOrdrer().stream() - .filter(ordre -> !PdlArtifact.PDL_SLETTING.equals(ordre.getInfoElement())) - .filter(ordre -> ordre.getHendelser().stream().anyMatch(hendelse -> PdlStatus.FEIL == hendelse.getStatus())) - .map(ordre -> ordre.getHendelser().stream() - .filter(hendelse -> PdlStatus.FEIL == hendelse.getStatus()) - .map(hendelse -> PdlInternalStatus.builder() - .artifact(ordre.getInfoElement()) - .id(hendelse.getId()) - .error(hendelse.getError()) - .build()) + return Stream.of(List.of(response.getHovedperson()), + response.getRelasjoner()) + .flatMap(Collection::stream) + .map(personHendelse -> personHendelse.getOrdrer().stream() + .map(ordre -> ordre.getHendelser().stream() + .filter(hendelse -> PdlStatus.FEIL == hendelse.getStatus()) + .map(hendelse -> PdlInternalStatus.builder() + .artifact(ordre.getInfoElement()) + .ident(personHendelse.getIdent()) + .id(hendelse.getId()) + .error(hendelse.getError()) + .build()) + .toList()) + .flatMap(Collection::stream) .toList()) .flatMap(Collection::stream) .toList(); @@ -121,5 +146,6 @@ private static class PdlInternalStatus { private PdlArtifact artifact; private Integer id; private String error; + private String ident; } } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java index bf6bc1c59b9..8002bb88eac 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java @@ -25,6 +25,7 @@ import static no.nav.dolly.mapper.BestillingArenaforvalterStatusMapper.buildArenaStatusMap; import static no.nav.dolly.mapper.BestillingBrregStubStatusMapper.buildBrregStubStatusMap; import static no.nav.dolly.mapper.BestillingDokarkivStatusMapper.buildDokarkivStatusMap; +import static no.nav.dolly.mapper.BestillingFullmaktStatusMapper.buildFullmaktStatusMap; import static no.nav.dolly.mapper.BestillingHistarkStatusMapper.buildHistarkStatusMap; import static no.nav.dolly.mapper.BestillingImportFraPdlStatusMapper.buildImportFraPdlStatusMap; import static no.nav.dolly.mapper.BestillingInntektsmeldingStatusMapper.buildInntektsmeldingStatusMap; @@ -93,6 +94,7 @@ public void mapAtoB(Bestilling bestilling, RsBestillingStatus bestillingStatus, bestillingStatus.getStatus().addAll(buildAaregStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildInntektstubStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildKrrStubStatusMap(progresser)); + bestillingStatus.getStatus().addAll(buildFullmaktStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildMedlStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildSigrunStubStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildArenaStatusMap(progresser)); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/DollyRequest2MalBestillingMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/DollyRequest2MalBestillingMappingStrategy.java index f487e792178..d8f71bece20 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/DollyRequest2MalBestillingMappingStrategy.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/DollyRequest2MalBestillingMappingStrategy.java @@ -17,7 +17,6 @@ import no.nav.testnav.libs.dto.skattekortservice.v1.SkattekortRequestDTO; import org.springframework.stereotype.Component; -import static java.util.Objects.isNull; import static java.util.Objects.nonNull; @Component @@ -32,6 +31,7 @@ public void register(MapperFactory factory) { .field("bankkonto", "bankkonto") .field("brregstub", "brregstub") .field("dokarkiv", "dokarkiv") + .field("fullmakt", "fullmakt") .field("environments", "environments") .field("histark", "histark") .field("inntektsmelding", "inntektsmelding") diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/OpensearchController.java b/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/OpensearchController.java index 033f71e37b1..3ff4f4e7a40 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/OpensearchController.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/provider/api/OpensearchController.java @@ -8,6 +8,7 @@ import no.nav.dolly.elastic.ElasticTyper; import no.nav.dolly.elastic.dto.SearchRequest; import no.nav.dolly.elastic.dto.SearchResponse; +import no.nav.dolly.elastic.dto.Kategori; import no.nav.dolly.elastic.service.OpenSearchService; import no.nav.dolly.exceptions.NotFoundException; import org.springframework.web.bind.annotation.DeleteMapping; @@ -39,6 +40,13 @@ public List getAll(@PathVariable String ident) { return openSearchService.search(ident); } + @GetMapping("/typer") + @Operation(description = "Henter alle typer som kan søkes på") + public List getKategorier() { + + return openSearchService.getTyper(); + } + @GetMapping("/identer") @Operation(description = "Henter identer som matcher søk i request, registre kun") public SearchResponse getIdenterMed(@RequestParam ElasticTyper... typer) { diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java index af84fb9129a..9ff4f121a0f 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java @@ -395,6 +395,7 @@ public String getBestKriterier(RsDollyBestilling request) { .sigrunstubPensjonsgivende(request.getSigrunstubPensjonsgivende()) .arenaforvalter(request.getArenaforvalter()) .pdldata(request.getPdldata()) + .fullmakt(request.getFullmakt()) .instdata(request.getInstdata()) .inntektstub(request.getInntektstub()) .pensjonforvalter(request.getPensjonforvalter()) diff --git a/apps/dolly-backend/src/main/resources/application.yaml b/apps/dolly-backend/src/main/resources/application.yaml index 1bfe69daf7e..091b6e41c99 100644 --- a/apps/dolly-backend/src/main/resources/application.yaml +++ b/apps/dolly-backend/src/main/resources/application.yaml @@ -18,7 +18,7 @@ server: charset: UTF-8 error: include-message: always - max-http-request-header-size: 100KB + max-http-request-header-size: 128KB spring: cloud: @@ -144,6 +144,11 @@ consumers: namespace: dolly url: https://testnav-aareg-proxy.dev-fss-pub.nais.io cluster: dev-fss + testnav-fullmakt-proxy: + name: testnav-fullmakt-proxy + namespace: dolly + url: https://testnav-fullmakt-proxy.dev-fss-pub.nais.io + cluster: dev-fss testnav-krrstub-proxy: name: testnav-krrstub-proxy namespace: dolly diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/aareg/AaregConsumerTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/aareg/AaregConsumerTest.java index 42ee11142ff..2a3a2c43845 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/aareg/AaregConsumerTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/aareg/AaregConsumerTest.java @@ -3,7 +3,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import no.nav.dolly.bestilling.aareg.domain.ArbeidsforholdRespons; -import no.nav.dolly.elastic.BestillingElasticRepository; import no.nav.testnav.libs.dto.aareg.v1.Arbeidsforhold; import no.nav.testnav.libs.dto.aareg.v1.OrdinaerArbeidsavtale; import no.nav.testnav.libs.dto.aareg.v1.Organisasjon; @@ -17,7 +16,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.data.elasticsearch.core.ElasticsearchOperations; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -59,12 +57,6 @@ class AaregConsumerTest { @MockBean private TokenExchange tokenService; - @MockBean - private BestillingElasticRepository bestillingElasticRepository; - - @MockBean - private ElasticsearchOperations elasticsearchOperations; - private Arbeidsforhold opprettRequest; private ArbeidsforholdRespons arbeidsforholdRespons; @@ -106,8 +98,8 @@ void opprettArbeidsforhold() throws JsonProcessingException { .collectList() .block(); - assertThat(response.get(0).getArbeidsforholdId(), is(equalTo("1"))); - assertThat(response.get(0).getMiljo(), is(equalTo(MILJOE))); + assertThat(response.getFirst().getArbeidsforholdId(), is(equalTo("1"))); + assertThat(response.getFirst().getMiljo(), is(equalTo(MILJOE))); } @Test @@ -119,8 +111,8 @@ void oppdaterArbeidsforhold() throws JsonProcessingException { .collectList() .block(); - assertThat(response.get(0).getArbeidsforholdId(), is(equalTo("1"))); - assertThat(response.get(0).getMiljo(), is(equalTo(MILJOE))); + assertThat(response.getFirst().getArbeidsforholdId(), is(equalTo("1"))); + assertThat(response.getFirst().getMiljo(), is(equalTo(MILJOE))); } @Test diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/aareg/util/AaaregUtilityTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/aareg/util/AaaregUtilityTest.java index c0b80334a9f..a50552267f3 100644 --- a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/aareg/util/AaaregUtilityTest.java +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/aareg/util/AaaregUtilityTest.java @@ -39,7 +39,7 @@ private static Arbeidsforhold getArbeidsforhold(String arbeidsforholdId, Boolean @CsvSource({ "1, false, 1, 0, 1", "1, true, 1, 1, 0", "2, false, 1, 0, 1", - "2, true, 1, 1, 0" }) + "2, true, 1, 0, 1" }) void arbeidsforholdEksistens_eksisterIkke(String reqArbForholdId, Boolean isOppdatering, String respArbForholdId, int antallEksisterende, int antallNye) { diff --git a/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/fullmakt/FullmaktClientTest.java b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/fullmakt/FullmaktClientTest.java new file mode 100644 index 00000000000..c62397384c8 --- /dev/null +++ b/apps/dolly-backend/src/test/java/no/nav/dolly/bestilling/fullmakt/FullmaktClientTest.java @@ -0,0 +1,109 @@ +package no.nav.dolly.bestilling.fullmakt; + +import no.nav.dolly.bestilling.fullmakt.dto.FullmaktResponse; +import no.nav.dolly.bestilling.pdldata.PdlDataConsumer; +import no.nav.dolly.domain.jpa.BestillingProgress; +import no.nav.dolly.domain.resultset.RsDollyUtvidetBestilling; +import no.nav.dolly.domain.resultset.dolly.DollyPerson; +import no.nav.dolly.domain.resultset.fullmakt.RsFullmakt; +import no.nav.dolly.errorhandling.ErrorStatusDecoder; +import no.nav.dolly.util.TransactionHelperService; +import no.nav.testnav.libs.data.pdlforvalter.v1.FullPersonDTO; +import no.nav.testnav.libs.data.pdlforvalter.v1.NavnDTO; +import no.nav.testnav.libs.data.pdlforvalter.v1.PersonDTO; +import no.nav.testnav.libs.data.pdlforvalter.v1.RelasjonType; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import reactor.core.publisher.Flux; + +import java.time.LocalDateTime; +import java.util.List; + +import static java.util.Collections.emptyList; +import static java.util.Collections.singletonList; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class FullmaktClientTest { + + private static final String NAVN = "Fornavn Etternavn"; + private static final String IDENT = "12345611111"; + private static final String RELASJON_IDENT = "12345622222"; + + @Mock + private ErrorStatusDecoder errorStatusDecoder; + + @Mock + private TransactionHelperService transactionHelperService; + + @Mock + private FullmaktConsumer fullmaktConsumer; + + @Mock + private PdlDataConsumer pdlDataConsumer; + + @InjectMocks + private FullmaktClient fullmaktClient; + + @BeforeEach + public void setUp() { + MockitoAnnotations.openMocks(this); + } + + @Test + public void shouldSetMissingFullmektigFromPdlRelasjon() { + var bestilling = new RsDollyUtvidetBestilling(); + + bestilling.setFullmakt(List.of(RsFullmakt.builder() + .omraade(singletonList(RsFullmakt.Omraade.builder() + .tema("AAP") + .handling(singletonList("LES")) + .build())) + .fullmektigsNavn(NAVN) + .gyldigFraOgMed(LocalDateTime.of(2021, 1, 1, 0, 0)) + .gyldigTilOgMed(LocalDateTime.of(2022, 1, 1, 0, 0)) + .build())); + + var dollyPerson = DollyPerson.builder().ident(IDENT).build(); + var progress = new BestillingProgress(); + + var fullPersonDTO = FullPersonDTO.builder() + .person(PersonDTO.builder().ident(IDENT) + .build()) + .relasjoner(List.of( + FullPersonDTO.RelasjonDTO.builder() + .relasjonType(RelasjonType.FULLMEKTIG) + .relatertPerson(PersonDTO.builder() + .navn(singletonList(NavnDTO.builder() + .fornavn("Fornavn") + .etternavn("Etternavn") + .build())) + .ident(RELASJON_IDENT).build()) + .build() + )) + .build(); + + when(pdlDataConsumer.getPersoner(any())).thenReturn(Flux.just(fullPersonDTO)); + + var fullmaktResponse = FullmaktResponse.builder().fullmakt(emptyList()).build(); + when(fullmaktConsumer.createFullmaktData(any(), any())).thenReturn(Flux.just(fullmaktResponse)); + + var result = fullmaktClient.gjenopprett(bestilling, dollyPerson, progress, true); + + var clientFutures = result.collectList().block(); + assertEquals(1, clientFutures.size()); + + var fullmaktCaptor = ArgumentCaptor.forClass(List.class); + verify(fullmaktConsumer).createFullmaktData(fullmaktCaptor.capture(), any()); + + List capturedFullmaktList = fullmaktCaptor.getValue(); + assertEquals(RELASJON_IDENT, capturedFullmaktList.getFirst().getFullmektig()); + assertEquals(NAVN, capturedFullmaktList.getFirst().getFullmektigsNavn()); + } +} \ No newline at end of file diff --git a/apps/dolly-frontend/config.idporten.yml b/apps/dolly-frontend/config.idporten.yml index 26a1b76de43..4d9bce7df8e 100644 --- a/apps/dolly-frontend/config.idporten.yml +++ b/apps/dolly-frontend/config.idporten.yml @@ -61,6 +61,7 @@ spec: - host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io - host: testnav-krrstub-proxy.dev-fss-pub.nais.io + - host: testnav-fullmakt-proxy.dev-fss-pub.nais.io - host: testnav-udistub-proxy.dev-fss-pub.nais.io - host: testnav-inst-proxy.dev-fss-pub.nais.io - host: testnav-aareg-proxy.dev-fss-pub.nais.io diff --git a/apps/dolly-frontend/config.test.yml b/apps/dolly-frontend/config.test.yml index ab094b75d80..45bf1b3dbd2 100644 --- a/apps/dolly-frontend/config.test.yml +++ b/apps/dolly-frontend/config.test.yml @@ -67,6 +67,7 @@ spec: - host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io - host: testnav-krrstub-proxy.dev-fss-pub.nais.io + - host: testnav-fullmakt-proxy.dev-fss-pub.nais.io - host: testnav-udistub-proxy.dev-fss-pub.nais.io - host: testnav-inst-proxy.dev-fss-pub.nais.io - host: testnav-histark-proxy.dev-fss-pub.nais.io diff --git a/apps/dolly-frontend/config.unstable.yml b/apps/dolly-frontend/config.unstable.yml index ce2e6f9d8a8..62416c37c82 100644 --- a/apps/dolly-frontend/config.unstable.yml +++ b/apps/dolly-frontend/config.unstable.yml @@ -60,6 +60,7 @@ spec: - host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io - host: testnav-krrstub-proxy.dev-fss-pub.nais.io + - host: testnav-fullmakt-proxy.dev-fss-pub.nais.io - host: testnav-udistub-proxy.dev-fss-pub.nais.io - host: testnav-inst-proxy.dev-fss-pub.nais.io - host: testnav-aareg-proxy.dev-fss-pub.nais.io diff --git a/apps/dolly-frontend/config.yml b/apps/dolly-frontend/config.yml index 9dafd8ea194..851b7e85ed9 100644 --- a/apps/dolly-frontend/config.yml +++ b/apps/dolly-frontend/config.yml @@ -72,6 +72,7 @@ spec: - host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io - host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io - host: testnav-krrstub-proxy.dev-fss-pub.nais.io + - host: testnav-fullmakt-proxy.dev-fss-pub.nais.io - host: testnav-udistub-proxy.dev-fss-pub.nais.io - host: testnav-inst-proxy.dev-fss-pub.nais.io - host: testnav-aareg-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 82c5cb21190..e92a64f3000 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 @@ -65,6 +65,7 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) { .route(createRoute(consumers.getTestnavUdistubProxy(), "testnav-udistub-proxy")) .route(createRoute(consumers.getTestnavArenaForvalterenProxy())) .route(createRoute(consumers.getTestnavKrrstubProxy(), "testnav-krrstub-proxy")) + .route(createRoute(consumers.getTestnavFullmaktProxy(), "testnav-fullmakt-proxy")) .route(createRoute(consumers.getTestnavMedlProxy(), "testnav-medl-proxy")) .route(createRoute(consumers.getTestnavNorg2Proxy(), "testnav-norg2-proxy")) .route(createRoute(consumers.getTestnavInstProxy(), "testnav-inst-proxy")) @@ -134,4 +135,4 @@ private Function> createRoute(String segment, St .filters(filter, addUserJwtHeaderFilter()) ).uri(host); } -} +} \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/config/Consumers.java b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/config/Consumers.java index bdd38964ada..0217856ea1d 100644 --- a/apps/dolly-frontend/src/main/java/no/nav/dolly/web/config/Consumers.java +++ b/apps/dolly-frontend/src/main/java/no/nav/dolly/web/config/Consumers.java @@ -42,6 +42,7 @@ public class Consumers { private ServerProperties testnavKodeverkService; private ServerProperties testnavKontoregisterPersonProxy; private ServerProperties testnavKrrstubProxy; + private ServerProperties testnavFullmaktProxy; private ServerProperties testnavMedlProxy; private ServerProperties testnavMiljoerService; private ServerProperties testnavNorg2Proxy; diff --git a/apps/dolly-frontend/src/main/js/package-lock.json b/apps/dolly-frontend/src/main/js/package-lock.json index 3bf37338005..f2347269c3c 100644 --- a/apps/dolly-frontend/src/main/js/package-lock.json +++ b/apps/dolly-frontend/src/main/js/package-lock.json @@ -1,12 +1,12 @@ { "name": "dolly", - "version": "3.0.37", + "version": "3.0.41", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dolly", - "version": "3.0.37", + "version": "3.0.41", "license": "ISC", "dependencies": { "@grafana/faro-react": "^1.1.2", @@ -1219,9 +1219,9 @@ } }, "node_modules/@eslint/core": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.6.0.tgz", - "integrity": "sha512-8I2Q8ykA4J0x0o7cg67FPVnehcqWTBehu/lmY+bolPFHGjh49YzGBMXTvpqVgEbBdvNCSxj6iFgiIyHzf03lzg==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.7.0.tgz", + "integrity": "sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw==", "dev": true, "license": "Apache-2.0", "engines": { @@ -1290,9 +1290,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.12.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.12.0.tgz", - "integrity": "sha512-eohesHH8WFRUprDNyEREgqP6beG6htMeUYeCpkEgBCieCMme5r9zFWjzAJp//9S+Kub4rqE+jXe9Cp1a7IYIIA==", + "version": "9.13.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.13.0.tgz", + "integrity": "sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA==", "dev": true, "license": "MIT", "engines": { @@ -1310,9 +1310,9 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.0.tgz", - "integrity": "sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.1.tgz", + "integrity": "sha512-HFZ4Mp26nbWk9d/BpvP0YNL6W4UoZF0VFcTw/aPPA8RpOxeFQgK+ClABGgAUXs9Y/RGX/l1vOmrqz1MQt9MNuw==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -1390,9 +1390,9 @@ "license": "MIT" }, "node_modules/@grafana/faro-core": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/@grafana/faro-core/-/faro-core-1.10.2.tgz", - "integrity": "sha512-FWLd9cS70CdPHOri53r3CSy/mDFq6oMbYxcZLQoZj7cPZVymoWhNRuXsXQlKdCX+YNWrvk2BmQJeEyMhwsC/8w==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@grafana/faro-core/-/faro-core-1.11.0.tgz", + "integrity": "sha512-IxkH5Ss6mnspF9vzvJ0fVMNQ5uaLjGQ1Sxu7VFaPfDwzYG5Hlre9hPnvtZfQLzOSWZXEWrrV3TIj9CpbsG4z8g==", "license": "Apache-2.0", "dependencies": { "@opentelemetry/api": "^1.9.0", @@ -1400,13 +1400,13 @@ } }, "node_modules/@grafana/faro-react": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/@grafana/faro-react/-/faro-react-1.10.2.tgz", - "integrity": "sha512-8JPC587eCf0JzShvymvcJVz/Kx6nqnp4nN1xhlOCkMKgLHjuUGPnfKPFJN1A5vlSdpTNGvq5b+imNidVGe0b3g==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@grafana/faro-react/-/faro-react-1.11.0.tgz", + "integrity": "sha512-nXK4UPBKGzzWA69pY49lMx/hzIvAikTcOJAi2hxtiiLjNkd0TDF15/eR8X74crDO33BIGFONBnDtHNfZ/+DORA==", "license": "Apache-2.0", "dependencies": { - "@grafana/faro-web-sdk": "^1.10.2", - "@grafana/faro-web-tracing": "^1.10.2", + "@grafana/faro-web-sdk": "^1.11.0", + "@grafana/faro-web-tracing": "^1.11.0", "hoist-non-react-statics": "^3.3.2" }, "peerDependencies": { @@ -1424,23 +1424,23 @@ } }, "node_modules/@grafana/faro-web-sdk": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/@grafana/faro-web-sdk/-/faro-web-sdk-1.10.2.tgz", - "integrity": "sha512-8gsFAT1l7oGtuX1NlB3lk8P0GeJYwzURpLwGnWuK1H+rdRIDwCVc+USGtiOaPlG8bvaH6cVWdNioEWOM0T5CMA==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@grafana/faro-web-sdk/-/faro-web-sdk-1.11.0.tgz", + "integrity": "sha512-L468hk2YF4MS9lJbUjMXKZvTmFzamXPFZZWWoN97ufXw1hKObylqaH3Mb+QsMIBYsEs2g6DyHUWL8j0hDXpyqw==", "license": "Apache-2.0", "dependencies": { - "@grafana/faro-core": "^1.10.2", + "@grafana/faro-core": "^1.11.0", "ua-parser-js": "^1.0.32", "web-vitals": "^4.0.1" } }, "node_modules/@grafana/faro-web-tracing": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/@grafana/faro-web-tracing/-/faro-web-tracing-1.10.2.tgz", - "integrity": "sha512-j69pV9aUd4hqVZsg94x1kilVHpc/6OxigaZghAZZffFUZg5BqCwbtvB3SWsDExIRBh4t7vhCzwEEbPtj75Z4JQ==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@grafana/faro-web-tracing/-/faro-web-tracing-1.11.0.tgz", + "integrity": "sha512-ICyBpSxrEpdD9VvEdw5PEbzPoabFmomiM/inCZtTxRN8Ep7v7axm3pMiyuHXcnoqjir5jbB3/lfT/f1LYdOBVw==", "license": "Apache-2.0", "dependencies": { - "@grafana/faro-web-sdk": "^1.10.2", + "@grafana/faro-web-sdk": "^1.11.0", "@opentelemetry/api": "^1.9.0", "@opentelemetry/context-zone": "1.26.0", "@opentelemetry/core": "^1.26.0", @@ -1528,14 +1528,14 @@ } }, "node_modules/@inquirer/confirm": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-3.2.0.tgz", - "integrity": "sha512-oOIwPs0Dvq5220Z8lGL/6LHRTEr9TgLHmiI99Rj1PJ1p1czTys+olrgBqZk4E2qC0YTzeHprxSQmoHioVdJ7Lw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-4.0.1.tgz", + "integrity": "sha512-46yL28o2NJ9doViqOy0VDcoTzng7rAb6yPQKU7VDLqkmbCaH4JqK4yk4XqlzNWy9PVC5pG1ZUXPBQv+VqnYs2w==", "dev": true, "license": "MIT", "dependencies": { - "@inquirer/core": "^9.1.0", - "@inquirer/type": "^1.5.3" + "@inquirer/core": "^9.2.1", + "@inquirer/type": "^2.0.0" }, "engines": { "node": ">=18" @@ -1565,19 +1565,6 @@ "node": ">=18" } }, - "node_modules/@inquirer/core/node_modules/@inquirer/type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-2.0.0.tgz", - "integrity": "sha512-XvJRx+2KR3YXyYtPUUy+qd9i7p+GO9Ko6VIIpWlBrpWwXDv8WLFeHTxz35CfQFUiBMLXlGHhGzys7lqit9gWag==", - "dev": true, - "license": "MIT", - "dependencies": { - "mute-stream": "^1.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/@inquirer/figures": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.7.tgz", @@ -1589,9 +1576,9 @@ } }, "node_modules/@inquirer/type": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.5.5.tgz", - "integrity": "sha512-MzICLu4yS7V8AA61sANROZ9vT1H3ooca5dSmI1FjZkzq7o/koMsRfQSzRtFo+F3Ao4Sf1C0bpLKejpKB/+j6MA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-2.0.0.tgz", + "integrity": "sha512-XvJRx+2KR3YXyYtPUUy+qd9i7p+GO9Ko6VIIpWlBrpWwXDv8WLFeHTxz35CfQFUiBMLXlGHhGzys7lqit9gWag==", "dev": true, "license": "MIT", "dependencies": { @@ -1729,9 +1716,9 @@ } }, "node_modules/@mswjs/interceptors": { - "version": "0.35.9", - "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.35.9.tgz", - "integrity": "sha512-SSnyl/4ni/2ViHKkiZb8eajA/eN1DNFaHjhGiLUdZvDz6PKF4COSf/17xqSz64nOo2Ia29SA6B2KNCsyCbVmaQ==", + "version": "0.36.5", + "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.36.5.tgz", + "integrity": "sha512-aQ8WF5zQwOdcxLsxSEk9Jd01GgGb80xxqCaiDDlewhtwqpSm8MOvUHslwPydVirasdW09++NxDNNftm1vLY8yA==", "dev": true, "license": "MIT", "dependencies": { @@ -1747,16 +1734,16 @@ } }, "node_modules/@navikt/aksel-icons": { - "version": "7.2.1", - "resolved": "https://npm.pkg.github.com/download/@navikt/aksel-icons/7.2.1/8cc80c4d03f7d22428f72fd4cb6a93946b087db1", - "integrity": "sha512-AQNR2ld5Kjx1A8LA7TnRxztbNf27UFMFt9vitSIlHGVHvWppSzIrxRhBESsldUDRxMQUjJrFY72o53whF0lhxQ==", + "version": "7.3.1", + "resolved": "https://npm.pkg.github.com/download/@navikt/aksel-icons/7.3.1/579d009ffc9063af4afd5000a9e73dfba39a1f1c", + "integrity": "sha512-FqARFTIvjOVyyYQ2BFS8ba3GEu/M53d7MUle5/NP838ZG4CY3O+Ea453dxPGuGCu2EIG8CX8sQ3VFmVqCYu9mQ==", "dev": true, "license": "MIT" }, "node_modules/@navikt/ds-css": { - "version": "7.2.1", - "resolved": "https://npm.pkg.github.com/download/@navikt/ds-css/7.2.1/4201a8c184239da9b0c546a94a25ee985c89fc3c", - "integrity": "sha512-0SRFwm2Iyuz4noxL98h5LObklJ9oaxiLsCSECOY2LohMy+XcfOoQQ/6eeGhTURqmLSnJYsdTFs2peV0ZX+Ukig==", + "version": "7.3.1", + "resolved": "https://npm.pkg.github.com/download/@navikt/ds-css/7.3.1/ed21257bbfa4a5615ce55bfe7f5175b20bf42d8f", + "integrity": "sha512-Q/vzLpPvtzUEmrK2s6dH/gtPTcj11AlEBFxG6tMzLUcynB7R0olXgYBfdD7kTPy3F2Y6PWr5ihQvV4tXPIgpww==", "dev": true, "license": "MIT" }, @@ -1778,16 +1765,16 @@ } }, "node_modules/@navikt/ds-react": { - "version": "7.2.1", - "resolved": "https://npm.pkg.github.com/download/@navikt/ds-react/7.2.1/d8283fca0fea8efb9281f54dc08e424d4f4e0078", - "integrity": "sha512-zVewWWjBCiHd1TchuzBlQVYBYjBJ0v5vbnvXvDaP0I4zbG4b+Fb71F+Oxn7HyaboXEkXk0TlZjerylEdtc28zg==", + "version": "7.3.1", + "resolved": "https://npm.pkg.github.com/download/@navikt/ds-react/7.3.1/0aa76367ae5294f4ed2f598218240efa7a51e136", + "integrity": "sha512-5HetHrvZHwjTr/CfOy9fES018vYgU5Jgb+VE+P+U0SuLU2k+86+mJ5fhsXQn6ipSqBDPGOB0IMw0LY8n/eVkFw==", "dev": true, "license": "MIT", "dependencies": { "@floating-ui/react": "0.25.4", "@floating-ui/react-dom": "^2.0.9", - "@navikt/aksel-icons": "^7.2.1", - "@navikt/ds-tokens": "^7.2.1", + "@navikt/aksel-icons": "^7.3.1", + "@navikt/ds-tokens": "^7.3.1", "clsx": "^2.1.0", "date-fns": "^3.0.0", "react-day-picker": "8.10.0" @@ -1937,9 +1924,9 @@ } }, "node_modules/@navikt/ds-tokens": { - "version": "7.2.1", - "resolved": "https://npm.pkg.github.com/download/@navikt/ds-tokens/7.2.1/0df577b32219208add6ca8646449fb558faad282", - "integrity": "sha512-u2Aog1I10uWKJra4aFwXiMvgo/f23E7No9l0RhzCRIatQ9qFjaaV1koEtftGBS0VbkVmRgjSeSkGb4SzgiUSbw==", + "version": "7.3.1", + "resolved": "https://npm.pkg.github.com/download/@navikt/ds-tokens/7.3.1/806b85e70ee44c469422bf5b415a4e9c026d981d", + "integrity": "sha512-zYoEz4YMfKiyi2CwYFWRjPTkzmeNZqE5XRb8CL0xkZMj3ESkn0M7XSEk2AKfe7BIN7q3kItD4bMsmCruTmr1pQ==", "dev": true, "license": "MIT" }, @@ -2572,13 +2559,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.48.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.0.tgz", - "integrity": "sha512-W5lhqPUVPqhtc/ySvZI5Q8X2ztBOUgZ8LbAFy0JQgrXZs2xaILrUcNO3rQjwbLPfGK13+rZsDa1FpG+tqYkT5w==", + "version": "1.48.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.1.tgz", + "integrity": "sha512-s9RtWoxkOLmRJdw3oFvhFbs9OJS0BzrLUc8Hf6l2UdCNd1rqeEyD4BhCJkvzeEoD1FsK4mirsWwGerhVmYKtZg==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.48.0" + "playwright": "1.48.1" }, "bin": { "playwright": "cli.js" @@ -2955,9 +2942,9 @@ } }, "node_modules/@reduxjs/toolkit": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.8.tgz", - "integrity": "sha512-eK/ieXftPRQfaBSmzsamXEyDwkntMTY0e9SG5ETsEOv5JIPKhu3mj992t6B8FJjlnSrZBAAqdT8oMkPe4j+P9g==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.3.0.tgz", + "integrity": "sha512-WC7Yd6cNGfHx8zf+iu+Q1UPTfEcXhQ+ATi7CV1hlrSAaQBdlPzg7Ww/wJHNQem7qG9rxmWoFCDCPubSvFObGzA==", "dev": true, "license": "MIT", "dependencies": { @@ -3397,9 +3384,9 @@ "license": "MIT" }, "node_modules/@types/lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-YpS0zzoduEhuOWjAotS6A5AVCva7X4lVlYLF0FYHAY9sdraBfnatttHItlWeZdGhuEkf+OzMNg2ZYAx8t+52uQ==", + "version": "4.17.12", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.12.tgz", + "integrity": "sha512-sviUmCE8AYdaF/KIHLDJBQgeYzPBI0vf/17NaYehBJfYD1j6/L95Slh07NlyK2iNyBNaEkb3En2jRt+a8y3xZQ==", "dev": true, "license": "MIT" }, @@ -3414,9 +3401,9 @@ } }, "node_modules/@types/node": { - "version": "22.7.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", - "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "version": "22.7.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.8.tgz", + "integrity": "sha512-a922jJy31vqR5sk+kAdIENJjHblqcZ4RmERviFsER4WJcEONqxKcjNOlk0q7OUfrF5sddT+vng070cdfMlrPLg==", "license": "MIT", "dependencies": { "undici-types": "~6.19.2" @@ -3639,17 +3626,17 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.8.1.tgz", - "integrity": "sha512-xfvdgA8AP/vxHgtgU310+WBnLB4uJQ9XdyP17RebG26rLtDrQJV3ZYrcopX91GrHmMoH8bdSwMRh2a//TiJ1jQ==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.11.0.tgz", + "integrity": "sha512-KhGn2LjW1PJT2A/GfDpiyOfS4a8xHQv2myUagTM5+zsormOmBlYsnQ6pobJ8XxJmh6hnHwa2Mbe3fPrDJoDhbA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.8.1", - "@typescript-eslint/type-utils": "8.8.1", - "@typescript-eslint/utils": "8.8.1", - "@typescript-eslint/visitor-keys": "8.8.1", + "@typescript-eslint/scope-manager": "8.11.0", + "@typescript-eslint/type-utils": "8.11.0", + "@typescript-eslint/utils": "8.11.0", + "@typescript-eslint/visitor-keys": "8.11.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -3673,16 +3660,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.8.1.tgz", - "integrity": "sha512-hQUVn2Lij2NAxVFEdvIGxT9gP1tq2yM83m+by3whWFsWC+1y8pxxxHUFE1UqDu2VsGi2i6RLcv4QvouM84U+ow==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.11.0.tgz", + "integrity": "sha512-lmt73NeHdy1Q/2ul295Qy3uninSqi6wQI18XwSpm8w0ZbQXUpjCAWP1Vlv/obudoBiIjJVjlztjQ+d/Md98Yxg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "8.8.1", - "@typescript-eslint/types": "8.8.1", - "@typescript-eslint/typescript-estree": "8.8.1", - "@typescript-eslint/visitor-keys": "8.8.1", + "@typescript-eslint/scope-manager": "8.11.0", + "@typescript-eslint/types": "8.11.0", + "@typescript-eslint/typescript-estree": "8.11.0", + "@typescript-eslint/visitor-keys": "8.11.0", "debug": "^4.3.4" }, "engines": { @@ -3702,14 +3689,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.8.1.tgz", - "integrity": "sha512-X4JdU+66Mazev/J0gfXlcC/dV6JI37h+93W9BRYXrSn0hrE64IoWgVkO9MSJgEzoWkxONgaQpICWg8vAN74wlA==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.11.0.tgz", + "integrity": "sha512-Uholz7tWhXmA4r6epo+vaeV7yjdKy5QFCERMjs1kMVsLRKIrSdM6o21W2He9ftp5PP6aWOVpD5zvrvuHZC0bMQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.8.1", - "@typescript-eslint/visitor-keys": "8.8.1" + "@typescript-eslint/types": "8.11.0", + "@typescript-eslint/visitor-keys": "8.11.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3720,14 +3707,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.8.1.tgz", - "integrity": "sha512-qSVnpcbLP8CALORf0za+vjLYj1Wp8HSoiI8zYU5tHxRVj30702Z1Yw4cLwfNKhTPWp5+P+k1pjmD5Zd1nhxiZA==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.11.0.tgz", + "integrity": "sha512-ItiMfJS6pQU0NIKAaybBKkuVzo6IdnAhPFZA/2Mba/uBjuPQPet/8+zh5GtLHwmuFRShZx+8lhIs7/QeDHflOg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.8.1", - "@typescript-eslint/utils": "8.8.1", + "@typescript-eslint/typescript-estree": "8.11.0", + "@typescript-eslint/utils": "8.11.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -3745,9 +3732,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.8.1.tgz", - "integrity": "sha512-WCcTP4SDXzMd23N27u66zTKMuEevH4uzU8C9jf0RO4E04yVHgQgW+r+TeVTNnO1KIfrL8ebgVVYYMMO3+jC55Q==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.11.0.tgz", + "integrity": "sha512-tn6sNMHf6EBAYMvmPUaKaVeYvhUsrE6x+bXQTxjQRp360h1giATU0WvgeEys1spbvb5R+VpNOZ+XJmjD8wOUHw==", "dev": true, "license": "MIT", "engines": { @@ -3759,14 +3746,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.8.1.tgz", - "integrity": "sha512-A5d1R9p+X+1js4JogdNilDuuq+EHZdsH9MjTVxXOdVFfTJXunKJR/v+fNNyO4TnoOn5HqobzfRlc70NC6HTcdg==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.11.0.tgz", + "integrity": "sha512-yHC3s1z1RCHoCz5t06gf7jH24rr3vns08XXhfEqzYpd6Hll3z/3g23JRi0jM8A47UFKNc3u/y5KIMx8Ynbjohg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "8.8.1", - "@typescript-eslint/visitor-keys": "8.8.1", + "@typescript-eslint/types": "8.11.0", + "@typescript-eslint/visitor-keys": "8.11.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -3788,16 +3775,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.8.1.tgz", - "integrity": "sha512-/QkNJDbV0bdL7H7d0/y0qBbV2HTtf0TIyjSDTvvmQEzeVx8jEImEbLuOA4EsvE8gIgqMitns0ifb5uQhMj8d9w==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.11.0.tgz", + "integrity": "sha512-CYiX6WZcbXNJV7UNB4PLDIBtSdRmRI/nb0FMyqHPTQD1rMjA0foPLaPUV39C/MxkTd/QKSeX+Gb34PPsDVC35g==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.8.1", - "@typescript-eslint/types": "8.8.1", - "@typescript-eslint/typescript-estree": "8.8.1" + "@typescript-eslint/scope-manager": "8.11.0", + "@typescript-eslint/types": "8.11.0", + "@typescript-eslint/typescript-estree": "8.11.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3811,13 +3798,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.8.1.tgz", - "integrity": "sha512-0/TdC3aeRAsW7MDvYRwEc1Uwm0TIBfzjPFgg60UU2Haj5qsCs9cc3zNgY71edqE3LbWfF/WoZQd3lJoDXFQpag==", + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.11.0.tgz", + "integrity": "sha512-EaewX6lxSjRJnc+99+dqzTeoDZUfyrA52d2/HRrkI830kgovWsmIiTfmr0NZorzqic7ga+1bS60lRBUgR3n/Bw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.8.1", + "@typescript-eslint/types": "8.11.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -3829,9 +3816,9 @@ } }, "node_modules/@vitejs/plugin-react": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.2.tgz", - "integrity": "sha512-hieu+o05v4glEBucTcKMK3dlES0OeJlD9YVOAPraVMOInBCwzumaIFiUjr4bHK7NPgnAHgiskUoceKercrN8vg==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.3.tgz", + "integrity": "sha512-NooDe9GpHGqNns1i8XDERg0Vsg5SSYRhRxxyTGogUdkdNt47jal+fbuYi+Yfq6pzRCKXyoPcWisfxE6RIM3GKA==", "dev": true, "license": "MIT", "dependencies": { @@ -3849,14 +3836,14 @@ } }, "node_modules/@vitest/expect": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.2.tgz", - "integrity": "sha512-FEgtlN8mIUSEAAnlvn7mP8vzaWhEaAEvhSXCqrsijM7K6QqjB11qoRZYEd4AKSCDz8p0/+yH5LzhZ47qt+EyPg==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.3.tgz", + "integrity": "sha512-SNBoPubeCJhZ48agjXruCI57DvxcsivVDdWz+SSsmjTT4QN/DfHk3zB/xKsJqMs26bLZ/pNRLnCf0j679i0uWQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "2.1.2", - "@vitest/utils": "2.1.2", + "@vitest/spy": "2.1.3", + "@vitest/utils": "2.1.3", "chai": "^5.1.1", "tinyrainbow": "^1.2.0" }, @@ -3865,13 +3852,13 @@ } }, "node_modules/@vitest/mocker": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.2.tgz", - "integrity": "sha512-ExElkCGMS13JAJy+812fw1aCv2QO/LBK6CyO4WOPAzLTmve50gydOlWhgdBJPx2ztbADUq3JVI0C5U+bShaeEA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.3.tgz", + "integrity": "sha512-eSpdY/eJDuOvuTA3ASzCjdithHa+GIF1L4PqtEELl6Qa3XafdMLBpBlZCIUCX2J+Q6sNmjmxtosAG62fK4BlqQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "^2.1.0-beta.1", + "@vitest/spy": "2.1.3", "estree-walker": "^3.0.3", "magic-string": "^0.30.11" }, @@ -3879,7 +3866,7 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "@vitest/spy": "2.1.2", + "@vitest/spy": "2.1.3", "msw": "^2.3.5", "vite": "^5.0.0" }, @@ -3893,9 +3880,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.2.tgz", - "integrity": "sha512-FIoglbHrSUlOJPDGIrh2bjX1sNars5HbxlcsFKCtKzu4+5lpsRhOCVcuzp0fEhAGHkPZRIXVNzPcpSlkoZ3LuA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.3.tgz", + "integrity": "sha512-XH1XdtoLZCpqV59KRbPrIhFCOO0hErxrQCMcvnQete3Vibb9UeIOX02uFPfVn3Z9ZXsq78etlfyhnkmIZSzIwQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3906,13 +3893,13 @@ } }, "node_modules/@vitest/runner": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.2.tgz", - "integrity": "sha512-UCsPtvluHO3u7jdoONGjOSil+uON5SSvU9buQh3lP7GgUXHp78guN1wRmZDX4wGK6J10f9NUtP6pO+SFquoMlw==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.3.tgz", + "integrity": "sha512-JGzpWqmFJ4fq5ZKHtVO3Xuy1iF2rHGV4d/pdzgkYHm1+gOzNZtqjvyiaDGJytRyMU54qkxpNzCx+PErzJ1/JqQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "2.1.2", + "@vitest/utils": "2.1.3", "pathe": "^1.1.2" }, "funding": { @@ -3920,13 +3907,13 @@ } }, "node_modules/@vitest/snapshot": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.2.tgz", - "integrity": "sha512-xtAeNsZ++aRIYIUsek7VHzry/9AcxeULlegBvsdLncLmNCR6tR8SRjn8BbDP4naxtccvzTqZ+L1ltZlRCfBZFA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.3.tgz", + "integrity": "sha512-qWC2mWc7VAXmjAkEKxrScWHWFyCQx/cmiZtuGqMi+WwqQJ2iURsVY4ZfAK6dVo6K2smKRU6l3BPwqEBvhnpQGg==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.1.2", + "@vitest/pretty-format": "2.1.3", "magic-string": "^0.30.11", "pathe": "^1.1.2" }, @@ -3935,9 +3922,9 @@ } }, "node_modules/@vitest/spy": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.2.tgz", - "integrity": "sha512-GSUi5zoy+abNRJwmFhBDC0yRuVUn8WMlQscvnbbXdKLXX9dE59YbfwXxuJ/mth6eeqIzofU8BB5XDo/Ns/qK2A==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.3.tgz", + "integrity": "sha512-Nb2UzbcUswzeSP7JksMDaqsI43Sj5+Kry6ry6jQJT4b5gAK+NS9NED6mDb8FlMRCX8m5guaHCDZmqYMMWRy5nQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3948,13 +3935,13 @@ } }, "node_modules/@vitest/ui": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-2.1.2.tgz", - "integrity": "sha512-92gcNzkDnmxOxyHzQrQYRsoV9Q0Aay0r4QMLnV+B+lbqlUWa8nDg9ivyLV5mMVTtGirHsYUGGh/zbIA55gBZqA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-2.1.3.tgz", + "integrity": "sha512-2XwTrHVJw3t9NYES26LQUYy51ZB8W4bRPgqUH2Eyda3kIuOlYw1ZdPNU22qcVlUVx4WKgECFQOSXuopsczuVjQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "2.1.2", + "@vitest/utils": "2.1.3", "fflate": "^0.8.2", "flatted": "^3.3.1", "pathe": "^1.1.2", @@ -3966,17 +3953,17 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "2.1.2" + "vitest": "2.1.3" } }, "node_modules/@vitest/utils": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.2.tgz", - "integrity": "sha512-zMO2KdYy6mx56btx9JvAqAZ6EyS3g49krMPPrgOp1yxGZiA93HumGk+bZ5jIZtOg5/VBYl5eBmGRQHqq4FG6uQ==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.3.tgz", + "integrity": "sha512-xpiVfDSg1RrYT0tX6czgerkpcKFmFOF/gCr30+Mve5V2kewCy4Prn1/NDMSRwaSmT7PRaOF83wu+bEtsY1wrvA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.1.2", + "@vitest/pretty-format": "2.1.3", "loupe": "^3.1.1", "tinyrainbow": "^1.2.0" }, @@ -3999,9 +3986,9 @@ "optional": true }, "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.13.0.tgz", + "integrity": "sha512-8zSiw54Oxrdym50NlZ9sUusyO1Z1ZchgRLWRaK6c86XJFClyCgFKetdowBg5bKxyp/u+CDBJG4Mpp0m3HLZl9w==", "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -4458,9 +4445,9 @@ } }, "node_modules/browserslist": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz", - "integrity": "sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==", + "version": "4.24.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", + "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", "dev": true, "funding": [ { @@ -4478,10 +4465,10 @@ ], "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001663", - "electron-to-chromium": "^1.5.28", + "caniuse-lite": "^1.0.30001669", + "electron-to-chromium": "^1.5.41", "node-releases": "^2.0.18", - "update-browserslist-db": "^1.1.0" + "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" @@ -4539,9 +4526,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001668", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001668.tgz", - "integrity": "sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw==", + "version": "1.0.30001669", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz", + "integrity": "sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==", "dev": true, "funding": [ { @@ -5255,9 +5242,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.36", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.36.tgz", - "integrity": "sha512-HYTX8tKge/VNp6FGO+f/uVDmUkq+cEfcxYhKf15Akc4M5yxt5YmorwlAitKWjWhWQnKcDRBAQKXkhqqXMqcrjw==", + "version": "1.5.42", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.42.tgz", + "integrity": "sha512-gIfKavKDw1mhvic9nbzA5lZw8QSHpdMwLwXc0cWidQz9B15pDoDdDH4boIatuFfeoCatb3a/NGL6CYRVFxGZ9g==", "dev": true, "license": "ISC" }, @@ -5541,18 +5528,18 @@ } }, "node_modules/eslint": { - "version": "9.12.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.12.0.tgz", - "integrity": "sha512-UVIOlTEWxwIopRL1wgSQYdnVDcEvs2wyaO6DGo5mXqe3r16IoCNWkR29iHhyaP4cICWjbgbmFUGAhh0GJRuGZw==", + "version": "9.13.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.13.0.tgz", + "integrity": "sha512-EYZK6SX6zjFHST/HRytOdA/zE72Cq/bfw45LSyuwrdvcclb/gqV8RRQxywOBEWO2+WDpva6UZa4CcDeJKzUCFA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.11.0", "@eslint/config-array": "^0.18.0", - "@eslint/core": "^0.6.0", + "@eslint/core": "^0.7.0", "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.12.0", + "@eslint/js": "9.13.0", "@eslint/plugin-kit": "^0.2.0", "@humanfs/node": "^0.16.5", "@humanwhocodes/module-importer": "^1.0.1", @@ -6537,6 +6524,12 @@ "node": "*" } }, + "node_modules/highlightjs-vue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/highlightjs-vue/-/highlightjs-vue-1.0.0.tgz", + "integrity": "sha512-PDEfEF102G23vHmPhLyPboFCD+BkMGu+GuJe2d9/eH4FsCwvgBpnc9n0pGE+ffKdph38s6foEZiEjdgHdzp+IA==", + "license": "CC0-1.0" + }, "node_modules/history": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", @@ -7951,9 +7944,9 @@ "license": "MIT" }, "node_modules/msw": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/msw/-/msw-2.4.11.tgz", - "integrity": "sha512-TVEw9NOPTc6ufOQLJ53234S9NBRxQbu7xFMxs+OCP43JQcNEIOKiZHxEm2nDzYIrwccoIhUxUf8wr99SukD76A==", + "version": "2.4.13", + "resolved": "https://registry.npmjs.org/msw/-/msw-2.4.13.tgz", + "integrity": "sha512-EDA7ls/twh3XG5QEYv0LvAnnFs3wYL6GFNMSqG4hh2+1rq7h78iDbh5jB2iaO8hKi1JVmZLO6ItssXmP1A7nxQ==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -7961,8 +7954,8 @@ "@bundled-es-modules/cookie": "^2.0.0", "@bundled-es-modules/statuses": "^1.0.1", "@bundled-es-modules/tough-cookie": "^0.1.6", - "@inquirer/confirm": "^3.0.0", - "@mswjs/interceptors": "^0.35.8", + "@inquirer/confirm": "^4.0.0", + "@mswjs/interceptors": "^0.36.5", "@open-draft/until": "^2.1.0", "@types/cookie": "^0.6.0", "@types/statuses": "^2.0.4", @@ -8518,9 +8511,9 @@ } }, "node_modules/picocolors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", - "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "license": "ISC" }, "node_modules/picomatch": { @@ -8548,13 +8541,13 @@ } }, "node_modules/playwright": { - "version": "1.48.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.0.tgz", - "integrity": "sha512-qPqFaMEHuY/ug8o0uteYJSRfMGFikhUysk8ZvAtfKmUK3kc/6oNl/y3EczF8OFGYIi/Ex2HspMfzYArk6+XQSA==", + "version": "1.48.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.1.tgz", + "integrity": "sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.48.0" + "playwright-core": "1.48.1" }, "bin": { "playwright": "cli.js" @@ -8567,9 +8560,9 @@ } }, "node_modules/playwright-core": { - "version": "1.48.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.0.tgz", - "integrity": "sha512-RBvzjM9rdpP7UUFrQzRwR8L/xR4HyC1QXMzGYTbf1vjw25/ya9NRAVnXi/0fvFopjebvyPzsmoK58xxeEOaVvA==", + "version": "1.48.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.1.tgz", + "integrity": "sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==", "dev": true, "license": "Apache-2.0", "bin": { @@ -8917,9 +8910,9 @@ } }, "node_modules/react-datepicker": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-7.4.0.tgz", - "integrity": "sha512-vSSok4DTZ9/Os8O4HjZLxh4SZVFU6dQvoCX6mfbNdBqMsBBdzftrvMz0Nb4UUVVbgj9o8PfX84K3/31oPrTqmg==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-7.5.0.tgz", + "integrity": "sha512-6MzeamV8cWSOcduwePHfGqY40acuGlS1cG//ePHT6bVbLxWyqngaStenfH03n1wbzOibFggF66kWaBTb1SbTtQ==", "license": "MIT", "dependencies": { "@floating-ui/react": "^0.26.23", @@ -8983,9 +8976,9 @@ } }, "node_modules/react-dropzone": { - "version": "14.2.9", - "resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-14.2.9.tgz", - "integrity": "sha512-jRZsMC7h48WONsOLHcmhyn3cRWJoIPQjPApvt/sJVfnYaB3Qltn025AoRTTJaj4WdmmgmLl6tUQg1s0wOhpodQ==", + "version": "14.2.10", + "resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-14.2.10.tgz", + "integrity": "sha512-Y98LOCYxGO2jOFWREeKJlL7gbrHcOlTBp+9DCM1dh9XQ8+P/8ThhZT7kFb05C+bPcTXq/rixpU+5+LzwYrFLUw==", "dev": true, "license": "MIT", "dependencies": { @@ -9024,9 +9017,9 @@ } }, "node_modules/react-hook-form": { - "version": "7.53.0", - "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.53.0.tgz", - "integrity": "sha512-M1n3HhqCww6S2hxLxciEXy2oISPnAzxY7gvwVPrtlczTM/1dDadXgUxDpHMrMTblDOcm/AXtXxHwZ3jpg1mqKQ==", + "version": "7.53.1", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.53.1.tgz", + "integrity": "sha512-6aiQeBda4zjcuaugWvim9WsGqisoUk+etmFEsSUMm451/Ic8L/UAb7sRtMj3V+Hdzm6mMjU1VhiSzYUZeBm0Vg==", "license": "MIT", "engines": { "node": ">=18.0.0" @@ -9040,12 +9033,12 @@ } }, "node_modules/react-inlinesvg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/react-inlinesvg/-/react-inlinesvg-4.1.3.tgz", - "integrity": "sha512-p1+wkr1UQZyLw/3bdpnHO3v3tMNVWyxWnAEY6ML/Ql9ldDYTBTy6HqAyNl7u3au925XPffLMiXKnQrqZeJAldw==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/react-inlinesvg/-/react-inlinesvg-4.1.4.tgz", + "integrity": "sha512-V7x3YGqG7LNeHpsIx90HDa2qhYCOPkzjIMToPWALyvOTI3kzicKF2O2PNZDaVqAVhwRbijLIUoQN5STleTO2rg==", "license": "MIT", "dependencies": { - "react-from-dom": "^0.7.2" + "react-from-dom": "^0.7.3" }, "peerDependencies": { "react": "16.8 - 18" @@ -9240,13 +9233,14 @@ "license": "MIT" }, "node_modules/react-syntax-highlighter": { - "version": "15.5.0", - "resolved": "https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-15.5.0.tgz", - "integrity": "sha512-+zq2myprEnQmH5yw6Gqc8lD55QHnpKaU8TOcFeC/Lg/MQSs8UknEA0JC4nTZGFAXC2J2Hyj/ijJ7NlabyPi2gg==", + "version": "15.6.1", + "resolved": "https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-15.6.1.tgz", + "integrity": "sha512-OqJ2/vL7lEeV5zTJyG7kmARppUjiB9h9udl4qHQjjgEos66z00Ia0OckwYfRxCSFrW8RJIBnsBwQsHZbVPspqg==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.3.1", "highlight.js": "^10.4.1", + "highlightjs-vue": "^1.0.0", "lowlight": "^1.17.0", "prismjs": "^1.27.0", "refractor": "^3.6.0" @@ -9746,9 +9740,9 @@ "license": "MIT" }, "node_modules/sass": { - "version": "1.79.5", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.79.5.tgz", - "integrity": "sha512-W1h5kp6bdhqFh2tk3DsI771MoEJjvrSY/2ihJRJS4pjIyfJCw0nTsxqhnrUzaLMOJjFchj8rOvraI/YUVjtx5g==", + "version": "1.80.3", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.80.3.tgz", + "integrity": "sha512-ptDWyVmDMVielpz/oWy3YP3nfs7LpJTHIJZboMVs8GEC9eUmtZTZhMHlTW98wY4aEorDfjN38+Wr/XjskFWcfA==", "dev": true, "license": "MIT", "dependencies": { @@ -10461,9 +10455,9 @@ "license": "MIT" }, "node_modules/tinyexec": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.0.tgz", - "integrity": "sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.1.tgz", + "integrity": "sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==", "dev": true, "license": "MIT" }, @@ -10482,9 +10476,9 @@ } }, "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.0.tgz", - "integrity": "sha512-3oB133prH1o4j/L5lLW7uOCF1PlD+/It2L0eL/iAqWMB91RBbqTewABqxhj0ibBd90EEmWZq7ntIWzVaWcXTGQ==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.2.tgz", + "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", "dev": true, "license": "MIT", "peerDependencies": { @@ -10540,22 +10534,22 @@ } }, "node_modules/tldts": { - "version": "6.1.51", - "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.51.tgz", - "integrity": "sha512-33lfQoL0JsDogIbZ8fgRyvv77GnRtwkNE/MOKocwUgPO1WrSfsq7+vQRKxRQZai5zd+zg97Iv9fpFQSzHyWdLA==", + "version": "6.1.53", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.53.tgz", + "integrity": "sha512-4uCStuOjPFaY2/LUjTSwdnJTC82W/gvSFL6FoTC9ehNOHboA9cyO3wX1erh2yGofVls37OdXr5sQLEfL5hS1TA==", "dev": true, "license": "MIT", "dependencies": { - "tldts-core": "^6.1.51" + "tldts-core": "^6.1.53" }, "bin": { "tldts": "bin/cli.js" } }, "node_modules/tldts-core": { - "version": "6.1.51", - "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.51.tgz", - "integrity": "sha512-bu9oCYYWC1iRjx+3UnAjqCsfrWNZV1ghNQf49b3w5xE8J/tNShHTzp5syWJfwGH+pxUgTTLUnzHnfuydW7wmbg==", + "version": "6.1.53", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.53.tgz", + "integrity": "sha512-IleS872aGdTB/UtocD2dSZBnQi/nqMIZxxezVgfcKKjw6+G2hJGzFw9buIDJO2MVJyEJe3rCAdyMTl2yvGMMrQ==", "dev": true, "license": "MIT" }, @@ -10714,9 +10708,9 @@ } }, "node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==", "license": "0BSD" }, "node_modules/type-check": { @@ -11009,9 +11003,9 @@ "license": "MIT" }, "node_modules/vite": { - "version": "5.4.8", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.8.tgz", - "integrity": "sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==", + "version": "5.4.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.9.tgz", + "integrity": "sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==", "dev": true, "license": "MIT", "dependencies": { @@ -11069,9 +11063,9 @@ } }, "node_modules/vite-node": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.2.tgz", - "integrity": "sha512-HPcGNN5g/7I2OtPjLqgOtCRu/qhVvBxTUD3qzitmL0SrG1cWFzxzhMDWussxSbrRYWqnKf8P2jiNhPMSN+ymsQ==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.3.tgz", + "integrity": "sha512-I1JadzO+xYX887S39Do+paRePCKoiDrWRRjp9kkG5he0t7RXNvPAJPCQSJqbGN4uCrFFeS3Kj3sLqY8NMYBEdA==", "dev": true, "license": "MIT", "dependencies": { @@ -11165,19 +11159,19 @@ } }, "node_modules/vitest": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.2.tgz", - "integrity": "sha512-veNjLizOMkRrJ6xxb+pvxN6/QAWg95mzcRjtmkepXdN87FNfxAss9RKe2far/G9cQpipfgP2taqg0KiWsquj8A==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.3.tgz", + "integrity": "sha512-Zrxbg/WiIvUP2uEzelDNTXmEMJXuzJ1kCpbDvaKByFA9MNeO95V+7r/3ti0qzJzrxdyuUw5VduN7k+D3VmVOSA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/expect": "2.1.2", - "@vitest/mocker": "2.1.2", - "@vitest/pretty-format": "^2.1.2", - "@vitest/runner": "2.1.2", - "@vitest/snapshot": "2.1.2", - "@vitest/spy": "2.1.2", - "@vitest/utils": "2.1.2", + "@vitest/expect": "2.1.3", + "@vitest/mocker": "2.1.3", + "@vitest/pretty-format": "^2.1.3", + "@vitest/runner": "2.1.3", + "@vitest/snapshot": "2.1.3", + "@vitest/spy": "2.1.3", + "@vitest/utils": "2.1.3", "chai": "^5.1.1", "debug": "^4.3.6", "magic-string": "^0.30.11", @@ -11188,7 +11182,7 @@ "tinypool": "^1.0.0", "tinyrainbow": "^1.2.0", "vite": "^5.0.0", - "vite-node": "2.1.2", + "vite-node": "2.1.3", "why-is-node-running": "^2.3.0" }, "bin": { @@ -11203,8 +11197,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "2.1.2", - "@vitest/ui": "2.1.2", + "@vitest/browser": "2.1.3", + "@vitest/ui": "2.1.3", "happy-dom": "*", "jsdom": "*" }, diff --git a/apps/dolly-frontend/src/main/js/package.json b/apps/dolly-frontend/src/main/js/package.json index c3d85bdb3a9..62efdc4836b 100644 --- a/apps/dolly-frontend/src/main/js/package.json +++ b/apps/dolly-frontend/src/main/js/package.json @@ -1,6 +1,6 @@ { "name": "dolly", - "version": "3.0.37", + "version": "3.0.41", "type": "module", "description": "", "main": "index.js", diff --git a/apps/dolly-frontend/src/main/js/proxy-routes.json b/apps/dolly-frontend/src/main/js/proxy-routes.json index ac756604110..843d1003414 100644 --- a/apps/dolly-frontend/src/main/js/proxy-routes.json +++ b/apps/dolly-frontend/src/main/js/proxy-routes.json @@ -99,6 +99,11 @@ "changeOrigin": true, "secure": false }, + "/testnav-fullmakt-proxy/api": { + "target": "http://localhost:8020", + "changeOrigin": true, + "secure": false + }, "/testnav-inst-proxy/api": { "target": "http://localhost:8020", "changeOrigin": true, diff --git a/apps/dolly-frontend/src/main/js/src/api/index.ts b/apps/dolly-frontend/src/main/js/src/api/index.ts index bd84164b6f8..e25932852ef 100644 --- a/apps/dolly-frontend/src/main/js/src/api/index.ts +++ b/apps/dolly-frontend/src/main/js/src/api/index.ts @@ -9,6 +9,8 @@ import { Logger } from '@/logger/Logger' const fetchRetry = fetch_retry(originalFetch) +const allowForbidden = ['testnav-arbeidsplassencv', 'testnav-fullmakt', 'infostripe', 'norg2'] + export const multiFetcherAll = (urlListe, headers = null) => { return Promise.all( urlListe.map((url) => @@ -137,9 +139,7 @@ export const fetcher = (url, headers) => .catch((reason) => { if ( (reason?.response?.status === 401 || reason?.response?.status === 403) && - !url.includes('testnav-arbeidsplassencv') && - !url.includes('infostripe') && - !url.includes('norg2') + !allowForbidden.some((value) => url.includes(value)) ) { console.error('Auth feilet, navigerer til login') navigateToLogin() @@ -169,13 +169,8 @@ type Config = { const _fetch = (url: string, config: Config, body?: object): Promise => fetchRetry(url, { retryOn: (attempt, error, response) => { - if (!response.ok && !runningE2ETest()) { - if ( - response?.status === 401 && - !url.includes('testnav-arbeidsplassencv') && - !url.includes('infostripe') && - !url.includes('norg2') - ) { + if (!response.ok && response?.status !== 404 && !runningE2ETest()) { + if (response?.status === 401 && !allowForbidden.some((value) => url.includes(value))) { console.error('Auth feilet, navigerer til login') navigateToLogin() } @@ -205,12 +200,7 @@ const _fetch = (url: string, config: Config, body?: object): Promise = window.location.href = response.url } if (!response.ok && !runningE2ETest()) { - if ( - response?.status === 401 && - !url.includes('testnav-arbeidsplassencv') && - !url.includes('infostripe') && - !url.includes('norg2') - ) { + if (response?.status === 401 && !allowForbidden.some((value) => url.includes(value))) { console.error('Auth feilet, navigerer til login') navigateToLogin() } diff --git a/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/kriterier/BestillingKriterieMapper.tsx b/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/kriterier/BestillingKriterieMapper.tsx index 97fb34a7bf1..fe3c913554d 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/kriterier/BestillingKriterieMapper.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/kriterier/BestillingKriterieMapper.tsx @@ -326,14 +326,14 @@ const mapVergemaal = (vergemaal, data) => { } } -const mapFullmakt = (fullmakt, data) => { - if (fullmakt) { +const mapFullmakt = (bestillingData, data) => { + if (bestillingData?.fullmakt) { const fullmaktData = { header: 'Fullmakt', - itemRows: fullmakt.map((item, idx) => { + itemRows: bestillingData.fullmakt.map((item, idx) => { return [ { numberHeader: `Fullmakt ${idx + 1}` }, - obj('Områder', omraaderArrayToString(item.omraader)), + obj('Områder', omraaderArrayToString(item.omraade)), obj('Gyldig fra og med', formatDate(item.gyldigFraOgMed)), obj('Gyldig til og med', formatDate(item.gyldigTilOgMed)), obj('Fullmektig', item.motpartsPersonident), @@ -2395,7 +2395,6 @@ export function mapBestillingData(bestillingData, bestillingsinformasjon, firstI kjoenn, navn, telefonnummer, - fullmakt, bostedsadresse, oppholdsadresse, kontaktadresse, @@ -2426,7 +2425,6 @@ export function mapBestillingData(bestillingData, bestillingsinformasjon, firstI mapNavn(navn, data) mapTelefonnummer(telefonnummer, data) mapVergemaal(vergemaal, data) - mapFullmakt(fullmakt, data) mapTilrettelagtKommunikasjon(tilrettelagtKommunikasjon, data) mapStatsborgerskap(statsborgerskap, data) mapDoedsfall(doedsfall, data) @@ -2445,6 +2443,7 @@ export function mapBestillingData(bestillingData, bestillingsinformasjon, firstI mapKontaktinformasjonForDoedsbo(kontaktinformasjonForDoedsbo, data) } + mapFullmakt(bestillingData, data) mapTpsMessaging(bestillingData, data) mapAareg(bestillingData, data) mapSigrunStub(bestillingData, data) diff --git a/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/miljoeStatus/fagsystemStatus/IdentList.tsx b/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/miljoeStatus/fagsystemStatus/IdentList.tsx index 482030ee316..8a350acbc8c 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/miljoeStatus/fagsystemStatus/IdentList.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestilling/sammendrag/miljoeStatus/fagsystemStatus/IdentList.tsx @@ -22,23 +22,25 @@ const NavigerTilIdentButton = styled(Button)` function IdentList({ identer }: { identer: string[] }) { const dispatch = useDispatch() const [loading, setLoading] = useState(false) + return (
    - {identer.map((ident, idx) => - loading ? ( + {identer.map((ident, idx) => { + const cleanIdent = ident?.replace(/[()]/g, '') + return loading ? ( ) : ( { setLoading(true) - return dispatch(navigerTilPerson(ident)) + return dispatch(navigerTilPerson(cleanIdent)) }} key={idx} > {ident} - ), - )} + ) + })}
) } diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/startModal/NyIdent/NyIdent.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/startModal/NyIdent/NyIdent.tsx index fe161c36d94..1eee5d9fab0 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/startModal/NyIdent/NyIdent.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/startModal/NyIdent/NyIdent.tsx @@ -77,6 +77,10 @@ export const NyIdent = ({ brukernavn, onAvbryt, onSubmit }: NyBestillingProps) = const valgtMal = malOptions.find((mal) => mal.value === formMethods.watch('mal')) const valgtMalTpsfValues = _.get(valgtMal, 'data.bestilling.tpsf') const erTpsfMal = tpsfAttributter.some((a) => _.has(valgtMalTpsfValues, a)) + const erGammelFullmaktMal = _.has( + valgtMal, + 'data.bestilling.pdldata.person.fullmakt.[0].omraader.[0]', + ) return ( @@ -128,6 +132,13 @@ export const NyIdent = ({ brukernavn, onAvbryt, onSubmit }: NyBestillingProps) = isDisabled={!malAktiv} /> + {erGammelFullmaktMal && ( + + Denne malen er utdatert, og vil muligens ikke fungere som den skal. Dette fordi + master for fullmakt er endret til Representasjon. Vi anbefaler at du oppretter en ny + mal og sletter denne malen. + + )} {erTpsfMal && ( Denne malen er utdatert, og vil dessverre ikke fungere som den skal. Dette fordi diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx index b65065f73c7..f5d0c7d107e 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg1/paneler/Personinformasjon.tsx @@ -11,6 +11,7 @@ import { getInitialNavn, getInitialStatsborgerskap, initialFullmakt, + initialPdlPerson, initialSikkerhetstiltak, initialTilrettelagtKommunikasjon, initialVergemaal, @@ -29,8 +30,8 @@ const utvandret = 'utvandretTilLand' // @ts-ignore export const PersoninformasjonPanel = ({ stateModifier, testnorgeIdent }) => { - const sm = stateModifier(PersoninformasjonPanel.initialValues) - const opts = useContext(BestillingsveilederContext) + const sm: any = stateModifier(PersoninformasjonPanel.initialValues) + const opts: any = useContext(BestillingsveilederContext) const gruppeId = opts?.gruppeId || opts?.gruppe?.id const { identer, loading: gruppeLoading, error: gruppeError } = useGruppeIdenter(gruppeId) @@ -39,15 +40,12 @@ export const PersoninformasjonPanel = ({ stateModifier, testnorgeIdent }) => { const opprettFraEksisterende = opts.is.opprettFraIdenter const leggTil = opts.is.leggTil || opts.is.leggTilPaaGruppe - const testNorgePerson = opts?.identMaster === 'PDL' const npidPerson = opts?.identtype === 'NPID' const ukjentGruppe = !gruppeId - const tekstUkjentGruppe = 'Funksjonen er deaktivert da personer for relasjon er ukjent' - const testNorgeFlere = testNorgePerson && opts?.antall > 1 - const tekstFlerePersoner = 'Funksjonen er kun tilgjengelig per individ, ikke for gruppe' const leggTilPaaGruppe = !!opts?.leggTilPaaGruppe const tekstLeggTilPaaGruppe = 'Støttes ikke for "legg til på alle" i grupper som inneholder personer fra Test-Norge' + const tekstUkjentGruppe = 'Funksjonen er deaktivert da personer for relasjon er ukjent' const harFnr = opts.identtype === 'FNR' // Noen egenskaper kan ikke endres når personen opprettes fra eksisterende eller videreføres med legg til @@ -58,7 +56,7 @@ export const PersoninformasjonPanel = ({ stateModifier, testnorgeIdent }) => { (testnorgeIdent && (ukjentGruppe || opts?.antall > 1)) || (harTestnorgeIdenter && leggTilPaaGruppe) ) { - ignoreKeys.push('fullmakt', 'vergemaal', 'innvandretFraLand', 'utvandretTilLand') + ignoreKeys.push('vergemaal', 'innvandretFraLand', 'utvandretTilLand') } if (sm.attrs.utenlandskBankkonto.checked) { ignoreKeys.push('norskBankkonto') @@ -106,15 +104,13 @@ export const PersoninformasjonPanel = ({ stateModifier, testnorgeIdent }) => { disabled={sm.attrs.norskBankkonto.checked} /> + + - - ) @@ -176,15 +172,7 @@ export const PersoninformasjonPanel = ({ stateModifier, testnorgeIdent }) => { '' } /> - + @@ -235,8 +223,9 @@ PersoninformasjonPanel.initialValues = ({ set, opts, setMulti, del, has }) => { pdl: 'pdldata.person.telefonnummer', tpsM: 'tpsMessaging.telefonnummer', }, + fullmakt: 'fullmakt', + fullmaktPDL: 'pdldata.person.fullmakt', vergemaal: 'pdldata.person.vergemaal', - fullmakt: 'pdldata.person.fullmakt', sikkerhetstiltak: 'pdldata.person.sikkerhetstiltak', tilrettelagtKommunikasjon: 'pdldata.person.tilrettelagtKommunikasjon', } @@ -409,10 +398,21 @@ PersoninformasjonPanel.initialValues = ({ set, opts, setMulti, del, has }) => { remove: () => del(paths.vergemaal), }, fullmakt: { - label: 'Fullmakt', - checked: has(paths.fullmakt), - add: () => set(paths.fullmakt, [initialFullmakt]), - remove: () => del(paths.fullmakt), + label: 'Har fullmektig', + checked: has(paths.fullmakt) || has(paths.fullmaktPDL), + add: () => { + set('fullmakt', [ + { + ...initialFullmakt, + master: identMaster === 'PDL' || identtype === 'NPID' ? 'PDL' : 'FREG', + }, + ]) + set('pdldata.person.fullmakt', [{ nyfullMektig: initialPdlPerson }]) + }, + remove: () => { + del('fullmakt') + del('pdldata.person.fullmakt') + }, }, sikkerhetstiltak: { label: 'Sikkerhetstiltak', diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg2/DollyValidation.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg2/DollyValidation.tsx index e719937fb4b..b16c33845fb 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg2/DollyValidation.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg2/DollyValidation.tsx @@ -22,6 +22,7 @@ import { MiljoVelger } from '@/components/miljoVelger/MiljoVelger' import { MalForm } from '@/components/bestillingsveileder/stegVelger/steg/steg3/MalForm' import { VelgGruppe } from '@/components/bestillingsveileder/stegVelger/steg/steg3/VelgGruppe' import { SkattekortForm } from '@/components/fagsystem/skattekort/form/Form' +import { FullmaktForm } from '@/components/fagsystem/fullmakt/form/FullmaktForm' import { YrkesskaderForm } from '@/components/fagsystem/yrkesskader/form/Form' export const DollyValidation = Yup.object({ @@ -42,6 +43,7 @@ export const DollyValidation = Yup.object({ ...ArenaForm.validation, ...UdistubForm.validation, ...SkjermingForm.validation, + ...FullmaktForm.validation, ...DokarkivForm.validation, ...HistarkForm.validation, ...OrganisasjonForm.validation, diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg2/Steg2.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg2/Steg2.tsx index 7576fcea519..f0a7475a5b4 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg2/Steg2.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/stegVelger/steg/steg2/Steg2.tsx @@ -26,6 +26,7 @@ import { KrrstubForm } from '@/components/fagsystem/krrstub/form/KrrForm' import { useFormContext } from 'react-hook-form' import { SkattekortForm } from '@/components/fagsystem/skattekort/form/Form' import { PensjonsavtaleForm } from '@/components/fagsystem/pensjonsavtale/form/Form' +import { FullmaktForm } from '@/components/fagsystem/fullmakt/form/FullmaktForm' import { AfpOffentligForm } from '@/components/fagsystem/afpOffentlig/form/Form' import { YrkesskaderForm } from '@/components/fagsystem/yrkesskader/form/Form' @@ -67,6 +68,7 @@ export const Steg2 = () => { return (
+ diff --git a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/utils.tsx b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/utils.tsx index cc018c30744..9ff64d4609f 100644 --- a/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/utils.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/bestillingsveileder/utils.tsx @@ -57,6 +57,7 @@ export const rootPaths = [ 'pdldata.opprettNyPerson.foedtFoer', 'pdlforvalter', 'aareg', + 'fullmakt', 'arbeidsplassenCV', 'skjerming', 'sigrunstub', diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/FullmaktType.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/FullmaktType.tsx new file mode 100644 index 00000000000..3ec3ea676cb --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/FullmaktType.tsx @@ -0,0 +1,17 @@ +export type FullmaktType = { + gyldigFraOgMed: string + gyldigTilOgMed?: string + fullmaktsgiver: string + fullmaktsgiverNavn: string + fullmektig: string + fullmektigsNavn: string + registrert: string + opphoert?: boolean + kilde: string + omraade: Omraade[] +} + +export type Omraade = { + tema: string + handling: string[] +} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/form/FullmaktForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/form/FullmaktForm.tsx new file mode 100644 index 00000000000..c707975c021 --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/form/FullmaktForm.tsx @@ -0,0 +1,221 @@ +import * as React from 'react' +import { useContext, useEffect } from 'react' +import { FormSelect } from '@/components/ui/form/inputs/select/Select' +import { FormDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker' +import { FormDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' +import { PdlPersonExpander } from '@/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonExpander' +import { initialFullmakt, initialPdlPerson } from '@/components/fagsystem/pdlf/form/initialValues' +import { UseFormReturn } from 'react-hook-form/dist/types' +import { BestillingsveilederContext } from '@/components/bestillingsveileder/BestillingsveilederContext' +import { SelectOptionsManager as Options } from '@/service/SelectOptions' +import { Vis } from '@/components/bestillingsveileder/VisAttributt' +import Panel from '@/components/ui/panel/Panel' +import { erForsteEllerTest, panelError } from '@/components/ui/form/formUtils' +import { useFormContext } from 'react-hook-form' +import { useFullmaktOmraader } from '@/utils/hooks/useFullmakt' +import { Omraade } from '@/components/fagsystem/fullmakt/FullmaktType' +import { Option } from '@/service/SelectOptionsOppslag' +import Loading from '@/components/ui/loading/Loading' +import { ErrorMessage } from '@hookform/error-message' +import { validation } from '@/components/fagsystem/fullmakt/form/validation' + +interface FullmaktProps { + formMethods: UseFormReturn + path?: string + opts?: any + eksisterendeNyPerson?: any +} + +const alleHandlinger = ['LES', 'SKRIV', 'KOMMUNISER'] + +const mapLegacyFullmaktTilNyFullmakt = ( + legacyFullmakt: any, + formMethods: UseFormReturn, + omraadeKodeverk: Option[], +) => { + if (!legacyFullmakt || legacyFullmakt.length === 0) { + return null + } + const nyeFullmakter = legacyFullmakt + .filter((gammelFullmakt) => gammelFullmakt.omraader) + .map((gammelFullmakt) => ({ + omraader: undefined, //Navn på feltet er endret i ny ekstern fullmakt + gyldigFraOgMed: gammelFullmakt.gyldigFraOgMed, + gyldigTilOgMed: gammelFullmakt.gyldigTilOgMed, + fullmektig: gammelFullmakt.motpartsPersonident, + omraade: gammelFullmakt.omraader.map((legacyOmraade, index) => { + if (legacyOmraade === '*') { + //TODO: Handle "alle" value dersom forespurt av brukere i ny fullmakt + return { tema: 'AAP', handling: alleHandlinger } + } + if (omraadeKodeverk.filter((option) => option.value === legacyOmraade)?.length === 0) { + console.warn( + 'Fant ikke gammel kodeverk-verdi fra denne malen i nytt kodeverk. Velger annen verdi', + ) + return { + tema: omraadeKodeverk[omraadeKodeverk.length - index]?.value, + handling: alleHandlinger, + } + } + return { + tema: legacyOmraade, + handling: alleHandlinger, + } + }), + })) + formMethods.setValue('fullmakt', nyeFullmakter) + formMethods.setValue('pdldata.person.fullmakt', [{ nyfullMektig: initialPdlPerson }]) +} + +export const fullmaktAttributter = ['fullmakt', 'pdldata.person.fullmakt'] + +const hasUserInput = (formMethods: UseFormReturn) => { + const fullmaktArray = formMethods.watch('fullmakt') + if (!fullmaktArray || fullmaktArray.length === 0) { + return false + } + if (fullmaktArray.length > 1) { + return true + } + const fullmaktValues = fullmaktArray[0] + return ( + fullmaktValues.gyldigFraOgMed || + fullmaktValues.gyldigTilOgMed || + fullmaktValues.omraade?.[0]?.tema !== '' + ) +} + +const getFullmaktTemaLabel = (temaValue: string, omraadeKodeverk: Option[]) => { + if (!temaValue || !omraadeKodeverk || omraadeKodeverk.length === 0) { + return null + } + const valgtOption = omraadeKodeverk.filter((option) => option.value === temaValue)?.[0] + return valgtOption ? `${valgtOption.label}` : temaValue +} + +export const Fullmakt = ({ + formMethods, + path, + opts, + eksisterendeNyPerson = null, +}: FullmaktProps) => { + const legacyFullmakt = formMethods.watch('pdldata.person.fullmakt') + const { omraadeKodeverk, loading } = useFullmaktOmraader() + + useEffect(() => { + if (!hasUserInput(formMethods)) { + mapLegacyFullmaktTilNyFullmakt(legacyFullmakt, formMethods, omraadeKodeverk) + } + }, []) + + if (loading) { + return + } + + const isTestnorgeIdent = opts?.identMaster === 'PDL' + const chosenTemaValues = + (path && formMethods.watch(path)?.omraade?.map((omraade: Omraade) => omraade.tema)) || [] + + return ( +
+ + {(path: string) => ( + <> + !chosenTemaValues.includes(option.value), + )} + size="grow" + isClearable={false} + normalFontPlaceholder={true} + /> + { + formMethods.setValue( + `${path}.handling`, + val?.some((opt) => opt.value?.includes('*')) + ? alleHandlinger + : val.map((opt) => opt.value), + ) + formMethods.trigger(path) + }} + isClearable={true} + isMulti={true} + /> + + )} + + + + + {formMethods.formState.errors && ( + ( +

{message}

+ )} + /> + )} +
+ ) +} + +export const FullmaktForm = () => { + const formMethods = useFormContext() + const fullmaktValues = formMethods.watch('fullmakt') + const opts: any = useContext(BestillingsveilederContext) + const val = formMethods.watch(fullmaktAttributter) + + if ((!fullmaktValues || fullmaktValues?.length === 0) && val.some((v) => v)) { + formMethods.setValue('fullmakt', [initialFullmakt]) + } + + return ( + + + + {(path: string) => } + + + + ) +} + +FullmaktForm.validation = validation diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/form/validation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/form/validation.tsx new file mode 100644 index 00000000000..89e12a22faa --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/form/validation.tsx @@ -0,0 +1,42 @@ +import * as Yup from 'yup' +import { ifPresent, requiredDate, requiredString } from '@/utils/YupValidations' +import { testDatoTom } from '@/components/fagsystem/utils' +import _ from 'lodash' +import { isBefore, subDays } from 'date-fns' + +export const validation = { + fullmakt: ifPresent( + '$fullmakt', + Yup.array() + .min(1, 'Må inneholde minst en fullmakt') + .of( + Yup.object({ + omraade: Yup.array() + .min(1, 'Må inneholde minst ett område') + .of( + Yup.object({ + tema: requiredString, + handling: Yup.array().min(1, 'Må inneholde minst en handling').of(requiredString), + }), + ), + gyldigFraOgMed: requiredDate.test( + 'reqDate', + 'Dato kan ikke være tilbake i tid', + (value) => { + const chosenDate = _.isString(value) ? new Date(value) : value + const currentDate = subDays(new Date(), 1) + return isBefore(currentDate, chosenDate) + }, + ), + gyldigTilOgMed: ifPresent( + '$fullmakt.gyldigTilOgMed', + testDatoTom( + Yup.date().nullable(), + 'gyldigFraOgMed', + 'Sluttdato må være etter startdato', + ), + ), + }), + ), + ), +} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/visning/Fullmakt.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/visning/Fullmakt.tsx new file mode 100644 index 00000000000..7f41978c23c --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/visning/Fullmakt.tsx @@ -0,0 +1,60 @@ +import { TitleValue } from '@/components/ui/titleValue/TitleValue' +import { formatDate, oversettBoolean, toTitleCase } from '@/utils/DataFormatter' +import { FullmaktType, Omraade } from '@/components/fagsystem/fullmakt/FullmaktType' +import React, { Fragment, useState } from 'react' +import { DollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' +import { useFullmaktOmraader } from '@/utils/hooks/useFullmakt' +import Button from '@/components/ui/button/Button' + +type FullmaktProps = { + idx: number + fullmakt: FullmaktType +} + +export const Fullmakt = ({ fullmakt, idx }: FullmaktProps) => { + const { omraadeKodeverk = [] } = useFullmaktOmraader() + const [visOmraader, setVisOmraader] = useState(false) + + return ( + + + + + + + + + {fullmakt?.omraade?.length > 2 && ( + + )} + {(visOmraader || fullmakt?.omraade?.length <= 2) && ( + + {(omraade: Omraade, idx: number) => { + return ( + +
+ + option.value === omraade.tema)?.label} + /> +
+
+ ) + }} +
+ )} +
+ ) +} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/visning/FullmaktVisning.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/visning/FullmaktVisning.tsx new file mode 100644 index 00000000000..176369c4c03 --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/fullmakt/visning/FullmaktVisning.tsx @@ -0,0 +1,44 @@ +import { FullmaktType } from '@/components/fagsystem/fullmakt/FullmaktType' +import { useFullmektig } from '@/utils/hooks/useFullmakt' +import React, { useEffect, useState } from 'react' +import { DollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' +import { Fullmakt } from '@/components/fagsystem/fullmakt/visning/Fullmakt' +import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary' +import SubOverskrift from '@/components/ui/subOverskrift/SubOverskrift' + +type FullmaktProps = { + ident: string +} + +export const FullmaktVisning = ({ ident }: FullmaktProps) => { + const { fullmektig } = useFullmektig(ident) + const [fullmaktData, setFullmaktData] = useState([]) + + useEffect(() => { + if (fullmektig?.length > 0) { + setFullmaktData(fullmektig) + } + }, [fullmektig]) + + if (!fullmektig || fullmektig.length === 0) { + return null + } + + return ( + +
+ +
+ + `Fullmektig: ${fullmakt?.fullmektigsNavn} (${fullmakt?.fullmektig})` + } + > + {(item: FullmaktType, idx: number) => } + +
+
+
+ ) +} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/index.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/index.tsx index adfb50e4c6f..6d88115b7bb 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/index.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/index.tsx @@ -14,11 +14,13 @@ import { TpsfVisning } from '@/components/fagsystem/tpsf/visning/Visning' import { DokarkivVisning } from '@/components/fagsystem/dokarkiv/visning' import { HistarkVisning } from '@/components/fagsystem/histark/visning' import { SykemeldingVisning } from '@/components/fagsystem/sykdom/visning/Visning' +import { FullmaktVisning } from './fullmakt/visning/FullmaktVisning' export { TpsfVisning, KrrVisning, PdlfVisning, + FullmaktVisning, ArenaVisning, AaregVisning, UdiVisning, diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdl/visning/PdlVisning.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdl/visning/PdlVisning.tsx index 4282b2eb4c5..57e446e4ade 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdl/visning/PdlVisning.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdl/visning/PdlVisning.tsx @@ -5,7 +5,6 @@ import { PdlPersonInfo } from '@/components/fagsystem/pdl/visning/partials/PdlPe import { IdentInfo } from '@/components/fagsystem/pdlf/visning/partials/Identinfo' import { GeografiskTilknytning } from '@/components/fagsystem/pdlf/visning/partials/GeografiskTilknytning' import { PdlNasjonalitet } from '@/components/fagsystem/pdl/visning/partials/nasjonalitet/PdlNasjonalitet' -import { PdlFullmakt } from '@/components/fagsystem/pdl/visning/partials/PdlFullmakt' import { PdlSikkerhetstiltak } from '@/components/fagsystem/pdl/visning/partials/PdlSikkerhetstiltak' import { PdlData } from '@/pages/gruppe/PersonVisning/PersonMiljoeinfo/PdlDataTyper' import { TilrettelagtKommunikasjon } from '@/components/fagsystem/pdlf/visning/partials/TilrettelagtKommunikasjon' @@ -24,6 +23,8 @@ import { PdlDeltBosted } from '@/components/fagsystem/pdl/visning/partials/adres import { Doedsfall } from '@/components/fagsystem/pdlf/visning/partials/Doedsfall' import { PdlVergemaal } from '@/components/fagsystem/pdl/visning/partials/vergemaal/PdlVergemaal' import { getBankkontoData } from '@/components/fagsystem/pdlf/visning/PdlfVisning' +import { FullmaktVisning } from '@/components/fagsystem' +import React from 'react' type PdlVisningProps = { pdlData: PdlData @@ -58,7 +59,6 @@ export const PdlVisning = ({ opphold, kontaktadresse, adressebeskyttelse, - fullmakt, utenlandskIdentifikasjonsnummer, falskIdentitet, sikkerhetstiltak, @@ -72,6 +72,10 @@ export const PdlVisning = ({ const identtype = pdlfPerson?.identtype const tmpPdlforvalter = tmpPersoner?.pdlforvalter + const gjeldendeIdent = hentIdenter?.identer?.find( + (id) => !id.historisk && id.gruppe === 'FOLKEREGISTERIDENT', + ) + return (
@@ -87,7 +91,6 @@ export const PdlVisning = ({ - + -} - -const Omraader = styled(TitleValue)` - && { - margin-bottom: 20px; - } -` - -export const Visning = ({ data }: Data) => { - const omraader = data.omraader - ?.map((omraade) => showKodeverkLabel(FullmaktKodeverk.Tema, omraade)) - ?.join(', ') - - return ( - <> -
- - - - - - - -
- - ) -} - -export const PdlFullmakt = ({ data }: DataListe) => { - if (!data || data.length === 0) { - return null - } - return ( -
- - {/* @ts-ignore */} - - {(fullmakt: FullmaktData) => } - -
- ) -} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/initialValues.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/initialValues.tsx index d0bb443b547..3d41db54faf 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/initialValues.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/initialValues.tsx @@ -352,13 +352,10 @@ export const getInitialNyIdent = (master = 'FREG') => ({ }) export const initialFullmakt = { - omraader: [] as any, - gyldigFraOgMed: null as unknown as string, + omraade: [{ tema: '', handling: [] }] as any, + gyldigFraOgMed: new Date(), gyldigTilOgMed: null as unknown as string, - motpartsPersonident: null as unknown as string, - nyFullmektig: initialPdlPerson, - kilde: 'Dolly', - master: 'PDL', + fullmektig: null as unknown as string, } export const initialOpphold = { diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/fullmakt/Fullmakt.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/fullmakt/Fullmakt.tsx deleted file mode 100644 index 4b7ba8d71b4..00000000000 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/fullmakt/Fullmakt.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import * as React from 'react' -import { useContext } from 'react' -import { FormSelect } from '@/components/ui/form/inputs/select/Select' -import { FormDatepicker } from '@/components/ui/form/inputs/datepicker/Datepicker' -import { SelectOptionsOppslag } from '@/service/SelectOptionsOppslag' -import { FormDollyFieldArray } from '@/components/ui/form/fieldArray/DollyFieldArray' -import { AvansertForm } from '@/components/fagsystem/pdlf/form/partials/avansert/AvansertForm' -import { PdlPersonExpander } from '@/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonExpander' -import { initialFullmakt } from '@/components/fagsystem/pdlf/form/initialValues' -import { isEmpty } from '@/components/fagsystem/pdlf/form/partials/utils' -import { SelectOptionsFormat } from '@/service/SelectOptionsFormat' -import { UseFormReturn } from 'react-hook-form/dist/types' -import { BestillingsveilederContext } from '@/components/bestillingsveileder/BestillingsveilederContext' - -interface FullmaktProps { - formMethods: UseFormReturn - path?: string - eksisterendeNyPerson?: any -} - -export const FullmaktForm = ({ formMethods, path, eksisterendeNyPerson = null }: FullmaktProps) => { - const fullmaktOmraader = SelectOptionsOppslag.hentFullmaktOmraader() - const fullmaktOptions = SelectOptionsFormat.formatOptions('fullmaktOmraader', fullmaktOmraader) - const opts: any = useContext(BestillingsveilederContext) - - const isTestnorgeIdent = opts?.identMaster === 'PDL' - - return ( -
-
- -
- - - - -
- ) -} - -export const Fullmakt = ({ formMethods }: FullmaktProps) => { - return ( - - {(path: string) => } - - ) -} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Adresse.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Adresse.tsx index fe63c8b200a..ec566c7c12a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Adresse.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/kontaktinformasjonForDoedsbo/Adresse.tsx @@ -13,7 +13,7 @@ export const Adresse = ({ formMethods, path }) => { return (
{visAdresse ? ( - ) : ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson.tsx index 10ee5c4e453..17227163e5e 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlEksisterendePerson.tsx @@ -1,7 +1,6 @@ import React, { useContext } from 'react' import { FormSelect } from '@/components/ui/form/inputs/select/Select' import Loading from '@/components/ui/loading/Loading' -import { isEmpty } from '@/components/fagsystem/pdlf/form/partials/utils' import { BestillingsveilederContext } from '@/components/bestillingsveileder/BestillingsveilederContext' import { Option } from '@/service/SelectOptionsOppslag' import { ForeldreBarnRelasjon, NyIdent } from '@/components/fagsystem/pdlf/PdlTypes' @@ -11,29 +10,27 @@ import { UseFormReturn } from 'react-hook-form/dist/types' import { usePdlOptions } from '@/utils/hooks/useSelectOptions' interface PdlEksisterendePersonValues { - nyPersonPath?: string eksisterendePersonPath: string + fullmektigsNavnPath?: string label: string formMethods: UseFormReturn - idx: number + idx?: number disabled?: boolean - nyIdentValg?: NyIdent eksisterendeNyPerson?: Option ident?: string } export const PdlEksisterendePerson = ({ - nyPersonPath, eksisterendePersonPath, label, formMethods, idx, disabled = false, - nyIdentValg = null, - eksisterendeNyPerson = null, + eksisterendeNyPerson = null as unknown as Option, + fullmektigsNavnPath = null as unknown as string, ident, }: PdlEksisterendePersonValues) => { - const opts = useContext(BestillingsveilederContext) + const opts: any = useContext(BestillingsveilederContext) const antall = opts?.antall || 1 const gruppeId = opts?.gruppeId || opts?.gruppe?.id || window.location.pathname.split('/')?.[2] @@ -154,10 +151,6 @@ export const PdlEksisterendePerson = ({ return tmpOptions } - const hasNyPersonValues = nyIdentValg - ? !isEmpty(nyIdentValg, ['syntetisk']) - : nyPersonPath && !isEmpty(formMethods.watch(nyPersonPath), ['syntetisk']) - const bestillingFlerePersoner = parseInt(antall) > 1 && (harSivilstand || harNyIdent) const filteredOptions = getFilteredOptionList() @@ -169,13 +162,17 @@ export const PdlEksisterendePerson = ({ { + const navn = person?.label?.match(/-\s(.*?)\s\(/) formMethods.setValue(eksisterendePersonPath, person?.value || null) + if (fullmektigsNavnPath) { + formMethods.setValue(fullmektigsNavnPath, navn?.[1] || person?.label || null) + } formMethods.trigger('pdldata.person') }} label={label} options={filteredOptions} size={'xxlarge'} - isDisabled={hasNyPersonValues || bestillingFlerePersoner || disabled} + isDisabled={bestillingFlerePersoner || disabled} /> ) : pdlError || gruppeError ? ( diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonExpander.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonExpander.tsx index 533ccfeb7fa..e54ce2f853a 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonExpander.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonExpander.tsx @@ -10,6 +10,7 @@ interface PdlPersonValues { path: string nyPersonPath: string eksisterendePersonPath: string + fullmektigsNavnPath?: string eksisterendeNyPerson?: Option label: string formMethods: UseFormReturn @@ -22,6 +23,7 @@ export const PdlPersonExpander = ({ path, nyPersonPath, eksisterendePersonPath, + fullmektigsNavnPath, eksisterendeNyPerson = null, label, formMethods, @@ -55,6 +57,7 @@ export const PdlPersonExpander = ({ path={path} nyPersonPath={nyPersonPath} eksisterendePersonPath={eksisterendePersonPath} + fullmektigsNavnPath={fullmektigsNavnPath} label={label} formMethods={formMethods} nyIdentValg={nyIdentValg} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonForm.tsx index c38ebf1dbe5..d737fc856e2 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/pdlPerson/PdlPersonForm.tsx @@ -17,6 +17,7 @@ interface PdlPersonValues { path: string nyPersonPath: string eksisterendePersonPath: string + fullmektigsNavnPath?: string label: string formMethods: UseFormReturn nyIdentValg?: NyIdent @@ -46,6 +47,7 @@ export const PdlPersonForm = ({ path, nyPersonPath, eksisterendePersonPath, + fullmektigsNavnPath, label, formMethods, nyIdentValg = null, @@ -73,7 +75,9 @@ export const PdlPersonForm = ({ eksisterendePersonPath, type === PersonType.EKSISTERENDE_PERSON ? eksisterendeNyPerson?.value : undefined, ) - formMethods.setValue(`${path}.eksisterendePerson`, type === PersonType.EKSISTERENDE_PERSON) + if (path) { + formMethods.setValue(`${path}.eksisterendePerson`, type === PersonType.EKSISTERENDE_PERSON) + } formMethods.trigger() }, [type]) @@ -123,12 +127,11 @@ export const PdlPersonForm = ({ > {(type === PersonType.EKSISTERENDE_PERSON || isTestnorgeIdent) && ( 1} /> )} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/personinformasjon/Personinformasjon.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/personinformasjon/Personinformasjon.tsx index c8b87460133..382ae187149 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/personinformasjon/Personinformasjon.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/personinformasjon/Personinformasjon.tsx @@ -3,7 +3,6 @@ import Panel from '@/components/ui/panel/Panel' import { Vis } from '@/components/bestillingsveileder/VisAttributt' import { erForsteEllerTest, panelError } from '@/components/ui/form/formUtils' import { Kategori } from '@/components/ui/form/kategori/Kategori' -import { Fullmakt } from '../fullmakt/Fullmakt' import { Sikkerhetstiltak } from '@/components/fagsystem/pdlf/form/partials/sikkerhetstiltak/Sikkerhetstiltak' import { BestillingsveilederContext } from '@/components/bestillingsveileder/BestillingsveilederContext' import { TpsMessagingDiverse } from '@/components/fagsystem/tpsmessaging/form/TpsMessagingDiverse' @@ -21,6 +20,7 @@ import { NorskBankkonto, UtenlandskBankkonto } from '@/components/fagsystem/bank import { SkjermingForm } from '@/components/fagsystem/skjermingsregister/form/SkjermingForm' import { Foedested } from '@/components/fagsystem/pdlf/form/partials/foedsel/Foedested' import { Foedselsdato } from '@/components/fagsystem/pdlf/form/partials/foedsel/Foedselsdato' +import { Fullmakt } from '@/components/fagsystem/fullmakt/form/FullmaktForm' const foedselPaths = ['pdldata.person.foedested', 'pdldata.person.foedselsdato'] @@ -55,8 +55,8 @@ const foedestedPath = ['pdldata.person.foedested'] const foedselsdatoPath = ['pdldata.person.foedselsdato'] const doedsfallPath = ['pdldata.person.doedsfall'] const vergemaalPath = ['pdldata.person.vergemaal'] -const fullmaktPath = ['pdldata.person.fullmakt'] const sikkerhetstiltakPath = ['pdldata.person.sikkerhetstiltak'] +const fullmaktPath = ['pdldata.person.fullmakt', 'fullmakt'] const panelPaths = [ alderPaths, @@ -71,7 +71,6 @@ const panelPaths = [ foedselPaths, doedsfallPath, vergemaalPath, - fullmaktPath, sikkerhetstiltakPath, statsborgerskapPath, utenlandskBankkontoPath, @@ -151,10 +150,6 @@ export const Personinformasjon = ({ formMethods }) => { - - - - diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/sikkerhetstiltak/Sikkerhetstiltak.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/sikkerhetstiltak/Sikkerhetstiltak.tsx index 4b562c18371..eef783ffb48 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/sikkerhetstiltak/Sikkerhetstiltak.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/partials/sikkerhetstiltak/Sikkerhetstiltak.tsx @@ -110,18 +110,9 @@ export const Sikkerhetstiltak = ({ formMethods }: SikkerhetstiltakProps) => { { - handleValueChange(date, 'gyldigFraOgMed', idx) - }} /> - { - handleValueChange(date, 'gyldigTilOgMed', idx) - }} - /> + ) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/fullmakt.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/fullmakt.tsx deleted file mode 100644 index a89c3e435b6..00000000000 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/fullmakt.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Yup from 'yup' -import { testDatoFom, testDatoTom } from '@/components/fagsystem/utils' -import { requiredDate } from '@/utils/YupValidations' -import { nyPerson } from '@/components/fagsystem/pdlf/form/validation/partials/familierelasjoner' - -export const fullmakt = Yup.object({ - omraader: Yup.array().min(1, 'Velg minst ett område'), - gyldigFraOgMed: testDatoFom(requiredDate.nullable(), 'gyldigTilOgMed'), - gyldigTilOgMed: testDatoTom(requiredDate.nullable(), 'gyldigFraOgMed'), - motpartsPersonident: Yup.string() - .test('feltet-mangler', 'Fullmektig er påkrevd', (value, testcontext) => { - return value || testcontext.options.context?.identMaster !== 'PDL' - }) - .nullable(), - nyFullmektig: nyPerson, -}) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/index.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/index.tsx index c6374541562..4ae6a1ec78f 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/index.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/partials/index.tsx @@ -19,7 +19,6 @@ import { sikkerhetstiltak } from './sikkerhetstiltak' import { telefonnummer } from './telefonnummer' import { utenlandskId, falskIdentitet } from './identifikasjon' import { utflytting } from './utflytting' -import { fullmakt } from './fullmakt' import { statsborgerskap } from './statborgerskap' import { vergemaal } from './vergemaal' import { tilrettelagtKommunikasjon } from './tilrettelagtKommunikasjon' @@ -43,7 +42,6 @@ export { utenlandskId, falskIdentitet, utflytting, - fullmakt, statsborgerskap, vergemaal, tilrettelagtKommunikasjon, diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/validation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/validation.tsx index 46fd39035f5..ad5627d5085 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/validation.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/form/validation/validation.tsx @@ -7,7 +7,6 @@ import { falskIdentitet, forelderBarnRelasjon, foreldreansvar, - fullmakt, innflytting, kontaktadresse, kontaktDoedsbo, @@ -127,7 +126,6 @@ export const validation = { '$pdldata.person.adressebeskyttelse', Yup.array().of(adressebeskyttelse), ), - fullmakt: ifPresent('$pdldata.person.fullmakt', Yup.array().of(fullmakt)), sikkerhetstiltak: ifPresent('$pdldata.person.sikkerhetstiltak', sikkerhetstiltak), tilrettelagtKommunikasjon: ifPresent( '$pdldata.person.tilrettelagtKommunikasjon', diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/PdlfVisning.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/PdlfVisning.tsx index bcd19fe9285..71d21367c8f 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/PdlfVisning.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/PdlfVisning.tsx @@ -3,7 +3,6 @@ import { FalskIdentitet } from '@/components/fagsystem/pdlf/visning/partials/Fal import { KontaktinformasjonForDoedsbo } from '@/components/fagsystem/pdlf/visning/partials/KontaktinformasjonForDoedsbo' import { ErrorBoundary } from '@/components/ui/appError/ErrorBoundary' import Loading from '@/components/ui/loading/Loading' -import { Fullmakt } from '@/components/fagsystem/pdlf/visning/partials/Fullmakt' import { Telefonnummer } from '@/components/fagsystem/pdlf/visning/partials/Telefonnummer' import { TilrettelagtKommunikasjon } from '@/components/fagsystem/pdlf/visning/partials/TilrettelagtKommunikasjon' import { Boadresse } from '@/components/fagsystem/pdlf/visning/partials/Boadresse' @@ -23,6 +22,7 @@ import { Persondetaljer } from '@/components/fagsystem/pdlf/visning/partials/Per import { PdlSikkerhetstiltak } from '@/components/fagsystem/pdl/visning/partials/PdlSikkerhetstiltak' import { TpsMBankkonto } from '@/components/fagsystem/pdl/visning/partials/tpsMessaging/TpsMBankkonto' import { ForeldreansvarVisning } from '@/components/fagsystem/pdlf/visning/partials/Foreldreansvar' +import { FullmaktVisning } from '@/components/fagsystem' export const getBankkontoData = (data) => { if (data?.kontoregister) { @@ -121,13 +121,6 @@ export const PdlfVisning = ({ fagsystemData, loading, tmpPersoner, erRedigerbar relasjoner={data?.relasjoner} erRedigerbar={erRedigerbar} /> - + - tmpPersoner?: Array - ident?: string - relasjoner: Array -} - -type DataListe = { - data: Array - tmpPersoner?: Array - ident?: string - relasjoner: Array - erRedigerbar?: boolean -} - -const Omraader = styled(TitleValue)` - && { - margin-bottom: 20px; - } -` - -const FullmaktLes = ({ fullmaktData, relasjoner, redigertRelatertePersoner = null, idx }) => { - if (!fullmaktData) { - return null - } - - const fullmektigIdent = fullmaktData.motpartsPersonident - const fullmektig = relasjoner?.find( - (relasjon) => relasjon.relatertPerson?.ident === fullmektigIdent, - ) - const fullmektigRedigert = redigertRelatertePersoner?.find( - (item) => item.relatertPerson?.ident === fullmektigIdent, - ) - - const omraader = fullmaktData.omraader - ?.map((omraade) => showKodeverkLabel(FullmaktKodeverk.Tema, omraade)) - ?.join(', ') - - return ( - <> -
- -
- - - {!fullmektig && !fullmektigRedigert && ( - - )} -
-
- {(fullmektig || fullmektigRedigert) && ( - - )} - - ) -} - -export const FullmaktVisning = ({ - fullmaktData, - idx, - data, - tmpPersoner, - ident, - relasjoner, -}: Data) => { - const initFullmakt = Object.assign(_.cloneDeep(initialFullmakt), data[idx]) - let initialValues = { fullmakt: initFullmakt } - - const redigertFullmaktPdlf = _.get(tmpPersoner, `${ident}.person.fullmakt`)?.find( - (a: FullmaktValues) => a.id === fullmaktData.id, - ) - const redigertRelatertePersoner = _.get(tmpPersoner, `${ident}.relasjoner`) - - const slettetFullmaktPdlf = tmpPersoner?.hasOwnProperty(ident) && !redigertFullmaktPdlf - if (slettetFullmaktPdlf) { - return - } - - const fullmaktValues = redigertFullmaktPdlf ? redigertFullmaktPdlf : fullmaktData - let redigertFullmaktValues = redigertFullmaktPdlf - ? { - fullmakt: Object.assign(_.cloneDeep(initialFullmakt), redigertFullmaktPdlf), - } - : null - - const eksisterendeNyPerson = redigertRelatertePersoner - ? getEksisterendeNyPerson(redigertRelatertePersoner, fullmaktValues?.motpartsPersonident, [ - 'FULLMEKTIG', - ]) - : getEksisterendeNyPerson(relasjoner, fullmaktValues?.motpartsPersonident, ['FULLMEKTIG']) - - if (eksisterendeNyPerson && initialValues?.fullmakt?.nyFullmektig) { - initialValues.fullmakt.nyFullmektig = initialPdlPerson - } - - if (eksisterendeNyPerson && redigertFullmaktValues?.fullmakt?.nyFullmektig) { - redigertFullmaktValues.fullmakt.nyFullmektig = initialPdlPerson - } - - return ( - - } - initialValues={initialValues} - eksisterendeNyPerson={eksisterendeNyPerson} - redigertAttributt={redigertFullmaktValues} - path="fullmakt" - ident={ident} - /> - ) -} - -export const Fullmakt = ({ - data, - tmpPersoner, - ident, - relasjoner, - erRedigerbar = true, -}: DataListe) => { - if (!data || data.length < 1) { - return null - } - const fullmaktRelasjoner = relasjoner?.filter( - (relasjon) => relasjon.relasjonType === 'FULLMEKTIG', - ) - - return ( -
- -
- - - {(fullmakt: FullmaktData, idx: number) => - erRedigerbar ? ( - - ) : ( - - ) - } - - -
-
- ) -} diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/partials/Persondetaljer.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/partials/Persondetaljer.tsx index 751daf5471d..0485962c0ed 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/partials/Persondetaljer.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/partials/Persondetaljer.tsx @@ -23,7 +23,7 @@ type PersondetaljerTypes = { data: any tmpPersoner: any ident: string - erPdlVisning: boolean + erPdlVisning?: boolean tpsMessaging: any tpsMessagingLoading?: boolean skjermingData: Skjerming diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/visningRedigerbar/VisningRedigerbar.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/visningRedigerbar/VisningRedigerbar.tsx index d955d7805ed..3e27fc771cc 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/visningRedigerbar/VisningRedigerbar.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/visningRedigerbar/VisningRedigerbar.tsx @@ -16,7 +16,6 @@ import { BostedsadresseForm } from '@/components/fagsystem/pdlf/form/partials/ad import { OppholdsadresseForm } from '@/components/fagsystem/pdlf/form/partials/adresser/oppholdsadresse/Oppholdsadresse' import { KontaktadresseForm } from '@/components/fagsystem/pdlf/form/partials/adresser/kontaktadresse/Kontaktadresse' import { VergemaalForm } from '@/components/fagsystem/pdlf/form/partials/vergemaal/Vergemaal' -import { FullmaktForm } from '@/components/fagsystem/pdlf/form/partials/fullmakt/Fullmakt' import { SivilstandForm } from '@/components/fagsystem/pdlf/form/partials/familierelasjoner/sivilstand/Sivilstand' import { AdressebeskyttelseForm, @@ -75,7 +74,6 @@ enum Attributt { Innvandring = 'innflytting', Utvandring = 'utflytting', Vergemaal = 'vergemaal', - Fullmakt = 'fullmakt', Boadresse = 'bostedsadresse', Oppholdsadresse = 'oppholdsadresse', Kontaktadresse = 'kontaktadresse', @@ -264,14 +262,6 @@ export const VisningRedigerbar = ({ eksisterendeNyPerson={eksisterendeNyPerson} /> ) - case Attributt.Fullmakt: - return ( - - ) case Attributt.Boadresse: return ( { + const mutate = useMatchMutate() const [visningModus, setVisningModus] = useState(Modus.Les) const [errorMessagePdlf, setErrorMessagePdlf] = useState(null) const [errorMessagePdl, setErrorMessagePdl] = useState(null) @@ -202,20 +209,22 @@ export const VisningRedigerbarPersondetaljer = ({ for (const attr of Object.keys(slettAttr)) { if (slettAttr[attr]) { if (attr === 'skjerming') { + const fornavn = dataVisning?.props?.person?.navn?.[0]?.fornavn + const etternavn = dataVisning?.props?.person?.navn?.[0]?.etternavn skjerming.oppdatert = true setVisningModus(Modus.LoadingSkjerming) - await SkjermingApi.deleteSkjerming(ident) + await SkjermingApi.deleteSkjerming(ident, fornavn, etternavn) .catch((error) => { skjermingError(error) skjerming.feil = true }) .then(() => { - if (!skjerming.feil) { - TpsMessagingApi.deleteSkjerming(ident).catch((error) => { - skjermingError(error) - skjerming.feil = true - }) - } + console.log('Skjerming slettet') + skjerming.oppdatert = false + setVisningModus(Modus.Les) + mutate(REGEX_BACKEND_GRUPPER) + mutate(REGEX_BACKEND_BESTILLINGER) + window.location.reload() }) } else { pdlf.oppdatert = true @@ -249,11 +258,16 @@ export const VisningRedigerbarPersondetaljer = ({ .then(() => { if (skjerming.oppdatert && !skjerming.feil) { setVisningModus(Modus.LoadingSkjerming) - getSkjermingsregister().then(() => { - if (mountedRef.current) { - setVisningModus(Modus.Les) - } - }) + getSkjermingsregister() + .then(() => { + if (mountedRef.current) { + setVisningModus(Modus.Les) + } + }) + .catch((error) => { + console.log('error: ', error) //TODO - SLETT MEG + skjermingError(error) + }) } }) } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/visningRedigerbar/VisningRedigerbarValidation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/visningRedigerbar/VisningRedigerbarValidation.tsx index fcd3e7fd71a..42353f80f5f 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/visningRedigerbar/VisningRedigerbarValidation.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/pdlf/visning/visningRedigerbar/VisningRedigerbarValidation.tsx @@ -6,7 +6,6 @@ import { bostedsadresse, doedfoedtBarn, forelderBarnRelasjon, - fullmakt, innflytting, kontaktadresse, kontaktDoedsbo, @@ -30,7 +29,6 @@ export const visningRedigerbarValidation = Yup.object().shape( innflytting: ifPresent('innflytting', innflytting), utflytting: ifPresent('utflytting', utflytting), vergemaal: ifPresent('vergemaal', vergemaal), - fullmakt: ifPresent('fullmakt', fullmakt), bostedsadresse: ifPresent('bostedsadresse', bostedsadresse), oppholdsadresse: ifPresent('oppholdsadresse', oppholdsadresse), kontaktadresse: ifPresent('kontaktadresse', kontaktadresse), @@ -57,7 +55,6 @@ export const visningRedigerbarValidation = Yup.object().shape( ['innflytting', 'innflytting'], ['utflytting', 'utflytting'], ['vergemaal', 'vergemaal'], - ['fullmakt', 'fullmakt'], ['bostedsadresse', 'bostedsadresse'], ['oppholdsadresse', 'oppholdsadresse'], ['kontaktadresse', 'kontaktadresse'], diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/SkjermingForm.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/SkjermingForm.tsx index 380c71485f0..4614c2a58f8 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/SkjermingForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/SkjermingForm.tsx @@ -20,11 +20,6 @@ export const SkjermingForm = ({ formMethods }) => { } } - const settFormDate = (value, path) => { - formMethods.setValue(`skjerming.${path}`, value) - formMethods.trigger(`skjerming.${path}`) - } - const harSkjerming = HarAktivSkjerming() return ( @@ -33,21 +28,11 @@ export const SkjermingForm = ({ formMethods }) => { name="skjerming.egenAnsattDatoFom" label="Skjerming fra" disabled={harSkjerming} - onChange={(date) => { - settFormDate(date, 'egenAnsattDatoFom') - }} maxDate={new Date()} visHvisAvhuket /> {harSkjerming && ( - { - settFormDate(date, 'egenAnsattDatoTom') - }} - visHvisAvhuket - /> + )}
) diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/validation.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/validation.tsx index 8d675042890..741bf6ffad4 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/validation.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/skjermingsregister/form/validation.tsx @@ -9,8 +9,8 @@ export const validation = { egenAnsattDatoFom: ifPresent('$skjerming.egenAnsattDatoFom', requiredDate), egenAnsattDatoTom: ifPresent( '$skjerming.egenAnsattDatoTom', - testDatoTom(Yup.string(), 'egenAnsattDatoFom') + testDatoTom(Yup.string(), 'egenAnsattDatoFom'), ), - }) + }), ), } diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/tpsf/visning/Visning.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/tpsf/visning/Visning.tsx index 15eddae04a8..129e48d241d 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/tpsf/visning/Visning.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/tpsf/visning/Visning.tsx @@ -1,6 +1,5 @@ import _ from 'lodash' import { - Fullmakt, MidlertidigAdresse, Postadresse, Relasjoner, @@ -22,7 +21,6 @@ export const TpsfVisning = ({ data }) => { - diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/tpsf/visning/partials/index.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/tpsf/visning/partials/index.tsx index a65724a2ed2..196fd8afda5 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/tpsf/visning/partials/index.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/tpsf/visning/partials/index.tsx @@ -1,4 +1,3 @@ -import { Fullmakt } from '@/components/fagsystem/pdlf/visning/partials/Fullmakt' import { TpsfPersoninfo } from '@/components/fagsystem/tpsf/visning/partials/Personinfo' import { TpsfNasjonalitet } from '@/components/fagsystem/tpsf/visning/partials/Nasjonalitet' import { TpsfBoadresse } from '@/components/fagsystem/tpsf/visning/partials/Boadresse' @@ -17,5 +16,4 @@ export { TpsfIdenthistorikk, Relasjoner, TpsfVergemaal, - Fullmakt, } diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx index 869b9a7c182..a88d7156d62 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/DollyFieldArray.tsx @@ -156,7 +156,7 @@ export const DollyFieldArray = ({ nested = false, children, expandable = false, - getHeader = null, + getHeader = null as unknown as Function, whiteBackground = false, }) => { if (ignoreOnSingleElement && data.length === 1) { diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx index 954bdc10221..648a6aaf781 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/fieldArray/ExpandableBlokk.tsx @@ -13,6 +13,7 @@ interface ExpandableBlokkProps { children: React.ReactNode data: T getHeader: (data: T) => string + whiteBackground?: boolean } const Numbering = ({ idx }: NumberingProps) => {idx + 1} diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/formUtils.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/formUtils.tsx index 432e6e6c9d3..096522b86f1 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/formUtils.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/formUtils.tsx @@ -22,7 +22,14 @@ export const fixTimezone = (date: Date) => { if (!isDate(date) || date.getUTCHours() === 0) { return date } - const tzoffset = new Date().getTimezoneOffset() * 60000 //offset in milliseconds + + const erSommertid = date?.toString().includes('sommertid') + + // Denne funker naar dagens dato er vintertid, mulig vi maa ha en ekstra sjekk naar vi er paa sommertid + const tzoffset = erSommertid + ? new Date().getTimezoneOffset() * 60000 * 2 + : new Date().getTimezoneOffset() * 60000 + return new Date(date.getTime() - tzoffset) } @@ -64,6 +71,7 @@ const getValgteAttributter = (values) => { 'pdldata.person.nyident', 'pdldata.person.kontaktinformasjonForDoedsbo', 'aareg', + 'fullmakt', 'sigrunstub', 'sigrunstubPensjonsgivende', 'inntektstub', diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/datepicker/Datepicker.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/datepicker/Datepicker.tsx index a843c464ae5..03a76d496ef 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/datepicker/Datepicker.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/datepicker/Datepicker.tsx @@ -61,7 +61,9 @@ export const Datepicker = ({ inputProps.value && inputProps.value !== '' && inputProps.value?.split('.') const inputDate = (year && new Date(year, month - 1, day)) || undefined if (selectedDate && !_.isEqual(inputDate?.toDateString(), selectedDate?.toDateString())) { - setTimeout(() => setSelected(selectedDate), 200) + setTimeout(() => { + setSelected(selectedDate) + }, 200) } }, [inputProps.value, selectedDate]) @@ -73,6 +75,7 @@ export const Datepicker = ({ onChange={(e) => { setSelected(undefined) inputProps.onChange(e) + formMethods.trigger(name) }} size={'small'} disabled={disabled} @@ -100,12 +103,12 @@ const P_FormDatepicker = ({ ...props }) => { } let val = fixTimezone(date)?.toISOString().substring(0, 19) || null formMethods.setValue(props.name, val, { shouldTouch: true }) - formMethods.trigger() + formMethods.trigger(props.name) } const handleBlur = () => { props?.onBlur?.(SyntEvent(props.name, value)) formMethods.setValue(props.name, value, { shouldTouch: true }) - formMethods.trigger() + formMethods.trigger(props.name) } return } diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx index 4b0b59d77f9..0a68d98fdea 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx @@ -40,6 +40,7 @@ type SelectProps = { feil?: any size?: string info?: any + normalFontPlaceholder?: boolean visHvisAvhuket?: any afterChange?: any isInDialog?: boolean @@ -61,6 +62,7 @@ export const Select = ({ styles, onChange, isInDialog = false, + normalFontPlaceholder = false, ...rest }: SelectProps) => { const formMethods = useFormContext() @@ -104,6 +106,13 @@ export const Select = ({ isLoading={isLoading} isClearable={isClearable} isMulti={isMulti} + theme={(theme) => ({ + ...theme, + colors: { + ...theme.colors, + neutral50: normalFontPlaceholder ? 'unset' : '', + }, + })} onChange={onChange} styles={styles ? styles : { menuPortal: (base) => ({ ...base, zIndex: 99999 }) }} // Naar vi bruker modal fra Aksel maa vi referere til modalens className for at dropdowns ikke skal forsvinne bak modalen diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/icon/Icon.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/icon/Icon.tsx index 06ebfcf265a..1323ff82796 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/icon/Icon.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/icon/Icon.tsx @@ -42,6 +42,7 @@ import { MagnifyingGlassIcon, MinusCircleIcon, PadlockLockedIcon, + PassportIcon, PencilIcon, PersonCircleIcon, PersonFillIcon, @@ -138,7 +139,7 @@ export const icons = { nasjonalitet: EarthIcon, relasjoner: PersonTallShortIcon, identhistorikk: BagdeIcon, - identifikasjon: PersonGroupIcon, + identifikasjon: PassportIcon, adresse: HouseIcon, postadresse: InboxDownIcon, 'midlertidig-adresse': HourglassIcon, diff --git a/apps/dolly-frontend/src/main/js/src/components/ui/panel/Panel.tsx b/apps/dolly-frontend/src/main/js/src/components/ui/panel/Panel.tsx index 129f2b79137..23a7b095163 100644 --- a/apps/dolly-frontend/src/main/js/src/components/ui/panel/Panel.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/ui/panel/Panel.tsx @@ -21,7 +21,7 @@ export default function Panel({ checkAttributeArray = null, uncheckAttributeArray = null, informasjonstekst = null, - iconType = null, + iconType = null as unknown as string, forceOpen = false, setPanelOpen = null, }) { diff --git a/apps/dolly-frontend/src/main/js/src/components/utlogging/logoutBruker.tsx b/apps/dolly-frontend/src/main/js/src/components/utlogging/logoutBruker.tsx index 6e492367c24..ca9c8914dc8 100644 --- a/apps/dolly-frontend/src/main/js/src/components/utlogging/logoutBruker.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/utlogging/logoutBruker.tsx @@ -2,21 +2,7 @@ const logoutBruker = (feilmelding?: string) => { const runningLocalOrIdporten = window.location.hostname.includes('localhost') || window.location.hostname.includes('idporten') - const extractFeilmelding = (stackTrace: string) => { - if (stackTrace?.includes('miljoer')) { - return 'miljoe_error' - } else if (stackTrace?.includes('current')) { - return 'azure_error' - } else if (stackTrace?.includes('person_org')) { - return 'person_org_error' - } else { - return 'unknown_error' - } - } - - window.location.href = runningLocalOrIdporten - ? '/logout' + (feilmelding ? '?state=' + extractFeilmelding(feilmelding) : '') - : '/oauth2/logout' + window.location.href = runningLocalOrIdporten ? '/logout' : '/oauth2/logout' console.error(feilmelding) } export default logoutBruker diff --git a/apps/dolly-frontend/src/main/js/src/flowers.scss b/apps/dolly-frontend/src/main/js/src/flowers.scss index c91744926e8..05cd9d35558 100644 --- a/apps/dolly-frontend/src/main/js/src/flowers.scss +++ b/apps/dolly-frontend/src/main/js/src/flowers.scss @@ -1,51 +1,52 @@ +@use 'sass:math'; + .flower { - width: 3vw; - height: 1vw; - background: #FFACD9; - border-radius: 50%; - position: absolute; - top: -5vh; + width: 3vw; + height: 1vw; + background: #ffacd9; + border-radius: 50%; + position: absolute; + top: -5vh; } .flower::before { - content: ""; - display: block; - width: inherit; - height: inherit; - background: #FFACD9; - border-radius: 50%; - transform: rotate(60deg); - position: absolute; + content: ''; + display: block; + width: inherit; + height: inherit; + background: #ffacd9; + border-radius: 50%; + transform: rotate(60deg); + position: absolute; } .flower::after { - content: ""; - display: block; - width: inherit; - height: inherit; - background: #FFACD9; - border-radius: 50%; - transform: rotate(-60deg); + content: ''; + display: block; + width: inherit; + height: inherit; + background: #ffacd9; + border-radius: 50%; + transform: rotate(-60deg); } - @keyframes flowerfall { - 0% { - transform: translate3d(var(--left-ini), 5vh, 0); - } - 100% { - transform: translate3d(var(--left-end), 100vh, 0); - } + 0% { + transform: translate3d(var(--left-ini), 5vh, 0); + } + 100% { + transform: translate3d(var(--left-end), 100vh, 0); + } } @for $i from 1 through 30 { - .flower:nth-child(#{$i}) { - width: #{random(2)}vw; - height: #{random(2) * 0.33}vw; - --left-ini: #{random(20) - 10}vw; - --left-end: #{random(20) - 10}vw; - left: #{random(93)}vw; - animation: flowerfall #{5 + random(10)}s linear infinite; - animation-delay: -#{random(10)}s; - } + .flower:nth-child(#{$i}) { + width: #{math.random(2)}vw; + height: #{math.random(2) * 0.33}vw; + --left-ini: #{math.random(20) - 10}vw; + --left-end: #{math.random(20) - 10}vw; + left: #{math.random(93)}vw; + animation: flowerfall #{5 + math.random(10)}s linear infinite; + animation-delay: -#{math.random(10)}s; + } } diff --git a/apps/dolly-frontend/src/main/js/src/pages/brukerPage/BrukerModel.tsx b/apps/dolly-frontend/src/main/js/src/pages/brukerPage/BrukerModel.tsx index ac8ef7b62b0..73c7b74d34d 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/brukerPage/BrukerModel.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/brukerPage/BrukerModel.tsx @@ -6,8 +6,8 @@ import { Bruker, Organisasjon, OrgResponse } from '@/pages/brukerPage/types' import { BrukerApi, PersonOrgTilgangApi, SessionApi } from '@/service/Api' import { NotFoundError } from '@/error' import { Navigate } from 'react-router-dom' -import { navigateToLogin } from '@/components/utlogging/navigateToLogin' import { Logger } from '@/logger/Logger' +import logoutBruker from '@/components/utlogging/logoutBruker' const ORG_ERROR = 'organisation_error' const UNKNOWN_ERROR = 'unknown_error' @@ -28,7 +28,7 @@ export default () => { message: 'Ukjent feil ved henting av organisasjoner for bankid bruker', uuid: window.uuid, }) - navigateToLogin(UNKNOWN_ERROR) + logoutBruker(UNKNOWN_ERROR) } setOrganisasjoner(response.data) setModalHeight(310 + 55 * response.data.length) @@ -40,7 +40,7 @@ export default () => { message: 'Fant ingen organisasjoner for bankid bruker', uuid: window.uuid, }) - navigateToLogin(ORG_ERROR) + logoutBruker(ORG_ERROR) }) .catch((e: Error) => { Logger.error({ @@ -48,7 +48,7 @@ export default () => { message: e.message, uuid: window.uuid, }) - navigateToLogin(UNKNOWN_ERROR) + logoutBruker(UNKNOWN_ERROR) }) }, []) @@ -66,7 +66,7 @@ export default () => { message: 'Ukjent feil ved henting av bankid bruker fra bruker-service', uuid: window.uuid, }) - navigateToLogin(UNKNOWN_ERROR) + logoutBruker(UNKNOWN_ERROR) } }) .catch((_e: NotFoundError) => { @@ -78,7 +78,7 @@ export default () => { message: e.message, uuid: window.uuid, }) - navigateToLogin(UNKNOWN_ERROR) + logoutBruker(UNKNOWN_ERROR) }) } diff --git a/apps/dolly-frontend/src/main/js/src/pages/dollySoek/SoekForm.tsx b/apps/dolly-frontend/src/main/js/src/pages/dollySoek/SoekForm.tsx index 35b04fccd3d..46ad101518e 100644 --- a/apps/dolly-frontend/src/main/js/src/pages/dollySoek/SoekForm.tsx +++ b/apps/dolly-frontend/src/main/js/src/pages/dollySoek/SoekForm.tsx @@ -191,13 +191,6 @@ export const SoekForm = () => { handleChange(val.target.checked, `${personPath}.harVerge`) } /> - - handleChange(val.target.checked, `${personPath}.harFullmakt`) - } - /> { - const { loggData, loading, error } = useLevendeArbeidsforholdLogg(0, 1000, 'id,DESC') + const { loggData, loading, error } = useLevendeArbeidsforholdLogg(0, 1000, 'id') const [identSoekData, setIdentSoekData] = useState(null) const [orgnummerSoekData, setOrgnummerSoekData] = useState(null) diff --git a/apps/dolly-frontend/src/main/js/src/rain.scss b/apps/dolly-frontend/src/main/js/src/rain.scss index c88fdd8c20d..7e82778123d 100644 --- a/apps/dolly-frontend/src/main/js/src/rain.scss +++ b/apps/dolly-frontend/src/main/js/src/rain.scss @@ -1,3 +1,4 @@ +@use "sass:math"; //Hentet fra https://codepen.io/alvaromontoro/pen/GRNmdzB .rain { @@ -19,11 +20,11 @@ @for $i from 1 through 500 { .rain:nth-child(#{$i}) { - --width: #{2 + random(2)}px; - --height: #{6 + random(3)}px; + --width: #{2 + math.random(2)}px; + --height: #{6 + math.random(3)}px; top: -2vh; - left: #{random(96)}vw; - animation: rainfall #{random(50)*0.03 + random(40) * 0.03}s linear infinite; - animation-delay: #{random(40)*0.01 + random(60)*0.07}s; + left: #{math.random(96)}vw; + animation: rainfall #{math.random(50)*0.03 + math.random(40) * 0.03}s linear infinite; + animation-delay: #{math.random(40)*0.01 + math.random(60)*0.07}s; } } \ No newline at end of file diff --git a/apps/dolly-frontend/src/main/js/src/service/SelectOptions.tsx b/apps/dolly-frontend/src/main/js/src/service/SelectOptions.tsx index be1823071dd..677526868d5 100644 --- a/apps/dolly-frontend/src/main/js/src/service/SelectOptions.tsx +++ b/apps/dolly-frontend/src/main/js/src/service/SelectOptions.tsx @@ -603,6 +603,13 @@ const selectOptions = { { value: 'ETTER_AVTALE', label: 'Kan begynne etter nærmere avtale' }, ], + fullmaktHandling: [ + { value: '*', label: 'Alle' }, + { value: 'LES', label: 'Les' }, + { value: 'KOMMUNISER', label: 'Kommuniser' }, + { value: 'SKRIV', label: 'Skriv' }, + ], + arbeidsmengde: [ { value: 'HELTID', label: 'Heltid' }, { value: 'DELTID', label: 'Deltid' }, 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 aefe3757adb..3c7e6a26500 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 @@ -1,10 +1,17 @@ import Request from '@/service/services/Request' +import { subDays } from 'date-fns' const skjermingUrl = '/testnav-skjermingsregister-proxy/api/v1/skjerming/dolly' export default { - deleteSkjerming(ident: string) { - return Request.put(skjermingUrl, { personident: ident, skjermetTil: new Date() }) + deleteSkjerming(ident: string, fornavn: string, etternavn: string) { + return Request.put(skjermingUrl, { + personident: ident, + fornavn: fornavn, + etternavn: etternavn, + skjermetFra: subDays(new Date(), 1), + skjermetTil: new Date(), + }) }, getSkjerming(ident: string) { diff --git a/apps/dolly-frontend/src/main/js/src/snow.scss b/apps/dolly-frontend/src/main/js/src/snow.scss index a5a08e28d13..a3aabb85237 100644 --- a/apps/dolly-frontend/src/main/js/src/snow.scss +++ b/apps/dolly-frontend/src/main/js/src/snow.scss @@ -1,3 +1,4 @@ +@use "sass:math"; //Hentet fra https://codepen.io/alvaromontoro/pen/GRNmdzB .snowflake { @@ -21,12 +22,12 @@ @for $i from 1 through 80 { .snowflake:nth-child(#{$i}) { - --size: #{(random(2) + 0.04) * 0.2}vw; - --left-ini: #{random(20) - 10}vw; - --left-end: #{random(20) - 10}vw; - left: #{random(89)}vw; - animation: snowfall #{5 + random(10)}s linear infinite; - animation-delay: -#{random(10)}s; + --size: #{(math.random(2) + 0.04) * 0.2}vw; + --left-ini: #{math.random(20) - 10}vw; + --left-end: #{math.random(20) - 10}vw; + left: #{math.random(89)}vw; + animation: snowfall #{5 + math.random(10)}s linear infinite; + animation-delay: -#{math.random(10)}s; } } diff --git a/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx b/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx index 9947f25f61c..33b84fa06d5 100644 --- a/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx +++ b/apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx @@ -131,7 +131,7 @@ export const omraaderArrayToString = (array) => { return null } - return arrayToString(array).replace('*', '* (Alle)') + return arrayToString(array.map((item) => item.tema)).replace('*', '* (Alle)') } export const uppercaseAndUnderscoreToCapitalized = (value) => { @@ -151,6 +151,9 @@ export const allCapsToCapitalized = (value) => { } export const toTitleCase = (value) => { + if (!value) { + return '' + } return value .split(' ') .map(_.capitalize) diff --git a/apps/dolly-frontend/src/main/js/src/utils/hooks/useFullmakt.tsx b/apps/dolly-frontend/src/main/js/src/utils/hooks/useFullmakt.tsx new file mode 100644 index 00000000000..6430642ca19 --- /dev/null +++ b/apps/dolly-frontend/src/main/js/src/utils/hooks/useFullmakt.tsx @@ -0,0 +1,73 @@ +import useSWR from 'swr' +import { fetcher } from '@/api' +import { Option } from '@/service/SelectOptionsOppslag' + +type NodeType = { + kode: string + hjelpetekst?: { nb: string } | null + termer: any + undernoder?: Record | null +} + +type FullmaktKodeverkType = { + noder: Record +} + +export const useFullmektig = (ident: string) => { + const { data, isLoading, error } = useSWR( + [ + ident && '/testnav-fullmakt-proxy/api/fullmaktsgiver', + { accept: 'application/json', 'Content-Type': 'application/json', fnr: ident }, + ], + ([url, headers]) => fetcher(url, headers), + ) + + return { + fullmektig: data, + loading: isLoading, + error: error, + } +} + +export const useFullmaktOmraader = () => { + const { data, isLoading, error } = useSWR( + [ + '/testnav-fullmakt-proxy/api/omraade', + { accept: 'application/json', 'Content-Type': 'application/json', fnr: '12808012345' }, + ], + ([url, headers]) => fetcher(url, headers), + ) + + const omraadeKodeverk = data?.noder + + return { + omraadeKodeverk: mapOmraadeKodeverkToOptions(omraadeKodeverk), + loading: isLoading, + error: error, + } +} +const mapOmraadeKodeverkToOptions = ( + omraadeKodeverk: Record | undefined, +): Option[] => { + if (!omraadeKodeverk) { + return [] + } + const options: Option[] = [] + + const traverseNodes = (nodes: Record) => { + for (const key in nodes) { + const node = nodes[key] + if (node.undernoder) { + traverseNodes(node.undernoder) + } else { + options.push({ + value: node.kode, + label: `${node.termer.nb} - ${node.kode}`, + }) + } + } + } + + traverseNodes(omraadeKodeverk) + return options +} diff --git a/apps/dolly-frontend/src/main/js/vite.config.js b/apps/dolly-frontend/src/main/js/vite.config.js index 8ac6bceb9be..7cf62651bfb 100644 --- a/apps/dolly-frontend/src/main/js/vite.config.js +++ b/apps/dolly-frontend/src/main/js/vite.config.js @@ -51,6 +51,13 @@ export default defineConfig(({ mode }) => ({ external: ['./nais.js'], }, }, + css: { + preprocessorOptions: { + scss: { + api: 'modern-compiler', + }, + }, + }, optimizeDeps: { exclude: ['node_modules/.cache'] }, resolve: { alias: { diff --git a/apps/dolly-frontend/src/main/resources/application.yml b/apps/dolly-frontend/src/main/resources/application.yml index 842a8da0a4c..50bc1e8ca28 100644 --- a/apps/dolly-frontend/src/main/resources/application.yml +++ b/apps/dolly-frontend/src/main/resources/application.yml @@ -88,6 +88,11 @@ consumers: namespace: dolly name: testnav-krrstub-proxy url: https://testnav-krrstub-proxy.dev-fss-pub.nais.io + testnav-fullmakt-proxy: + cluster: dev-fss + namespace: dolly + name: testnav-fullmakt-proxy + url: https://testnav-fullmakt-proxy.dev-fss-pub.nais.io testnav-sigrunstub-proxy: cluster: dev-fss namespace: dolly @@ -237,7 +242,7 @@ consumers: cluster: dev-gcp namespace: dolly name: testnav-yrkesskade-proxy - url: https://testnav-yrkesskade-proxy.dolly.svc.cluster.local + url: http://testnav-yrkesskade-proxy.dolly.svc.cluster.local management: endpoints: @@ -260,6 +265,7 @@ server: charset: UTF-8 error: include-message: always + max-http-request-header-size: 128KB logging: pattern: diff --git a/apps/organisasjon-tilgang-service/src/main/java/no/nav/testnav/apps/organisasjontilgangservice/ConfiguratedEnvironmentLogger.java b/apps/organisasjon-tilgang-service/src/main/java/no/nav/testnav/apps/organisasjontilgangservice/ConfiguratedEnvironmentLogger.java deleted file mode 100644 index 0cf28be06f5..00000000000 --- a/apps/organisasjon-tilgang-service/src/main/java/no/nav/testnav/apps/organisasjontilgangservice/ConfiguratedEnvironmentLogger.java +++ /dev/null @@ -1,31 +0,0 @@ -package no.nav.testnav.apps.organisasjontilgangservice; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.context.event.EventListener; -import org.springframework.core.env.AbstractEnvironment; -import org.springframework.core.env.EnumerablePropertySource; -import org.springframework.stereotype.Component; - -import java.util.Arrays; -import java.util.stream.StreamSupport; - -@Component -@Slf4j -public class ConfiguratedEnvironmentLogger { - - @EventListener - public void handleContextRefreshedEvent(ContextRefreshedEvent event) { - var env = (AbstractEnvironment) event.getApplicationContext().getEnvironment(); - var propertySources = env.getPropertySources(); - StreamSupport.stream(propertySources.spliterator(), false) - .filter(EnumerablePropertySource.class::isInstance) - .map(ps -> ((EnumerablePropertySource) ps).getPropertyNames()) - .flatMap(Arrays::stream) - .distinct() - .sorted() - .forEach(prop -> log.info("{}", prop)); - - } - -} \ No newline at end of file diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/controller/PersonController.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/controller/PersonController.java index a0e39ab45ba..0174785101a 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/controller/PersonController.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/controller/PersonController.java @@ -24,7 +24,6 @@ import no.nav.testnav.libs.data.pdlforvalter.v1.ForelderBarnRelasjonDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.ForeldreansvarDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.FullPersonDTO; -import no.nav.testnav.libs.data.pdlforvalter.v1.FullmaktDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.InnflyttingDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.KjoennDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.KontaktadresseDTO; @@ -160,9 +159,9 @@ public void deleteFoedsel(@Parameter(description = "Ident for testperson") @DeleteMapping(value = "/{ident}/foedested/{id}") @Operation(description = "Slett angitt foedested for person") public void deleteFoedested(@Parameter(description = "Ident for testperson") - @PathVariable String ident, - @Parameter(description = "id som identifiserer foedested") - @PathVariable Integer id) { + @PathVariable String ident, + @Parameter(description = "id som identifiserer foedested") + @PathVariable Integer id) { artifactDeleteService.deleteFoedested(ident, id); } @@ -170,9 +169,9 @@ public void deleteFoedested(@Parameter(description = "Ident for testperson") @DeleteMapping(value = "/{ident}/foedselsdato/{id}") @Operation(description = "Slett angitt foedselsdato for person") public void deleteFoedselsdato(@Parameter(description = "Ident for testperson") - @PathVariable String ident, - @Parameter(description = "id som identifiserer foedselsdato") - @PathVariable Integer id) { + @PathVariable String ident, + @Parameter(description = "id som identifiserer foedselsdato") + @PathVariable Integer id) { artifactDeleteService.deleteFoedselsdato(ident, id); } @@ -650,27 +649,6 @@ public void updateTelefonnumre(@Parameter(description = "Ident for testperson") artifactUpdateService.updateTelefonnummer(ident, telefonnumre); } - @DeleteMapping(value = "/{ident}/fullmakt/{id}") - @Operation(description = "Slett angitt fullmakt for person") - public void deleteFullmakt(@Parameter(description = "Ident for testperson") - @PathVariable String ident, - @Parameter(description = "id som identifiserer fullmakt") - @PathVariable Integer id) { - - artifactDeleteService.deleteFullmakt(ident, id); - } - - @PutMapping(value = "/{ident}/fullmakt/{id}") - @Operation(description = "Oppdater angitt fullmakt for person") - public void updateFullmakt(@Parameter(description = "Ident for testperson") - @PathVariable String ident, - @Parameter(description = "id som identifiserer fullmakt") - @PathVariable Integer id, - @RequestBody FullmaktDTO fullmakt) { - - artifactUpdateService.updateFullmakt(ident, id, fullmakt); - } - @DeleteMapping(value = "/{ident}/vergemaal/{id}") @Operation(description = "Slett angitt vergemaal for person") public void deleteVergemaal(@Parameter(description = "Ident for testperson") diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ArtifactDeleteService.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ArtifactDeleteService.java index 2040b57a2ce..8baf87cb39f 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ArtifactDeleteService.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ArtifactDeleteService.java @@ -26,7 +26,6 @@ import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FOLKEREGISTER_PERSONSTATUS; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FORELDREANSVAR; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FORELDRE_BARN_RELASJON; -import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FULLMAKT; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_INNFLYTTING; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_KJOENN; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_KONTAKTADRESSE; @@ -439,28 +438,6 @@ public void deleteTelefonnummer(String ident, Integer id) { .toList()); } - public void deleteFullmakt(String ident, Integer id) { - - var hovedPerson = getPerson(ident); - - checkExists(hovedPerson.getPerson().getFullmakt(), id, PDL_FULLMAKT.getDescription()); - hendelseIdService.deletePdlHendelse(ident, PDL_FULLMAKT.getDescription(), id); - - hovedPerson.getPerson().getFullmakt().stream() - .filter(type -> id.equals(type.getId())) - .forEach(fullmakt -> { - var slettePerson = getPerson(fullmakt.getMotpartsPersonident()); - - DeleteRelasjonerUtility.deleteRelasjoner(slettePerson, RelasjonType.FULLMEKTIG); - - deletePerson(slettePerson, fullmakt.isEksisterendePerson()); - }); - - hovedPerson.getPerson().setFullmakt(hovedPerson.getPerson().getFullmakt().stream() - .filter(type -> !id.equals(type.getId())) - .toList()); - } - public void deleteVergemaal(String ident, Integer id) { var hovedPerson = getPerson(ident); diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ArtifactUpdateService.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ArtifactUpdateService.java index 12655496b07..0df11a725ed 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ArtifactUpdateService.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ArtifactUpdateService.java @@ -19,7 +19,6 @@ import no.nav.testnav.libs.data.pdlforvalter.v1.ForelderBarnRelasjonDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.ForeldreansvarDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.ForeldreansvarDTO.Ansvar; -import no.nav.testnav.libs.data.pdlforvalter.v1.FullmaktDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.InnflyttingDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.KjoennDTO; import no.nav.testnav.libs.data.pdlforvalter.v1.KontaktadresseDTO; @@ -48,7 +47,6 @@ import static no.nav.testnav.libs.data.pdlforvalter.v1.RelasjonType.FALSK_IDENTITET; import static no.nav.testnav.libs.data.pdlforvalter.v1.RelasjonType.FAMILIERELASJON_BARN; import static no.nav.testnav.libs.data.pdlforvalter.v1.RelasjonType.FORELDREANSVAR_FORELDER; -import static no.nav.testnav.libs.data.pdlforvalter.v1.RelasjonType.FULLMEKTIG; import static no.nav.testnav.libs.data.pdlforvalter.v1.RelasjonType.KONTAKT_FOR_DOEDSBO; import static no.nav.testnav.libs.data.pdlforvalter.v1.RelasjonType.VERGE; import static org.apache.commons.lang3.StringUtils.isNotBlank; @@ -73,7 +71,6 @@ public class ArtifactUpdateService { private final FolkeregisterPersonstatusService folkeregisterPersonstatusService; private final ForelderBarnRelasjonService forelderBarnRelasjonService; private final ForeldreansvarService foreldreansvarService; - private final FullmaktService fullmaktService; private final InnflyttingService innflyttingService; private final KjoennService kjoennService; private final KontaktAdresseService kontaktAdresseService; @@ -520,42 +517,6 @@ public void updateTelefonnummer(String ident, List oppdaterteT telefonnummerService.convert(person.getPerson().getTelefonnummer()); } - public void updateFullmakt(String ident, Integer id, FullmaktDTO oppdatertFullmakt) { - - var person = getPerson(ident); - fullmaktService.validate(oppdatertFullmakt, person.getPerson()); - - var fullmaktRelasjon = person.getPerson().getFullmakt().stream() - .filter(fullmakt -> fullmakt.getId().equals(id)) - .findFirst(); - - fullmaktRelasjon.ifPresent(fullmakt -> { - - var endretRelasjon = isNotBlank(fullmakt.getMotpartsPersonident()) && - !fullmakt.getMotpartsPersonident().equals(oppdatertFullmakt.getMotpartsPersonident()); - - if (endretRelasjon) { - - var slettePerson = getPerson(fullmakt.getMotpartsPersonident()); - - DeleteRelasjonerUtility.deleteRelasjoner(slettePerson, FULLMEKTIG); - deletePerson(slettePerson, fullmakt.isEksisterendePerson()); - - oppdatertFullmakt.setId(id); - person.getPerson().getFullmakt().add(oppdatertFullmakt); - person.getPerson().getFullmakt().sort(Comparator.comparing(FullmaktDTO::getId).reversed()); - } - }); - - person.getPerson().setFullmakt( - updateArtifact(person.getPerson().getFullmakt(), oppdatertFullmakt, id, "Fullmakt")); - - if (id == 0 || fullmaktRelasjon.isPresent()) { - - fullmaktService.convert(person.getPerson()); - } - } - public void updateVergemaal(String ident, Integer id, VergemaalDTO oppdatertVergemaal) { vergemaalService.validate(oppdatertVergemaal); diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/CreatePersonService.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/CreatePersonService.java index 124a03e4b92..612eff4b2b7 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/CreatePersonService.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/CreatePersonService.java @@ -39,6 +39,7 @@ public class CreatePersonService { private final NavnService navnService; private final AdressebeskyttelseService adressebeskyttelseService; private final NavPersonIdentifikatorService navsPersonIdentifikatorService; + private final FolkeregisterPersonstatusService folkeregisterPersonstatusService; private static PersonDTO buildPerson(PersonRequestDTO request) { @@ -96,7 +97,8 @@ public PersonDTO execute(PersonRequestDTO request) { Flux.just(kjoennService.convert(mergedPerson)), Flux.just(statsborgerskapService.convert(mergedPerson)), Flux.just(adressebeskyttelseService.convert(mergedPerson)), - Flux.just(navsPersonIdentifikatorService.convert(mergedPerson)) + Flux.just(navsPersonIdentifikatorService.convert(mergedPerson)), + Flux.just(folkeregisterPersonstatusService.convert(mergedPerson)) ) .reduce(Flux.empty(), Flux::merge) .collectList() diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/FullmaktService.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/FullmaktService.java index 51b497eca54..14e1c610a30 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/FullmaktService.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/FullmaktService.java @@ -3,7 +3,6 @@ import lombok.RequiredArgsConstructor; import no.nav.pdl.forvalter.database.model.DbPerson; import no.nav.pdl.forvalter.database.repository.PersonRepository; -import no.nav.pdl.forvalter.exception.InvalidRequestException; import no.nav.pdl.forvalter.utils.SyntetiskFraIdentUtility; import no.nav.testnav.libs.data.pdlforvalter.v1.DbVersjonDTO.Master; import no.nav.testnav.libs.data.pdlforvalter.v1.FullmaktDTO; @@ -16,11 +15,9 @@ import java.util.List; import java.util.concurrent.atomic.AtomicReference; -import static java.lang.String.format; import static java.util.Objects.isNull; import static no.nav.pdl.forvalter.utils.ArtifactUtils.getKilde; import static no.nav.pdl.forvalter.utils.ArtifactUtils.getMaster; -import static no.nav.pdl.forvalter.utils.TestnorgeIdentUtility.isTestnorgeIdent; import static org.apache.commons.lang3.BooleanUtils.isTrue; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; @@ -29,12 +26,6 @@ @RequiredArgsConstructor public class FullmaktService implements BiValidation { - private static final String VALIDATION_GYLDIG_FOM_ERROR = "Fullmakt med gyldigFom må angis"; - private static final String VALIDATION_GYLDIG_TOM_ERROR = "Fullmakt med gyldigTom må angis"; - private static final String VALIDATION_UGYLDIG_INTERVAL_ERROR = "Ugyldig datointervall: gyldigFom må være før gyldigTom"; - private static final String VALIDATION_OMRAADER_ERROR = "Områder for fullmakt må angis"; - private static final String VALIDATION_FULLMEKTIG_ERROR = "Fullmektig: person %s ikke funnet i database"; - private final PersonRepository personRepository; private final CreatePersonService createPersonService; private final RelasjonService relasjonService; @@ -56,24 +47,6 @@ public List convert(PersonDTO person) { @Override public void validate(FullmaktDTO fullmakt, PersonDTO person) { - if (isNull(fullmakt.getOmraader())) { - throw new InvalidRequestException(VALIDATION_OMRAADER_ERROR); - } - - if (isNull(fullmakt.getGyldigFraOgMed())) { - throw new InvalidRequestException(VALIDATION_GYLDIG_FOM_ERROR); - - } else if (isNull(fullmakt.getGyldigTilOgMed())) { - throw new InvalidRequestException(VALIDATION_GYLDIG_TOM_ERROR); - - } else if (!fullmakt.getGyldigFraOgMed().isBefore(fullmakt.getGyldigTilOgMed())) { - throw new InvalidRequestException(VALIDATION_UGYLDIG_INTERVAL_ERROR); - } - - if (!isTestnorgeIdent(person.getIdent()) && isNotBlank(fullmakt.getMotpartsPersonident()) && - !personRepository.existsByIdent(fullmakt.getMotpartsPersonident())) { - throw new InvalidRequestException(format(VALIDATION_FULLMEKTIG_ERROR, fullmakt.getMotpartsPersonident())); - } } private void handle(FullmaktDTO fullmakt, String ident) { @@ -106,11 +79,11 @@ private void handle(FullmaktDTO fullmakt, String ident) { personRepository.findByIdent(fullmakt.getMotpartsPersonident()) .ifPresentOrElse(motpartPerson::set, () -> motpartPerson.set(personRepository.save(DbPerson.builder() + .ident(fullmakt.getMotpartsPersonident()) + .person(PersonDTO.builder() .ident(fullmakt.getMotpartsPersonident()) - .person(PersonDTO.builder() - .ident(fullmakt.getMotpartsPersonident()) - .build()) - .sistOppdatert(LocalDateTime.now()) + .build()) + .sistOppdatert(LocalDateTime.now()) .build()))); } diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/PdlOrdreService.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/PdlOrdreService.java index 0bc873f7c99..58bea0d8aa4 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/PdlOrdreService.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/PdlOrdreService.java @@ -66,7 +66,6 @@ import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FOLKEREGISTER_PERSONSTATUS; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FORELDREANSVAR; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FORELDRE_BARN_RELASJON; -import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FULLMAKT; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_INNFLYTTING; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_KJOENN; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_KONTAKTADRESSE; @@ -103,56 +102,6 @@ public class PdlOrdreService { private final MapperFacade mapperFacade; private final HendelseIdService hendelseIdService; - private Set getEksternePersoner(DbPerson dbPerson) { - - return Stream.of( - dbPerson.getPerson().getSivilstand().stream() - .filter(SivilstandDTO::isEksisterendePerson) - .map(SivilstandDTO::getRelatertVedSivilstand), - dbPerson.getPerson().getForelderBarnRelasjon().stream() - .filter(ForelderBarnRelasjonDTO::isEksisterendePerson) - .map(ForelderBarnRelasjonDTO::getRelatertPerson), - dbPerson.getPerson().getForeldreansvar().stream() - .filter(ForeldreansvarDTO::isEksisterendePerson) - .map(ForeldreansvarDTO::getAnsvarlig), - dbPerson.getPerson().getVergemaal().stream() - .filter(VergemaalDTO::isEksisterendePerson) - .map(VergemaalDTO::getVergeIdent), - dbPerson.getPerson().getFullmakt().stream() - .filter(FullmaktDTO::isEksisterendePerson) - .map(FullmaktDTO::getMotpartsPersonident), - dbPerson.getPerson().getKontaktinformasjonForDoedsbo().stream() - .map(KontaktinformasjonForDoedsboDTO::getPersonSomKontakt) - .filter(Objects::nonNull) - .filter(KontaktinformasjonForDoedsboDTO.KontaktpersonDTO::isEksisterendePerson) - .map(KontaktinformasjonForDoedsboDTO.KontaktpersonDTO::getIdentifikasjonsnummer), - dbPerson.getPerson().getForelderBarnRelasjon().stream() - .filter(ForelderBarnRelasjonDTO::hasBarn) - .map(ForelderBarnRelasjonDTO::getRelatertPerson) - .map(personRepository::findByIdent) - .flatMap(Optional::stream) - .map(DbPerson::getPerson) - .map(PersonDTO::getForeldreansvar) - .flatMap(Collection::stream) - .filter(ForeldreansvarDTO::isEksisterendePerson) - .map(ForeldreansvarDTO::getAnsvarlig)) - .flatMap(Function.identity()) - .collect(Collectors.toSet()); - } - - private static List getPersonHendelser(String ident, List hendelser) { - - return nonNull(hendelser) ? - hendelser.stream() - .filter(hendelse -> ident.equals(hendelse.getIdent())) - .map(hendelse -> OrdreResponseDTO.PdlStatusDTO.builder() - .infoElement(hendelse.getInfoElement()) - .hendelser(hendelse.getHendelser()) - .build()) - .toList() : - emptyList(); - } - public OrdreResponseDTO send(String ident, Boolean ekskluderEksterenePersoner) { var timestamp = System.currentTimeMillis(); @@ -226,6 +175,43 @@ public OrdreResponseDTO send(String ident, Boolean ekskluderEksterenePersoner) { return response; } + private Set getEksternePersoner(DbPerson dbPerson) { + + return Stream.of( + dbPerson.getPerson().getSivilstand().stream() + .filter(SivilstandDTO::isEksisterendePerson) + .map(SivilstandDTO::getRelatertVedSivilstand), + dbPerson.getPerson().getForelderBarnRelasjon().stream() + .filter(ForelderBarnRelasjonDTO::isEksisterendePerson) + .map(ForelderBarnRelasjonDTO::getRelatertPerson), + dbPerson.getPerson().getForeldreansvar().stream() + .filter(ForeldreansvarDTO::isEksisterendePerson) + .map(ForeldreansvarDTO::getAnsvarlig), + dbPerson.getPerson().getVergemaal().stream() + .filter(VergemaalDTO::isEksisterendePerson) + .map(VergemaalDTO::getVergeIdent), + dbPerson.getPerson().getFullmakt().stream() + .filter(FullmaktDTO::isEksisterendePerson) + .map(FullmaktDTO::getMotpartsPersonident), + dbPerson.getPerson().getKontaktinformasjonForDoedsbo().stream() + .map(KontaktinformasjonForDoedsboDTO::getPersonSomKontakt) + .filter(Objects::nonNull) + .filter(KontaktinformasjonForDoedsboDTO.KontaktpersonDTO::isEksisterendePerson) + .map(KontaktinformasjonForDoedsboDTO.KontaktpersonDTO::getIdentifikasjonsnummer), + dbPerson.getPerson().getForelderBarnRelasjon().stream() + .filter(ForelderBarnRelasjonDTO::hasBarn) + .map(ForelderBarnRelasjonDTO::getRelatertPerson) + .map(personRepository::findByIdent) + .flatMap(Optional::stream) + .map(DbPerson::getPerson) + .map(PersonDTO::getForeldreansvar) + .flatMap(Collection::stream) + .filter(ForeldreansvarDTO::isEksisterendePerson) + .map(ForeldreansvarDTO::getAnsvarlig)) + .flatMap(Function.identity()) + .collect(Collectors.toSet()); + } + private void checkAlias(String ident) { var alias = aliasRepository.findByTidligereIdent(ident); @@ -317,17 +303,6 @@ private List npidMerge(OpprettRequest oppretting) { } } - private static void checkAndUpdate(Stack stack, String oppretting) { - - if (!stack.isEmpty()) { - var eksisterende = stack.pop(); - if (isBlank(eksisterende.getIdent())) { - eksisterende.setIdent(oppretting); - } - stack.push(eksisterende); - } - } - private List getOrdrer(OpprettRequest oppretting) { return Stream.of( deployService.createOrdre(PDL_FOLKEREGISTER_PERSONSTATUS, oppretting.getPerson().getIdent(), mapperFacade.mapAsList(oppretting.getPerson().getPerson().getFolkeregisterPersonstatus(), FolkeregisterPersonstatus.class)), @@ -354,7 +329,6 @@ private List getOrdrer(OpprettRequest oppretting) { .filter(SivilstandDTO::isNotSamboer) .toList()), deployService.createOrdre(PDL_VERGEMAAL, oppretting.getPerson().getIdent(), mapperFacade.mapAsList(oppretting.getPerson().getPerson().getVergemaal(), PdlVergemaal.class)), - deployService.createOrdre(PDL_FULLMAKT, oppretting.getPerson().getIdent(), oppretting.getPerson().getPerson().getFullmakt()), deployService.createOrdre(PDL_TELEFONUMMER, oppretting.getPerson().getIdent(), oppretting.getPerson().getPerson().getTelefonnummer()), deployService.createOrdre(PDL_OPPHOLD, oppretting.getPerson().getIdent(), oppretting.getPerson().getPerson().getOpphold()), deployService.createOrdre(PDL_KONTAKTINFORMASJON_FOR_DODESDBO, oppretting.getPerson().getIdent(), oppretting.getPerson().getPerson().getKontaktinformasjonForDoedsbo()), @@ -399,4 +373,28 @@ private List getFoedselsdato(PersonDTO person) { person.getFoedselsdato() : mapperFacade.mapAsList(person.getFoedsel(), FoedselDTO.class); } + + private static List getPersonHendelser(String ident, List hendelser) { + + return nonNull(hendelser) ? + hendelser.stream() + .filter(hendelse -> ident.equals(hendelse.getIdent())) + .map(hendelse -> OrdreResponseDTO.PdlStatusDTO.builder() + .infoElement(hendelse.getInfoElement()) + .hendelser(hendelse.getHendelser()) + .build()) + .toList() : + emptyList(); + } + + private static void checkAndUpdate(Stack stack, String oppretting) { + + if (!stack.isEmpty()) { + var eksisterende = stack.pop(); + if (isBlank(eksisterende.getIdent())) { + eksisterende.setIdent(oppretting); + } + stack.push(eksisterende); + } + } } \ No newline at end of file diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ValidateArtifactsService.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ValidateArtifactsService.java index 1034824e252..cd250989e18 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ValidateArtifactsService.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/ValidateArtifactsService.java @@ -25,7 +25,6 @@ public class ValidateArtifactsService { private final FolkeregisterPersonstatusService folkeregisterPersonstatusService; private final ForelderBarnRelasjonService forelderBarnRelasjonService; private final ForeldreansvarService foreldreansvarService; - private final FullmaktService fullmaktService; private final KjoennService kjoennService; private final KontaktAdresseService kontaktAdresseService; private final KontaktinformasjonForDoedsboService kontaktinformasjonForDoedsboService; @@ -61,7 +60,6 @@ public void validate(PersonDTO person) { validate(tilrettelagtKommunikasjonService, person.getTilrettelagtKommunikasjon()), validate(doedsfallService, person.getDoedsfall()), validate(folkeregisterPersonstatusService, person.getFolkeregisterPersonstatus(), person), - validate(fullmaktService, person.getFullmakt(), person), validate(kontaktAdresseService, person.getKontaktadresse(), person), validate(utenlandsidentifikasjonsnummerService, person.getUtenlandskIdentifikasjonsnummer()), validate(vergemaalService, person.getVergemaal()), diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/VergemaalService.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/VergemaalService.java index 4a50474a916..e57a538a89a 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/VergemaalService.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/service/VergemaalService.java @@ -70,32 +70,32 @@ public void validate(VergemaalDTO vergemaal) { } } - private void handle(VergemaalDTO fullmakt, String ident) { + private void handle(VergemaalDTO vergemaal, String ident) { - fullmakt.setEksisterendePerson(isNotBlank(fullmakt.getVergeIdent())); + vergemaal.setEksisterendePerson(isNotBlank(vergemaal.getVergeIdent())); - if (isBlank(fullmakt.getVergeIdent())) { + if (isBlank(vergemaal.getVergeIdent())) { - if (isNull(fullmakt.getNyVergeIdent())) { - fullmakt.setNyVergeIdent(new PersonRequestDTO()); + if (isNull(vergemaal.getNyVergeIdent())) { + vergemaal.setNyVergeIdent(new PersonRequestDTO()); } - if (isNull(fullmakt.getNyVergeIdent().getAlder()) && - isNull(fullmakt.getNyVergeIdent().getFoedtEtter()) && - isNull(fullmakt.getNyVergeIdent().getFoedtFoer())) { + if (isNull(vergemaal.getNyVergeIdent().getAlder()) && + isNull(vergemaal.getNyVergeIdent().getFoedtEtter()) && + isNull(vergemaal.getNyVergeIdent().getFoedtFoer())) { - fullmakt.getNyVergeIdent().setFoedtFoer(LocalDateTime.now().minusYears(18)); - fullmakt.getNyVergeIdent().setFoedtEtter(LocalDateTime.now().minusYears(75)); + vergemaal.getNyVergeIdent().setFoedtFoer(LocalDateTime.now().minusYears(18)); + vergemaal.getNyVergeIdent().setFoedtEtter(LocalDateTime.now().minusYears(75)); } - if (isNull(fullmakt.getNyVergeIdent().getSyntetisk())) { - fullmakt.getNyVergeIdent().setSyntetisk(SyntetiskFraIdentUtility.isSyntetisk(ident)); + if (isNull(vergemaal.getNyVergeIdent().getSyntetisk())) { + vergemaal.getNyVergeIdent().setSyntetisk(SyntetiskFraIdentUtility.isSyntetisk(ident)); } - fullmakt.setVergeIdent(createPersonService.execute(fullmakt.getNyVergeIdent()).getIdent()); + vergemaal.setVergeIdent(createPersonService.execute(vergemaal.getNyVergeIdent()).getIdent()); } relasjonService.setRelasjoner(ident, RelasjonType.VERGE_MOTTAKER, - fullmakt.getVergeIdent(), RelasjonType.VERGE); + vergemaal.getVergeIdent(), RelasjonType.VERGE); } } \ No newline at end of file diff --git a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/utils/PdlTestDataUrls.java b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/utils/PdlTestDataUrls.java index 48d60205506..f0a91c9affa 100644 --- a/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/utils/PdlTestDataUrls.java +++ b/apps/pdl-forvalter/src/main/java/no/nav/pdl/forvalter/utils/PdlTestDataUrls.java @@ -17,7 +17,6 @@ import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FOLKEREGISTER_PERSONSTATUS; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FORELDREANSVAR; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FORELDRE_BARN_RELASJON; -import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_FULLMAKT; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_INNFLYTTING; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_KJOENN; import static no.nav.testnav.libs.data.pdlforvalter.v1.PdlArtifact.PDL_KONTAKTADRESSE; @@ -60,7 +59,6 @@ public class PdlTestDataUrls { private static final String PDL_BESTILLING_FOLKEREGISTER_PERSONSTATUS_URL = PDL_BESTILLING_URL + "/folkeregisterpersonstatus"; private static final String PDL_BESTILLING_FORELDREANSVAR_URL = PDL_BESTILLING_URL + "/foreldreansvar"; private static final String PDL_BESTILLING_FORELDRE_BARN_RELASJON_URL = PDL_BESTILLING_URL + "/forelderbarnrelasjon"; - private static final String PDL_BESTILLING_FULLMAKT_URL = PDL_BESTILLING_URL + "/fullmakt"; private static final String PDL_BESTILLING_INNFLYTTING_URL = PDL_BESTILLING_URL + "/innflytting"; private static final String PDL_BESTILLING_KJOENN_URL = PDL_BESTILLING_URL + "/kjoenn"; private static final String PDL_BESTILLING_KONTAKTADRESSE_URL = PDL_BESTILLING_URL + "/kontaktadresse"; @@ -92,7 +90,6 @@ public class PdlTestDataUrls { bestillingUrl.put(PDL_FOLKEREGISTER_PERSONSTATUS, PDL_BESTILLING_FOLKEREGISTER_PERSONSTATUS_URL); bestillingUrl.put(PDL_FORELDREANSVAR, PDL_BESTILLING_FORELDREANSVAR_URL); bestillingUrl.put(PDL_FORELDRE_BARN_RELASJON, PDL_BESTILLING_FORELDRE_BARN_RELASJON_URL); - bestillingUrl.put(PDL_FULLMAKT, PDL_BESTILLING_FULLMAKT_URL); bestillingUrl.put(PDL_INNFLYTTING, PDL_BESTILLING_INNFLYTTING_URL); bestillingUrl.put(PDL_KJOENN, PDL_BESTILLING_KJOENN_URL); bestillingUrl.put(PDL_KONTAKTADRESSE, PDL_BESTILLING_KONTAKTADRESSE_URL); diff --git a/apps/pdl-forvalter/src/test/java/no/nav/pdl/forvalter/service/FullmaktServiceTest.java b/apps/pdl-forvalter/src/test/java/no/nav/pdl/forvalter/service/FullmaktServiceTest.java deleted file mode 100644 index 2de6e965831..00000000000 --- a/apps/pdl-forvalter/src/test/java/no/nav/pdl/forvalter/service/FullmaktServiceTest.java +++ /dev/null @@ -1,119 +0,0 @@ -package no.nav.pdl.forvalter.service; - -import no.nav.pdl.forvalter.database.repository.PersonRepository; -import no.nav.testnav.libs.data.pdlforvalter.v1.FullmaktDTO; -import no.nav.testnav.libs.data.pdlforvalter.v1.PersonDTO; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.web.client.HttpClientErrorException; - -import java.time.LocalDate; -import java.util.List; - -import static java.lang.String.format; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class FullmaktServiceTest { - - private static final String IDENT = "12345678901"; - - @Mock - private PersonRepository personRepository; - - @InjectMocks - private FullmaktService fullmaktService; - - @Test - void whenOmraaderIsMissing_thenThrowExecption() { - - var request = FullmaktDTO.builder() - .isNew(true) - .build(); - - var exception = assertThrows(HttpClientErrorException.class, () -> - fullmaktService.validate(request, PersonDTO.builder() - .ident(IDENT) - .build())); - - assertThat(exception.getMessage(), containsString("Områder for fullmakt må angis")); - } - - @Test - void whenGyldigFomIsMissing_thenThrowExecption() { - - var request = FullmaktDTO.builder() - .omraader(List.of("OMRAADE")) - .isNew(true) - .build(); - - var exception = assertThrows(HttpClientErrorException.class, () -> - fullmaktService.validate(request, PersonDTO.builder() - .ident(IDENT) - .build())); - - assertThat(exception.getMessage(), containsString("Fullmakt med gyldigFom må angis")); - } - - @Test - void whenGyldigTomIsMissing_thenThrowExecption() { - - var request = FullmaktDTO.builder() - .omraader(List.of("OMRAADE")) - .gyldigFraOgMed(LocalDate.of(2012, 4, 5).atStartOfDay()) - .isNew(true) - .build(); - - var exception = assertThrows(HttpClientErrorException.class, () -> - fullmaktService.validate(request, PersonDTO.builder() - .ident(IDENT) - .build())); - - assertThat(exception.getMessage(), containsString("Fullmakt med gyldigTom må angis")); - } - - @Test - void whenUgyldigDatoInterval_thenThrowExecption() { - - var request = FullmaktDTO.builder() - .omraader(List.of("OMRAADE")) - .gyldigFraOgMed(LocalDate.of(2012, 4, 5).atStartOfDay()) - .gyldigTilOgMed(LocalDate.of(2012, 4, 4).atStartOfDay()) - .isNew(true) - .build(); - - var exception = assertThrows(HttpClientErrorException.class, () -> - fullmaktService.validate(request, PersonDTO.builder() - .ident(IDENT) - .build())); - - assertThat(exception.getMessage(), containsString("Ugyldig datointervall: gyldigFom må være før gyldigTom")); - } - - @Test - void whenStatedPersonDoesNotExist_thenThrowExecption() { - - when(personRepository.existsByIdent(IDENT)).thenReturn(false); - - var request = FullmaktDTO.builder() - .omraader(List.of("OMRAADE")) - .gyldigFraOgMed(LocalDate.of(2012, 4, 5).atStartOfDay()) - .gyldigTilOgMed(LocalDate.of(2012, 4, 6).atStartOfDay()) - .motpartsPersonident(IDENT) - .isNew(true) - .build(); - - var exception = assertThrows(HttpClientErrorException.class, () -> - fullmaktService.validate(request, PersonDTO.builder() - .ident(IDENT) - .build())); - - assertThat(exception.getMessage(), containsString(format("Fullmektig: person %s ikke funnet i database", IDENT))); - } -} \ No newline at end of file diff --git a/docs/docker b/docs/docker new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libs/data-transfer-search-objects/src/main/java/no/nav/testnav/libs/data/pdlforvalter/v1/OrdreResponseDTO.java b/libs/data-transfer-search-objects/src/main/java/no/nav/testnav/libs/data/pdlforvalter/v1/OrdreResponseDTO.java index cc747bd31c6..76d1ea631d5 100644 --- a/libs/data-transfer-search-objects/src/main/java/no/nav/testnav/libs/data/pdlforvalter/v1/OrdreResponseDTO.java +++ b/libs/data-transfer-search-objects/src/main/java/no/nav/testnav/libs/data/pdlforvalter/v1/OrdreResponseDTO.java @@ -22,6 +22,15 @@ public class OrdreResponseDTO { private PersonHendelserDTO hovedperson; private List relasjoner; + public List getRelasjoner() { + + if (isNull(relasjoner)) { + relasjoner = new ArrayList<>(); + } + return relasjoner; + } + + @Data @Builder @NoArgsConstructor diff --git a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java index 544251c47d6..67acbbe5fee 100644 --- a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java +++ b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java @@ -3,58 +3,113 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ThrowableProxy; import com.fasterxml.jackson.core.JsonFactory; +import lombok.Setter; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import net.logstash.logback.encoder.LogstashEncoder; +import org.springframework.util.StringUtils; import java.io.ByteArrayOutputStream; -import java.io.PrintWriter; import java.io.StringWriter; import java.util.regex.Pattern; +import static java.util.Objects.isNull; import static java.util.Objects.nonNull; - +import static org.springframework.util.StringUtils.truncate; + +/** + * Config: + *
    + *
  • {@code maxStackTraceLength}: Default 480, set to <1 to disable truncation of stack trace altogether.
  • + *
  • {@code addCauses}: If enabled, adds the cause(s) to the stack trace (with stack traces for each cause) Truncated according to above, filtered according to below.
  • + *
  • {@code stackTraceIncludePrefix}: If set, only include stack trace elements that starts with the given prefix, e.g. "no.nav.testnav".
  • + *
+ * Copy of {@code no.nav.testnav.libs.servletcore.logging.TestnavLogbackEncoder}. + * + * @see StringUtils#truncate(CharSequence, int) + */ @Slf4j +@SuppressWarnings("java:S110") public class TestnavLogbackEncoder extends LogstashEncoder { // matches exactly 11 digits (\\d{11}) that are not immediately preceded ((? 0 ? + truncate(writer.toString(), maxStackTraceLength) : + writer.toString(); } } + return null; + } - generator.writeEndObject(); - - generator.flush(); - outputStream.write('\n'); + private void appendStackTraceElements(StackTraceElement[] elements, StringWriter writer) { + for (StackTraceElement element : elements) { + if (isNull(stackTraceIncludePrefix) || stackTraceIncludePrefix.isEmpty() || element.toString().startsWith(stackTraceIncludePrefix)) { + writer + .append("\tat ") + .append(element.toString()) + .append("\n"); + } + } + } - return outputStream.toByteArray(); + private void appendStackTraceCauses(ThrowableProxy exception, StringWriter writer) { + if (addCauses) { + var cause = exception; + while (!isNull(cause.getCause())) { + cause = (ThrowableProxy) cause.getCause(); + writer + .append("caused by ") + .append(cause.getClassName()) + .append(": ") + .append(cause.getMessage()) + .append("\n"); + if (!isNull(cause.getThrowable())) { + appendStackTraceElements(cause.getThrowable().getStackTrace(), writer); + } + } + } } private String formatMessage(String message) { diff --git a/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/command/tokenx/OnBehalfOfExchangeCommand.java b/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/command/tokenx/OnBehalfOfExchangeCommand.java index 98cbd2600dd..036b1bdf314 100644 --- a/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/command/tokenx/OnBehalfOfExchangeCommand.java +++ b/libs/security-core/src/main/java/no/nav/testnav/libs/securitycore/command/tokenx/OnBehalfOfExchangeCommand.java @@ -8,7 +8,6 @@ import lombok.extern.slf4j.Slf4j; import no.nav.testnav.libs.securitycore.command.ExchangeCommand; import no.nav.testnav.libs.securitycore.domain.AccessToken; -import no.nav.testnav.libs.securitycore.domain.Token; import no.nav.testnav.libs.securitycore.domain.tokenx.TokenXProperties; import no.nav.testnav.libs.securitycore.domain.tokenx.WellKnown; import org.springframework.web.reactive.function.BodyInserters; @@ -31,7 +30,6 @@ public class OnBehalfOfExchangeCommand implements ExchangeCommand { @Override public Mono call() { - log.info("Access token opprettet for OAuth 2.0 On-Behalf-Of Flow. Scope: {}.", scope); return webClient .get() .uri(tokenX.getWellKnownUrl()) @@ -60,6 +58,7 @@ public Mono call() { throwable -> !(throwable instanceof WebClientResponseException), throwable -> log.error("Feil ved henting av access token.", throwable) ) + .doOnSuccess(accessToken -> log.info("Access token opprettet for OAuth 2.0 On-Behalf-Of Flow. Scope: {}.", scope)) ); } diff --git a/libs/servlet-core/src/main/java/no/nav/testnav/libs/servletcore/logging/TestnavLogbackEncoder.java b/libs/servlet-core/src/main/java/no/nav/testnav/libs/servletcore/logging/TestnavLogbackEncoder.java index 440949ff602..2158548eb68 100644 --- a/libs/servlet-core/src/main/java/no/nav/testnav/libs/servletcore/logging/TestnavLogbackEncoder.java +++ b/libs/servlet-core/src/main/java/no/nav/testnav/libs/servletcore/logging/TestnavLogbackEncoder.java @@ -3,58 +3,113 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.ThrowableProxy; import com.fasterxml.jackson.core.JsonFactory; +import lombok.Setter; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import net.logstash.logback.encoder.LogstashEncoder; +import org.springframework.util.StringUtils; import java.io.ByteArrayOutputStream; -import java.io.PrintWriter; import java.io.StringWriter; import java.util.regex.Pattern; +import static java.util.Objects.isNull; import static java.util.Objects.nonNull; - +import static org.springframework.util.StringUtils.truncate; + +/** + * Config: + *
    + *
  • {@code maxStackTraceLength}: Default 480, set to <1 to disable truncation of stack trace altogether.
  • + *
  • {@code addCauses}: If enabled, adds the cause(s) to the stack trace (with stack traces for each cause) Truncated according to above, filtered according to below.
  • + *
  • {@code stackTraceIncludePrefix}: If set, only include stack trace elements that starts with the given prefix, e.g. "no.nav.testnav".
  • + *
+ * Copy of {@code no.nav.testnav.libs.servletcore.logging.TestnavLogbackEncoder}. + * + * @see StringUtils#truncate(CharSequence, int) + */ @Slf4j +@SuppressWarnings("java:S110") public class TestnavLogbackEncoder extends LogstashEncoder { // matches exactly 11 digits (\\d{11}) that are not immediately preceded ((? 0 ? + truncate(writer.toString(), maxStackTraceLength) : + writer.toString(); } } + return null; + } - generator.writeEndObject(); - - generator.flush(); - outputStream.write('\n'); + private void appendStackTraceElements(StackTraceElement[] elements, StringWriter writer) { + for (StackTraceElement element : elements) { + if (isNull(stackTraceIncludePrefix) || stackTraceIncludePrefix.isEmpty() || element.toString().startsWith(stackTraceIncludePrefix)) { + writer + .append("\tat ") + .append(element.toString()) + .append("\n"); + } + } + } - return outputStream.toByteArray(); + private void appendStackTraceCauses(ThrowableProxy exception, StringWriter writer) { + if (addCauses) { + var cause = exception; + while (!isNull(cause.getCause())) { + cause = (ThrowableProxy) cause.getCause(); + writer + .append("caused by ") + .append(cause.getClassName()) + .append(": ") + .append(cause.getMessage()) + .append("\n"); + if (!isNull(cause.getThrowable())) { + appendStackTraceElements(cause.getThrowable().getStackTrace(), writer); + } + } + } } private String formatMessage(String message) { diff --git a/proxies/fullmakt-proxy/Dockerfile b/proxies/fullmakt-proxy/Dockerfile new file mode 100644 index 00000000000..4a36f93546f --- /dev/null +++ b/proxies/fullmakt-proxy/Dockerfile @@ -0,0 +1,8 @@ +FROM ghcr.io/navikt/baseimages/temurin:21 +LABEL maintainer="Team Dolly" + +ENV JAVA_OPTS="-Dspring.profiles.active=prod" + +ADD /build/libs/app.jar /app/app.jar + +EXPOSE 8080 diff --git a/proxies/fullmakt-proxy/build.gradle b/proxies/fullmakt-proxy/build.gradle new file mode 100644 index 00000000000..1ec03267946 --- /dev/null +++ b/proxies/fullmakt-proxy/build.gradle @@ -0,0 +1,18 @@ +plugins { + id "dolly-proxies" +} + +sonarqube { + properties { + property "sonar.projectKey", "testnav-fullmakt-proxy" + property "sonar.projectName", "testnav-fullmakt-proxy" + } +} + +dependencies { + implementation "no.nav.testnav.libs:reactive-security" + implementation "no.nav.testnav.libs:security-core" + implementation "no.nav.testnav.libs:vault" + implementation "org.springframework.boot:spring-boot-starter-webflux" + implementation "org.springframework.cloud:spring-cloud-starter-vault-config" +} diff --git a/proxies/fullmakt-proxy/config.yml b/proxies/fullmakt-proxy/config.yml new file mode 100644 index 00000000000..dd6615500a6 --- /dev/null +++ b/proxies/fullmakt-proxy/config.yml @@ -0,0 +1,60 @@ +apiVersion: "nais.io/v1alpha1" +kind: "Application" +metadata: + name: testnav-fullmakt-proxy + namespace: dolly + labels: + team: dolly +spec: + image: "{{image}}" + port: 8080 + webproxy: true + tokenx: + enabled: true + azure: + application: + allowAllUsers: true + enabled: true + tenant: nav.no + accessPolicy: + inbound: + rules: + - application: team-dolly-lokal-app + cluster: dev-gcp + - application: dolly-frontend + cluster: dev-gcp + - application: dolly-idporten + cluster: dev-gcp + - application: dolly-frontend-dev + cluster: dev-gcp + - application: testnav-oversikt-frontend + cluster: dev-gcp + - application: dolly-backend + cluster: dev-gcp + - application: dolly-backend-dev + cluster: dev-gcp + outbound: + rules: + - application: pdl-fullmakt + namespace: pdl + liveness: + path: /internal/isAlive + initialDelay: 4 + periodSeconds: 5 + failureThreshold: 500 + readiness: + path: /internal/isReady + initialDelay: 4 + periodSeconds: 5 + failureThreshold: 500 + replicas: + min: 1 + max: 1 + resources: + requests: + cpu: 200m + memory: 1024Mi + limits: + memory: 2048Mi + ingresses: + - "https://testnav-fullmakt-proxy.dev-fss-pub.nais.io" \ No newline at end of file diff --git a/proxies/fullmakt-proxy/gradle/wrapper/gradle-wrapper.jar b/proxies/fullmakt-proxy/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..7454180f2ae Binary files /dev/null and b/proxies/fullmakt-proxy/gradle/wrapper/gradle-wrapper.jar differ diff --git a/proxies/fullmakt-proxy/gradle/wrapper/gradle-wrapper.properties b/proxies/fullmakt-proxy/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..48c0a02ca41 --- /dev/null +++ b/proxies/fullmakt-proxy/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/proxies/fullmakt-proxy/gradlew b/proxies/fullmakt-proxy/gradlew new file mode 100755 index 00000000000..3da45c161b0 --- /dev/null +++ b/proxies/fullmakt-proxy/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright ? 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?, +# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?; +# * compound commands having a testable exit status, especially ?case?; +# * various built-in commands including ?command?, ?set?, and ?ulimit?. +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/proxies/fullmakt-proxy/gradlew.bat b/proxies/fullmakt-proxy/gradlew.bat new file mode 100644 index 00000000000..107acd32c4e --- /dev/null +++ b/proxies/fullmakt-proxy/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/proxies/fullmakt-proxy/gradlewUpdate.sh b/proxies/fullmakt-proxy/gradlewUpdate.sh new file mode 100755 index 00000000000..e5ee6361152 --- /dev/null +++ b/proxies/fullmakt-proxy/gradlewUpdate.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +gradle wrapper \ No newline at end of file diff --git a/proxies/fullmakt-proxy/settings.gradle b/proxies/fullmakt-proxy/settings.gradle new file mode 100644 index 00000000000..01a78cae60e --- /dev/null +++ b/proxies/fullmakt-proxy/settings.gradle @@ -0,0 +1,20 @@ +plugins { + id "com.gradle.develocity" version "3.17.4" +} + +rootProject.name = 'fullmakt-proxy' + +includeBuild "../../plugins/java" + +includeBuild '../../libs/reactive-core' +includeBuild '../../libs/reactive-proxy' +includeBuild '../../libs/reactive-security' +includeBuild '../../libs/security-core' +includeBuild '../../libs/vault' + +develocity { + buildScan { + termsOfUseUrl = "https://gradle.com/terms-of-service" + termsOfUseAgree = "yes" + } +} \ No newline at end of file diff --git a/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/FullmaktProxyApplicationStarter.java b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/FullmaktProxyApplicationStarter.java new file mode 100644 index 00000000000..f5d07bba999 --- /dev/null +++ b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/FullmaktProxyApplicationStarter.java @@ -0,0 +1,58 @@ +package no.nav.testnav.proxies.fullmaktproxy; + +import no.nav.testnav.libs.reactivecore.config.CoreConfig; +import no.nav.testnav.libs.reactiveproxy.config.SecurityConfig; +import no.nav.testnav.libs.reactivesecurity.exchange.tokenx.TokenXService; +import no.nav.testnav.proxies.fullmaktproxy.config.Consumers; +import no.nav.testnav.proxies.fullmaktproxy.consumer.FakedingsConsumer; +import no.nav.testnav.proxies.fullmaktproxy.filter.AddAuthenticationRequestGatewayFilterFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.cloud.gateway.route.Route; +import org.springframework.cloud.gateway.route.RouteLocator; +import org.springframework.cloud.gateway.route.builder.Buildable; +import org.springframework.cloud.gateway.route.builder.PredicateSpec; +import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; + +import java.util.function.Function; + +@Import({ + CoreConfig.class, + SecurityConfig.class, +}) +@SpringBootApplication +public class FullmaktProxyApplicationStarter { + @Bean + public RouteLocator customRouteLocator(RouteLocatorBuilder builder, + Consumers consumers, + FakedingsConsumer fakedingsConsumer, + TokenXService tokenXService) { + return builder + .routes() + .route(createRoute( + consumers + .getFullmakt() + .getUrl(), + AddAuthenticationRequestGatewayFilterFactory + .bearerIdportenHeaderFilter(fakedingsConsumer, tokenXService, consumers.getFullmakt()))) + .build(); + } + + public static void main(String[] args) { + SpringApplication.run(FullmaktProxyApplicationStarter.class, args); + } + + private Function> createRoute(String url, GatewayFilter filter) { + return spec -> spec + .path("/**") + .filters( + filterSpec -> filterSpec + .rewritePath("/(?.*)", "/${segment}") + .setResponseHeader("Content-Type", "application/json; charset=UTF-8") + .filter(filter)) + .uri(url); + } +} \ No newline at end of file diff --git a/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/config/Consumers.java b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/config/Consumers.java new file mode 100644 index 00000000000..eb1688a293e --- /dev/null +++ b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/config/Consumers.java @@ -0,0 +1,29 @@ +package no.nav.testnav.proxies.fullmaktproxy.config; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import static lombok.AccessLevel.PACKAGE; + +/** + * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}. + *

+ * Husk at Spring Boot bruker relaxed binding + * mellom configuration properties og field names. + * + * @see ServerProperties + */ +@Configuration +@ConfigurationProperties(prefix = "consumers") +@NoArgsConstructor(access = PACKAGE) +@Getter +@Setter(PACKAGE) +public class Consumers { + + private ServerProperties fullmakt; + +} diff --git a/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/config/LocalConfig.java b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/config/LocalConfig.java new file mode 100644 index 00000000000..748f7f16be0 --- /dev/null +++ b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/config/LocalConfig.java @@ -0,0 +1,13 @@ +package no.nav.testnav.proxies.fullmaktproxy.config; + +import no.nav.testnav.libs.vault.AbstractLocalVaultConfiguration; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.Profile; + +@Configuration +@Profile("local") +@Import({ +}) +public class LocalConfig extends AbstractLocalVaultConfiguration { +} \ No newline at end of file diff --git a/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/consumer/FakedingsConsumer.java b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/consumer/FakedingsConsumer.java new file mode 100644 index 00000000000..280d0540c9d --- /dev/null +++ b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/consumer/FakedingsConsumer.java @@ -0,0 +1,25 @@ +package no.nav.testnav.proxies.fullmaktproxy.consumer; + +import no.nav.testnav.proxies.fullmaktproxy.consumer.command.FakedingsGetCommand; +import org.springframework.stereotype.Service; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.core.publisher.Mono; + +@Service +public class FakedingsConsumer { + + private static final String FAKE_TOKENDINGS_URL = "https://fakedings.intern.dev.nav.no"; + private final WebClient webClient; + + public FakedingsConsumer() { + + this.webClient = WebClient.builder() + .baseUrl(FAKE_TOKENDINGS_URL) + .build(); + } + + public Mono getFakeToken(String ident) { + + return new FakedingsGetCommand(webClient, ident).call(); + } +} diff --git a/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/consumer/command/FakedingsGetCommand.java b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/consumer/command/FakedingsGetCommand.java new file mode 100644 index 00000000000..90811eb1f3d --- /dev/null +++ b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/consumer/command/FakedingsGetCommand.java @@ -0,0 +1,31 @@ +package no.nav.testnav.proxies.fullmaktproxy.consumer.command; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.core.publisher.Mono; + +import java.util.concurrent.Callable; + +@RequiredArgsConstructor +@Slf4j +public class FakedingsGetCommand implements Callable> { + + private static final String FAKEDINGS_URL = "/fake/tokenx"; + private final WebClient webClient; + private final String ident; + + @Override + public Mono call() { + + return webClient.get() + .uri(uriBuilder -> uriBuilder + .path(FAKEDINGS_URL) + .queryParam("pid", ident) + .queryParam("acr", "Level4") + .build()) + .retrieve() + .bodyToMono(String.class) + .doOnError(throwable -> log.error("Feil ved henting av fakedings token i fullmakt-proxy", throwable)); + } +} \ No newline at end of file diff --git a/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/filter/AddAuthenticationRequestGatewayFilterFactory.java b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/filter/AddAuthenticationRequestGatewayFilterFactory.java new file mode 100644 index 00000000000..a3d5bcf30dc --- /dev/null +++ b/proxies/fullmakt-proxy/src/main/java/no/nav/testnav/proxies/fullmaktproxy/filter/AddAuthenticationRequestGatewayFilterFactory.java @@ -0,0 +1,31 @@ +package no.nav.testnav.proxies.fullmaktproxy.filter; + +import lombok.experimental.UtilityClass; +import lombok.extern.slf4j.Slf4j; +import no.nav.testnav.libs.reactivesecurity.exchange.tokenx.TokenXService; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import no.nav.testnav.proxies.fullmaktproxy.consumer.FakedingsConsumer; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.http.HttpHeaders; + +@Slf4j +@UtilityClass +public class AddAuthenticationRequestGatewayFilterFactory { + public static GatewayFilter bearerIdportenHeaderFilter(FakedingsConsumer fakedingsConsumer, + TokenXService tokenXService, + ServerProperties serverProperties) { + + return (exchange, chain) -> { + var httpRequest = exchange.getRequest(); + var ident = httpRequest.getHeaders().getFirst("fnr"); + return fakedingsConsumer.getFakeToken(ident) + .flatMap(faketoken -> tokenXService.exchange(serverProperties, faketoken) + .flatMap(tokenX -> { + exchange.mutate() + .request(builder -> builder.header(HttpHeaders.AUTHORIZATION, + "Bearer " + tokenX.getTokenValue()).build()); + return chain.filter(exchange); + })); + }; + } +} \ No newline at end of file diff --git a/proxies/fullmakt-proxy/src/main/resources/application.yml b/proxies/fullmakt-proxy/src/main/resources/application.yml new file mode 100644 index 00000000000..f49211ee1da --- /dev/null +++ b/proxies/fullmakt-proxy/src/main/resources/application.yml @@ -0,0 +1,37 @@ +AAD_ISSUER_URI: https://login.microsoftonline.com/62366534-1ec3-4962-8869-9b5535279d0b + +spring: + application: + name: testnav-fullmakt-proxy + description: Proxy for pdl-fullmakt som legger på sikkerhet og benytter trygdeetaten tenant. + security: + oauth2: + resourceserver: + aad: + issuer-uri: ${AAD_ISSUER_URI}/v2.0 + jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys + accepted-audience: ${azure.app.client.id}, api://${azure.app.client.id} + tokenx: + issuer-uri: ${TOKEN_X_ISSUER} + jwk-set-uri: ${TOKEN_X_JWKS_URI} + accepted-audience: ${TOKEN_X_CLIENT_ID} + cloud: + gateway: + httpclient: + response-timeout: 600s + vault: + enabled: false + +server: + servlet: + encoding: + charset: UTF-8 + error: + include-message: always + +consumers: + fullmakt: + name: pdl-fullmakt + namespace: pdl + url: http://pdl-fullmakt.pdl.svc.nais.local + cluster: dev-fss \ No newline at end of file diff --git a/proxies/fullmakt-proxy/src/main/resources/logback-spring.xml b/proxies/fullmakt-proxy/src/main/resources/logback-spring.xml new file mode 100644 index 00000000000..3b591204bab --- /dev/null +++ b/proxies/fullmakt-proxy/src/main/resources/logback-spring.xml @@ -0,0 +1,40 @@ + + + + + + + true + 256 + 10280 + 20 + ^sun\.reflect\..*\.invoke + ^net\.sf\.cglib\.proxy\.MethodProxy\.invoke + java\.util\.concurrent\..* + org\.apache\.catalina\..* + org\.apache\.coyote\..* + org\.apache\.tomcat\..* + + + + + + + + + + + + + %d{HH:mm:ss.SSS} | %5p | %logger{25} | %m%n + + utf8 + + + + + + + + + \ No newline at end of file diff --git a/proxies/fullmakt-proxy/src/test/java/no/nav/testnav/proxies/fullmaktproxy/ApplicationContextTest.java b/proxies/fullmakt-proxy/src/test/java/no/nav/testnav/proxies/fullmaktproxy/ApplicationContextTest.java new file mode 100644 index 00000000000..2cfbe3605db --- /dev/null +++ b/proxies/fullmakt-proxy/src/test/java/no/nav/testnav/proxies/fullmaktproxy/ApplicationContextTest.java @@ -0,0 +1,20 @@ +package no.nav.testnav.proxies.fullmaktproxy; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; +import org.springframework.test.context.ActiveProfiles; + +@SpringBootTest +@ActiveProfiles("test") +class ApplicationContextTest { + + @MockBean + public ReactiveJwtDecoder reactiveJwtDecoder; + + @Test + @SuppressWarnings("java:S2699") + void load_app_context() { + } +} diff --git a/proxies/fullmakt-proxy/src/test/resources/application-test.yml b/proxies/fullmakt-proxy/src/test/resources/application-test.yml new file mode 100644 index 00000000000..f05debbd219 --- /dev/null +++ b/proxies/fullmakt-proxy/src/test/resources/application-test.yml @@ -0,0 +1 @@ +TOKEN_X_ISSUER: dummy \ No newline at end of file