From d9a7e1fbd36aba73b14fa5cf969e6c2c8872faa5 Mon Sep 17 00:00:00 2001 From: Klara M Helgemo Date: Fri, 29 Nov 2024 13:26:26 +0100 Subject: [PATCH 1/4] Fjerner all kontonummerkode, med unntak av kontonummer i grensesnitt. Co-authored-by: Julie Hill Roa --- .../kontoregister/HentKontoRequestDTO.java | 14 --- .../kontoregister/HentKontoResponseDTO.java | 42 ------- .../client/kontoregister/KontoDTO.java | 24 ---- .../kontoregister/KontoregisterClient.java | 9 -- .../KontoregisterClientImpl.java | 118 ------------------ .../kontoregister/UtenlandskKontoDTO.java | 20 --- .../veilarbperson/config/ClientConfig.java | 7 -- .../controller/v2/PersonV2Controller.java | 14 --- .../service/PersonV2Service.java | 12 +- .../config/ClientTestConfig.java | 43 ------- .../service/PersonV2ServiceTest.java | 4 - .../PersonDataKontoregisterMapperTest.java | 92 -------------- 12 files changed, 7 insertions(+), 392 deletions(-) delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoRequestDTO.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoResponseDTO.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/KontoDTO.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClient.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClientImpl.java delete mode 100644 src/main/java/no/nav/veilarbperson/client/kontoregister/UtenlandskKontoDTO.java delete mode 100644 src/test/java/no/nav/veilarbperson/utils/mappers/PersonDataKontoregisterMapperTest.java diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoRequestDTO.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoRequestDTO.java deleted file mode 100644 index cf300ce6..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoRequestDTO.java +++ /dev/null @@ -1,14 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class HentKontoRequestDTO { - private String kontohaver; -} diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoResponseDTO.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoResponseDTO.java deleted file mode 100644 index 0fe80ad0..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/HentKontoResponseDTO.java +++ /dev/null @@ -1,42 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import com.fasterxml.jackson.annotation.JsonInclude; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.http.HttpStatus; - -import java.time.LocalDateTime; -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class HentKontoResponseDTO { - - private String kontohaver; - private String kontonummer; - - private class UtenlandskKontoDTO { - private String banknavn; - private String bankkode; - private String bankLandkode; - private String valutakode; - private String swiftBicKode; - private String bankadresse1; - private String bankadresse2; - private String bankadresse3; - } - - private LocalDateTime gyldigFom; - private LocalDateTime gyldigTom; - private String endretAv; - private String opprettetAv; - - public String getNorskKontonummer() { - return kontonummer; - } - public void setNorskKontonummer(String kontonummer) { - this.kontonummer = kontonummer; - } - -} diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoDTO.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoDTO.java deleted file mode 100644 index 86986463..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import com.fasterxml.jackson.annotation.JsonInclude; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDateTime; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class KontoDTO { - private String kontohaver; - private String kontonummer; - - private UtenlandskKontoDTO utenlandskKontoInfo; - - private LocalDateTime gyldigFom; - private LocalDateTime gyldigTom; - private String endretAv; - private String opprettetAv; -} diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClient.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClient.java deleted file mode 100644 index 77151310..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClient.java +++ /dev/null @@ -1,9 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import no.nav.common.health.HealthCheck; - -public interface KontoregisterClient extends HealthCheck { - - HentKontoResponseDTO hentKontonummer(HentKontoRequestDTO kontohaver); - -} \ No newline at end of file diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClientImpl.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClientImpl.java deleted file mode 100644 index 35770a09..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/KontoregisterClientImpl.java +++ /dev/null @@ -1,118 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - - -import lombok.extern.slf4j.Slf4j; -import no.nav.common.health.HealthCheckResult; -import no.nav.common.health.HealthCheckUtils; -import no.nav.common.rest.client.RestClient; -import no.nav.common.rest.client.RestUtils; -import no.nav.common.utils.UrlUtils; -import no.nav.tjeneste.virksomhet.person.v3.informasjon.Person; -import no.nav.veilarbperson.config.CacheConfig; -import no.nav.veilarbperson.domain.Enhet; -import no.nav.veilarbperson.domain.PersonDataKontoregister; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; - -import java.io.IOException; -import java.util.UUID; -import java.util.function.Supplier; - -import static java.util.Optional.ofNullable; -import static no.nav.common.utils.UrlUtils.joinPaths; -import static org.springframework.http.HttpHeaders.AUTHORIZATION; - -@Slf4j -public class KontoregisterClientImpl implements KontoregisterClient { - - private final String kontoregisterUrl; - private static final String KONTOREGISTER_API_URL = "/api/system/v1/hent-aktiv-konto"; - - private final Supplier systemUserTokenProvider; - - private final OkHttpClient client; - - public KontoregisterClientImpl(String kontoregisterUrl, Supplier systemUserTokenProvider) { - this.kontoregisterUrl = kontoregisterUrl; - this.systemUserTokenProvider = systemUserTokenProvider; - this.client = RestClient.baseClient(); - } - - @Cacheable(CacheConfig.KONTOREGISTER_CACHE_NAME) - @Override - public HentKontoResponseDTO hentKontonummer(HentKontoRequestDTO kontohaver) { - Request request = new Request.Builder() - .url(UrlUtils.joinPaths(kontoregisterUrl, KONTOREGISTER_API_URL)) - .header(HttpHeaders.AUTHORIZATION, "Bearer " + systemUserTokenProvider.get()) - .header("Nav-Call-Id", UUID.randomUUID().toString()) - .post(RestUtils.toJsonRequestBody(kontohaver)) - .build(); - - try (Response response = client.newCall(request).execute()) { - RestUtils.throwIfNotSuccessful(response); - if (response.code() == HttpStatus.OK.value()) { - return RestUtils.parseJsonResponse(response, HentKontoResponseDTO.class) - .orElseThrow(() -> new IllegalStateException("HentKontonummer uventet feil")); - } else if (response.code() == HttpStatus.NO_CONTENT.value()) { - return new HentKontoResponseDTO(); - } else { - throw new IllegalStateException(String.format("Error code: %s, Message: %s", response.code(), response.message())); - } - - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public HealthCheckResult checkHealth() { - Request request = new Request.Builder() - .url(joinPaths(kontoregisterUrl, "/rest/ping")) - .header(AUTHORIZATION, "Bearer " + systemUserTokenProvider.get()) - .build(); - - return HealthCheckUtils.pingUrl(request, client); - } - - public static class PersonDataMapper { - - public static PersonDataKontoregister tilKontoregisterPerson(Person person) { - return new PersonDataKontoregister().setKontonummer(kanskjeKontonummer(person)); - } - - private static String kanskjeKontonummer(Person person) { - if (person instanceof no.nav.tjeneste.virksomhet.person.v3.informasjon.Bruker) { - no.nav.tjeneste.virksomhet.person.v3.informasjon.Bankkonto bankkonto = - ((no.nav.tjeneste.virksomhet.person.v3.informasjon.Bruker) person).getBankkonto(); - return kanskjeKontonummer(bankkonto); - } - return null; - } - - private static String kanskjeKontonummer(no.nav.tjeneste.virksomhet.person.v3.informasjon.Bankkonto bankkonto) { - if (bankkonto instanceof no.nav.tjeneste.virksomhet.person.v3.informasjon.BankkontoNorge bankkontoNorge) { - return ofNullable(bankkontoNorge.getBankkonto()) - .map(no.nav.tjeneste.virksomhet.person.v3.informasjon.Bankkontonummer::getBankkontonummer) - .orElse(null); - } else if (bankkonto instanceof no.nav.tjeneste.virksomhet.person.v3.informasjon.BankkontoUtland wsBankkontoUtland) { - return ofNullable(wsBankkontoUtland.getBankkontoUtland()) - .map(no.nav.tjeneste.virksomhet.person.v3.informasjon.BankkontonummerUtland::getBankkontonummer) - .orElse(null); - } - return null; - } - } - - public static class Mappers { - public static Enhet fraNorg2Enhet(no.nav.common.client.norg2.Enhet enhet) { - return new Enhet(enhet.getEnhetNr(), enhet.getNavn()); - } - } -} - - diff --git a/src/main/java/no/nav/veilarbperson/client/kontoregister/UtenlandskKontoDTO.java b/src/main/java/no/nav/veilarbperson/client/kontoregister/UtenlandskKontoDTO.java deleted file mode 100644 index f960ef82..00000000 --- a/src/main/java/no/nav/veilarbperson/client/kontoregister/UtenlandskKontoDTO.java +++ /dev/null @@ -1,20 +0,0 @@ -package no.nav.veilarbperson.client.kontoregister; - -import com.fasterxml.jackson.annotation.JsonInclude; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class UtenlandskKontoDTO { - private String banknavn; - private String bankkode; - private String bankLandkode; - private String valutakode; - private String swiftBicKode; - private String bankadresse1; - private String bankadresse2; - private String bankadresse3; -} diff --git a/src/main/java/no/nav/veilarbperson/config/ClientConfig.java b/src/main/java/no/nav/veilarbperson/config/ClientConfig.java index fe810f3e..2e2bb421 100644 --- a/src/main/java/no/nav/veilarbperson/config/ClientConfig.java +++ b/src/main/java/no/nav/veilarbperson/config/ClientConfig.java @@ -19,8 +19,6 @@ import no.nav.veilarbperson.client.digdir.DigdirClientImpl; import no.nav.veilarbperson.client.kodeverk.KodeverkClient; import no.nav.veilarbperson.client.kodeverk.KodeverkClientImpl; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClientImpl; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.nom.SkjermetClientImpl; import no.nav.veilarbperson.client.oppslagArbeidssoekerregisteret.OppslagArbeidssoekerregisteretClient; @@ -73,11 +71,6 @@ public PamClient pamClient(EnvironmentProperties properties, AzureAdMachineToMac } - @Bean - public KontoregisterClient kontoregisterClient(EnvironmentProperties properties, MachineToMachineTokenClient tokenClient) { - return new KontoregisterClientImpl(properties.getKontoregisterUrl(), () -> tokenClient.createMachineToMachineToken(properties.getKontoregisterScope())); - } - @Bean public SkjermetClient skjermetClient(EnvironmentProperties properties, AzureAdMachineToMachineTokenClient tokenClient) { return new SkjermetClientImpl(properties.getSkjermedePersonerPipUrl(), diff --git a/src/main/java/no/nav/veilarbperson/controller/v2/PersonV2Controller.java b/src/main/java/no/nav/veilarbperson/controller/v2/PersonV2Controller.java index dd318c50..b93a447c 100644 --- a/src/main/java/no/nav/veilarbperson/controller/v2/PersonV2Controller.java +++ b/src/main/java/no/nav/veilarbperson/controller/v2/PersonV2Controller.java @@ -4,9 +4,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.common.types.identer.Fnr; -import no.nav.veilarbperson.client.kontoregister.HentKontoRequestDTO; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; -import no.nav.veilarbperson.client.kontoregister.HentKontoResponseDTO; import no.nav.veilarbperson.client.regoppslag.RegoppslagClient; import no.nav.veilarbperson.client.regoppslag.RegoppslagResponseDTO; import no.nav.veilarbperson.domain.*; @@ -26,8 +23,6 @@ public class PersonV2Controller { private final AuthService authService; private final RegoppslagClient regoppslagClient; - private final KontoregisterClient kontoregisterClient; - @Deprecated @GetMapping @Operation(summary = "Henter informasjon om en person fra PDL") @@ -83,13 +78,4 @@ public RegoppslagResponseDTO hentPostadresse(@RequestParam("fnr") Fnr fnr) { authService.sjekkLesetilgang(fnr); return regoppslagClient.hentPostadresse(fnr); } - @PostMapping - @Operation(summary = "Henter kontonummer fra Kontoregister") - public HentKontoResponseDTO hentKontonummerFraKontoregister(@RequestParam("kontohaver") HentKontoRequestDTO kontohaver) { - Fnr fnr = new Fnr(kontohaver.getKontohaver()); - authService.stoppHvisEksternBruker(); - authService.sjekkLesetilgang(fnr); - return kontoregisterClient.hentKontonummer(kontohaver); - } - } diff --git a/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java b/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java index ffa204d7..1ab5be58 100644 --- a/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java +++ b/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java @@ -25,7 +25,6 @@ import java.util.stream.Stream; import static java.util.Optional.ofNullable; -import static no.nav.veilarbperson.client.kontoregister.KontoregisterClientImpl.Mappers.fraNorg2Enhet; import static no.nav.veilarbperson.utils.PersonV2DataMapper.*; import static no.nav.veilarbperson.utils.VergeOgFullmaktDataMapper.*; @@ -81,9 +80,7 @@ public PersonV2Data hentFlettetPerson(PersonFraPdlRequest personFraPdlRequest) { } public void flettInnKontonummer(PersonV2Data person) { - // HentKontoRequestDTO kontohaver = new HentKontoRequestDTO(); - // kontohaver.setKontohaver(person.getFodselsnummer().toString()); - // HentKontoResponseDTO kontoregisterKonto = kontoregisterClient.hentKontonummer(kontohaver); + person.setKontonummer(null); } @@ -182,6 +179,12 @@ private void flettGeografiskEnhet(PersonFraPdlRequest personFraPdlRequest, Perso } } + private Enhet fraNorg2Enhet(no.nav.common.client.norg2.Enhet enhet) { + { + return new Enhet(enhet.getEnhetNr(), enhet.getNavn()); + } + } + public void flettKodeverk(PersonV2Data personV2Data) { Optional postnrIBostedsVegAdr = ofNullable(personV2Data.getBostedsadresse()).map(Bostedsadresse::getVegadresse).map( @@ -363,5 +366,4 @@ public PersonNavnV2 hentNavn(PersonFraPdlRequest personFraPdlRequest) { return PersonV2DataMapper.navnMapper(personNavn.getNavn()); } - } diff --git a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java index 708bedb5..1e3c641a 100644 --- a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java +++ b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java @@ -14,22 +14,14 @@ import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirKontaktinfo; import no.nav.veilarbperson.client.kodeverk.KodeverkClient; -import no.nav.veilarbperson.client.kontoregister.HentKontoRequestDTO; -import no.nav.veilarbperson.client.kontoregister.HentKontoResponseDTO; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.oppslagArbeidssoekerregisteret.OppslagArbeidssoekerregisteretClient; import no.nav.veilarbperson.client.oppslagArbeidssoekerregisteret.OppslagArbeidssoekerregisteretClientImpl; -import no.nav.veilarbperson.client.pam.PamClient; import no.nav.veilarbperson.client.pdl.HentPerson; import no.nav.veilarbperson.client.pdl.PdlClient; import no.nav.veilarbperson.client.pdl.domain.PdlRequest; -import no.nav.veilarbperson.client.representasjon.RepresentasjonClient; import no.nav.veilarbperson.client.veilarboppfolging.UnderOppfolging; import no.nav.veilarbperson.client.veilarboppfolging.VeilarboppfolgingClient; -import okhttp3.Response; -import org.jetbrains.annotations.NotNull; -import org.mockito.Mockito; import org.springframework.cloud.contract.wiremock.WireMockConfiguration; import org.springframework.cloud.contract.wiremock.WireMockConfigurationCustomizer; import org.springframework.context.annotation.Bean; @@ -130,22 +122,6 @@ public HealthCheckResult checkHealth() { }; } - @Bean - public KontoregisterClient kontoregisterClient() { - return new KontoregisterClient() { - @Override - public HentKontoResponseDTO hentKontonummer(HentKontoRequestDTO kontohaver) { - return new HentKontoResponseDTO(); - } - - @Override - public HealthCheckResult checkHealth() { - return HealthCheckResult.healthy(); - } - }; - } - - @Bean public SkjermetClient skjermetClient() { return new SkjermetClient() { @@ -233,25 +209,6 @@ public HealthCheckResult checkHealth() { }; } - public RepresentasjonClient representasjonClient() { - return Mockito.mock(RepresentasjonClient.class); - } - - @Bean - public PamClient pamClient() { - return new PamClient() { - @Override - public Response hentCvOgJobbprofil(Fnr fnr, boolean erBrukerManuell) { - return null; - } - - @Override - public HealthCheckResult checkHealth() { - return HealthCheckResult.healthy(); - } - }; - } - @Bean public SelfTestChecks selfTestChecks() { return mock(SelfTestChecks.class); diff --git a/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java b/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java index d1c15414..d95347d0 100644 --- a/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java +++ b/src/test/java/no/nav/veilarbperson/service/PersonV2ServiceTest.java @@ -6,8 +6,6 @@ import no.nav.common.types.identer.Fnr; import no.nav.veilarbperson.client.digdir.DigdirClient; import no.nav.veilarbperson.client.digdir.DigdirKontaktinfo; -import no.nav.veilarbperson.client.kontoregister.HentKontoResponseDTO; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClient; import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.pdl.HentPerson; import no.nav.veilarbperson.client.pdl.PdlClient; @@ -45,7 +43,6 @@ public class PersonV2ServiceTest extends PdlClientTestConfig { private final Norg2Client norg2Client = mock(Norg2Client.class); private final DigdirClient digdirClient = mock(DigdirClient.class); private PdlClient pdlClient; - private final KontoregisterClient kontoregisterClient = mock(KontoregisterClient.class); private final KodeverkService kodeverkService = mock(KodeverkService.class); private final SkjermetClient skjermetClient = mock(SkjermetClient.class); private final AuthService authService = mock(AuthService.class); @@ -64,7 +61,6 @@ public void setup() { pdlClient = getPdlClient(); when(norg2Client.hentTilhorendeEnhet(anyString(), any(), anyBoolean())).thenReturn(new Enhet()); when(digdirClient.hentKontaktInfo(any())).thenReturn(new DigdirKontaktinfo()); - when(kontoregisterClient.hentKontonummer(any())).thenReturn(new HentKontoResponseDTO()); personV2Service = new PersonV2Service( pdlClient, diff --git a/src/test/java/no/nav/veilarbperson/utils/mappers/PersonDataKontoregisterMapperTest.java b/src/test/java/no/nav/veilarbperson/utils/mappers/PersonDataKontoregisterMapperTest.java deleted file mode 100644 index 287db0e2..00000000 --- a/src/test/java/no/nav/veilarbperson/utils/mappers/PersonDataKontoregisterMapperTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package no.nav.veilarbperson.utils.mappers; - -import no.nav.tjeneste.virksomhet.person.v3.informasjon.*; -import no.nav.veilarbperson.client.kontoregister.KontoregisterClientImpl; -import no.nav.veilarbperson.domain.PersonDataKontoregister; -import org.junit.Test; - - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; - -public class PersonDataKontoregisterMapperTest { - - @Test - public void kontonummerMappesDersomBankkontoErNorge() { - final String forventetVerdi = "123456789"; - - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoNorge().withBankkonto(new Bankkontonummer().withBankkontonummer(forventetVerdi)) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), is(forventetVerdi)); - } - - @Test - public void kontonummerMappesDersomBankkontoErUtland() { - final String forventetVerdi = "987654321"; - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoUtland().withBankkontoUtland(new BankkontonummerUtland().withBankkontonummer(forventetVerdi)) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), is(forventetVerdi)); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontoErNull() { - final Person wsPerson = new Bruker().withBankkonto(null); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontonummerErNull() { - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoNorge().withBankkonto(null) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontonummerVerdiErNull() { - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoNorge().withBankkonto(new Bankkontonummer().withBankkontonummer(null)) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontonummerUtlandErNull() { - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoUtland().withBankkontoUtland(null) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - - @Test - public void kontonummerMappesTilNullDersomWSBankkontonummerUtlandVerdiErNull() { - final Person wsPerson = new Bruker().withBankkonto( - new BankkontoUtland().withBankkontoUtland(new BankkontonummerUtland().withBankkontonummer(null)) - ); - - final PersonDataKontoregister kontoregisterPerson = KontoregisterClientImpl.PersonDataMapper.tilKontoregisterPerson(wsPerson); - - assertThat(kontoregisterPerson.getKontonummer(), nullValue()); - } - -} From a5fe12d1286222f1759ab74f9d37386ceb112b4d Mon Sep 17 00:00:00 2001 From: Klara M Helgemo Date: Fri, 29 Nov 2024 14:17:55 +0100 Subject: [PATCH 2/4] Legger tilbake kode som ikke skulle slettes. Co-authored-by: Julie Hill Roa --- .../veilarbperson/config/ClientTestConfig.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java index 1e3c641a..7a4fa8a6 100644 --- a/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java +++ b/src/test/java/no/nav/veilarbperson/config/ClientTestConfig.java @@ -17,11 +17,13 @@ import no.nav.veilarbperson.client.nom.SkjermetClient; import no.nav.veilarbperson.client.oppslagArbeidssoekerregisteret.OppslagArbeidssoekerregisteretClient; import no.nav.veilarbperson.client.oppslagArbeidssoekerregisteret.OppslagArbeidssoekerregisteretClientImpl; +import no.nav.veilarbperson.client.pam.PamClient; import no.nav.veilarbperson.client.pdl.HentPerson; import no.nav.veilarbperson.client.pdl.PdlClient; import no.nav.veilarbperson.client.pdl.domain.PdlRequest; import no.nav.veilarbperson.client.veilarboppfolging.UnderOppfolging; import no.nav.veilarbperson.client.veilarboppfolging.VeilarboppfolgingClient; +import okhttp3.Response; import org.springframework.cloud.contract.wiremock.WireMockConfiguration; import org.springframework.cloud.contract.wiremock.WireMockConfigurationCustomizer; import org.springframework.context.annotation.Bean; @@ -122,6 +124,7 @@ public HealthCheckResult checkHealth() { }; } + @Bean public SkjermetClient skjermetClient() { return new SkjermetClient() { @@ -209,6 +212,21 @@ public HealthCheckResult checkHealth() { }; } + @Bean + public PamClient pamClient() { + return new PamClient() { + @Override + public Response hentCvOgJobbprofil(Fnr fnr, boolean erBrukerManuell) { + return null; + } + + @Override + public HealthCheckResult checkHealth() { + return HealthCheckResult.healthy(); + } + }; + } + @Bean public SelfTestChecks selfTestChecks() { return mock(SelfTestChecks.class); From b7aafa6eff7c5b7f9b55d1cc6a065c914b7185b3 Mon Sep 17 00:00:00 2001 From: Klara M Helgemo Date: Fri, 29 Nov 2024 14:37:06 +0100 Subject: [PATCH 3/4] Rydder i nais-yamlene og i properties. Co-authored-by: Julie Hill Roa --- nais-dev-gcp.yaml | 6 ------ nais-prod-gcp.yaml | 6 ------ .../no/nav/veilarbperson/config/EnvironmentProperties.java | 2 -- src/main/resources/application.properties | 2 -- 4 files changed, 16 deletions(-) diff --git a/nais-dev-gcp.yaml b/nais-dev-gcp.yaml index 861bf8ca..1d677fd1 100644 --- a/nais-dev-gcp.yaml +++ b/nais-dev-gcp.yaml @@ -69,8 +69,6 @@ spec: namespace: paw - application: skjermede-personer-pip namespace: nom - - application: sokos-kontoregister-person - namespace: okonomi - application: norg2 namespace: org - application: veilarboppfolging @@ -118,10 +116,6 @@ spec: value: api://dev-gcp.poao.veilarboppfolging/.default - name: VEILARBOPPFOLGING_URL value: http://veilarboppfolging.poao/veilarboppfolging - - name: KONTOREGISTER_PERSON_V1_SCOPE - value: api://dev-gcp.okonomi.sokos-kontoregister-person/.default - - name: KONTOREGISTER_PERSON_V1_URL - value: http://sokos-kontoregister-person.okonomi - name: OPPSLAG_ARBEIDSSOEKERREGISTERET_URL value: http://paw-arbeidssoekerregisteret-api-oppslag.paw - name: OPPSLAG_ARBEIDSSOEKERREGISTERET_SCOPE diff --git a/nais-prod-gcp.yaml b/nais-prod-gcp.yaml index 85df70be..e2d1b74f 100644 --- a/nais-prod-gcp.yaml +++ b/nais-prod-gcp.yaml @@ -68,8 +68,6 @@ spec: namespace: paw - application: skjermede-personer-pip namespace: nom - - application: sokos-kontoregister-person - namespace: okonomi - application: norg2 namespace: org - application: veilarboppfolging @@ -118,10 +116,6 @@ spec: value: api://prod-gcp.poao.veilarboppfolging/.default - name: VEILARBOPPFOLGING_URL value: http://veilarboppfolging.poao/veilarboppfolging - - name: KONTOREGISTER_PERSON_V1_SCOPE - value: api://prod-gcp.okonomi.sokos-kontoregister-person/.default - - name: KONTOREGISTER_PERSON_V1_URL - value: http://sokos-kontoregister-person.okonomi - name: OPPSLAG_ARBEIDSSOEKERREGISTERET_URL value: http://paw-arbeidssoekerregisteret-api-oppslag.paw - name: OPPSLAG_ARBEIDSSOEKERREGISTERET_SCOPE diff --git a/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java b/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java index c13e8a92..d292a72e 100644 --- a/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java +++ b/src/main/java/no/nav/veilarbperson/config/EnvironmentProperties.java @@ -31,8 +31,6 @@ public class EnvironmentProperties { private String skjermedePersonerPipUrl; private String veilarboppfolgingScope; private String veilarboppfolgingUrl; - private String kontoregisterScope; - private String kontoregisterUrl; private String oppslagArbeidssoekerregisteretUrl; private String oppslagArbeidssoekerregisteretScope; } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 60ac7acb..df83a676 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -31,8 +31,6 @@ app.env.skjermedePersonerPipScope=${SKJERMEDE_PERSONER_PIP_SCOPE} app.env.skjermedePersonerPipUrl=${SKJERMEDE_PERSONER_PIP_URL} app.env.veilarboppfolgingScope=${VEILARBOPPFOLGING_SCOPE} app.env.veilarboppfolgingUrl=${VEILARBOPPFOLGING_URL} -app.env.kontoregisterScope=${KONTOREGISTER_PERSON_V1_SCOPE} -app.env.kontoregisterUrl=${KONTOREGISTER_PERSON_V1_URL} app.env.oppslagArbeidssoekerregisteretScope=${OPPSLAG_ARBEIDSSOEKERREGISTERET_SCOPE} app.env.oppslagArbeidssoekerregisteretUrl=${OPPSLAG_ARBEIDSSOEKERREGISTERET_URL} From 7195cbfabf3b70a55b4a50d9012c51004286912c Mon Sep 17 00:00:00 2001 From: Klara M Helgemo Date: Fri, 29 Nov 2024 15:29:54 +0100 Subject: [PATCH 4/4] Fjerner parenteser Co-authored-by: Julie Hill Roa --- .../java/no/nav/veilarbperson/service/PersonV2Service.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java b/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java index 1ab5be58..d318a4a0 100644 --- a/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java +++ b/src/main/java/no/nav/veilarbperson/service/PersonV2Service.java @@ -180,12 +180,9 @@ private void flettGeografiskEnhet(PersonFraPdlRequest personFraPdlRequest, Perso } private Enhet fraNorg2Enhet(no.nav.common.client.norg2.Enhet enhet) { - { - return new Enhet(enhet.getEnhetNr(), enhet.getNavn()); - } + return new Enhet(enhet.getEnhetNr(), enhet.getNavn()); } - public void flettKodeverk(PersonV2Data personV2Data) { Optional postnrIBostedsVegAdr = ofNullable(personV2Data.getBostedsadresse()).map(Bostedsadresse::getVegadresse).map( Bostedsadresse.Vegadresse::getPostnummer);