Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Remove deprecated environment 't13' from configuration and relat… #3754

Merged
merged 13 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
import reactor.core.publisher.Mono;

import java.util.List;
import java.util.stream.Stream;

import static java.util.Objects.nonNull;
import static org.apache.logging.log4j.util.Strings.isNotBlank;

@Slf4j
@Service
Expand All @@ -34,16 +32,10 @@ public class KrrstubClient implements ClientRegister {
private final ErrorStatusDecoder errorStatusDecoder;
private final TransactionHelperService transactionHelperService;

private static boolean isKrrMaalform(String spraak) {

return isNotBlank(spraak) && Stream.of("NB", "NN", "EN", "SE").anyMatch(spraak::equalsIgnoreCase);
}

@Override
public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, DollyPerson dollyPerson, BestillingProgress progress, boolean isOpprettEndre) {

if (nonNull(bestilling.getKrrstub()) ||
(nonNull(bestilling.getTpsMessaging()) && isKrrMaalform(bestilling.getTpsMessaging().getSpraakKode()))) {
if (nonNull(bestilling.getKrrstub())) {

var context = new MappingContext.Factory().getContext();
context.setProperty("ident", dollyPerson.getIdent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
import ma.glasnost.orika.CustomMapper;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.MappingContext;
import no.nav.dolly.domain.resultset.RsDollyUtvidetBestilling;
import no.nav.dolly.domain.resultset.krrstub.DigitalKontaktdata;
import no.nav.dolly.domain.resultset.krrstub.RsDigitalKontaktdata;
import no.nav.dolly.mapper.MappingStrategy;
import org.springframework.stereotype.Component;

import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.stream.Stream;

import static java.util.Objects.nonNull;
import static org.apache.logging.log4j.util.Strings.isBlank;
Expand Down Expand Up @@ -46,7 +44,6 @@ public void mapAtoB(RsDigitalKontaktdata digitalKontaktdata, DigitalKontaktdata

kontaktdataRequest.setEpost(isBlank(digitalKontaktdata.getEpost()) ? null : digitalKontaktdata.getEpost());
kontaktdataRequest.setSpraak(isBlank(digitalKontaktdata.getSpraak()) ? null : digitalKontaktdata.getSpraak());
kobleMaalformTilSpraak((RsDollyUtvidetBestilling) context.getProperty("bestilling"), kontaktdataRequest);
}

private String digdirFormatertTlfNummer(String mobil, String landkode) {
Expand All @@ -73,25 +70,4 @@ private ZonedDateTime getDato(RsDigitalKontaktdata digitalKontaktdata) {
.byDefault()
.register();
}

private static void kobleMaalformTilSpraak(RsDollyUtvidetBestilling bestilling, DigitalKontaktdata digitalKontaktdata) {

String maalform = null;

if (nonNull(bestilling.getTpsMessaging()) && isKrrMaalform(bestilling.getTpsMessaging().getSpraakKode())) {
maalform = bestilling.getTpsMessaging().getSpraakKode();
}

if (isNotBlank(maalform) && isBlank(digitalKontaktdata.getSpraak())) {

digitalKontaktdata.setSpraak(isNotBlank(maalform) ? maalform.toLowerCase() : null);
digitalKontaktdata.setSpraakOppdatert(ZonedDateTime.now());
digitalKontaktdata.setRegistrert(true);
}
}

private static boolean isKrrMaalform(String spraak) {

return isNotBlank(spraak) && Stream.of("NB", "NN", "EN", "SE").anyMatch(spraak::equalsIgnoreCase);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import ma.glasnost.orika.MapperFacade;
import no.nav.dolly.bestilling.ClientFuture;
import no.nav.dolly.bestilling.ClientRegister;
import no.nav.dolly.bestilling.personservice.PersonServiceConsumer;
Expand All @@ -15,7 +14,6 @@
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.tpsmessagingservice.v1.SpraakDTO;
import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO;
import no.nav.testnav.libs.reactivecore.utils.WebClientFilter;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -24,6 +22,8 @@
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Map;
Expand All @@ -37,7 +37,6 @@
import static no.nav.dolly.bestilling.kontoregisterservice.util.BankkontoGenerator.tilfeldigUtlandskBankkonto;
import static no.nav.dolly.errorhandling.ErrorStatusDecoder.getInfoVenter;
import static org.apache.commons.lang3.BooleanUtils.isTrue;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

@Slf4j
@Service
Expand All @@ -49,7 +48,6 @@ public class TpsMessagingClient implements ClientRegister {
private static final String TPS_MESSAGING = "TPS";

private final TpsMessagingConsumer tpsMessagingConsumer;
private final MapperFacade mapperFacade;
private final PersonServiceConsumer personServiceConsumer;
private final TransactionHelperService transactionHelperService;
private final MiljoerConsumer miljoerConsumer;
Expand Down Expand Up @@ -91,8 +89,6 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
.flatMap(this::getPersonData)
.collectList()
.flatMapMany(personer -> Flux.concat(
sendSpraakkode(bestilling, dollyPerson.getIdent())
.map(respons -> Map.of("SpråkKode", respons)),
sendBankkontonummerNorge(bestilling, dollyPerson.getIdent())
.map(respons -> Map.of("NorskBankkonto", respons)),
sendBankkontonummerUtenland(bestilling, dollyPerson.getIdent())
Expand Down Expand Up @@ -126,10 +122,7 @@ private Flux<String> getError(Throwable error, List<String> miljoer) {

private boolean isTpsMessage(RsDollyUtvidetBestilling bestilling) {

return (nonNull(bestilling.getTpsMessaging()) &&
isNotBlank(bestilling.getTpsMessaging().getSpraakKode())) ||

nonNull(bestilling.getBankkonto()) ||
return nonNull(bestilling.getBankkonto()) ||
nonNull(bestilling.getSkjerming()) ||

(nonNull(bestilling.getPdldata()) &&
Expand Down Expand Up @@ -183,17 +176,6 @@ private Flux<PdlPersonBolk.PersonBolk> getPersonData(List<String> identer) {
.filter(personBolk -> nonNull(personBolk.getPerson()));
}

private Mono<List<TpsMeldingResponseDTO>> sendSpraakkode(RsDollyUtvidetBestilling bestilling, String ident) {

return nonNull(bestilling.getTpsMessaging()) && nonNull(bestilling.getTpsMessaging().getSpraakKode()) ?

tpsMessagingConsumer.sendSpraakkodeRequest(ident, null,
mapperFacade.map(bestilling.getTpsMessaging().getSpraakKode(), SpraakDTO.class))
.collectList() :

Mono.just(emptyList());
}

private Mono<List<TpsMeldingResponseDTO>> sendEgenansattSlett(RsDollyUtvidetBestilling bestilling,
String ident) {

Expand All @@ -211,7 +193,7 @@ private Mono<List<TpsMeldingResponseDTO>> sendEgenansatt(RsDollyUtvidetBestillin
return nonNull(SkjermingUtil.getEgenansattDatoFom(bestilling)) ?

tpsMessagingConsumer.sendEgenansattRequest(ident, null,
SkjermingUtil.getEgenansattDatoFom(bestilling).toLocalDate())
toLocalDate(SkjermingUtil.getEgenansattDatoFom(bestilling)))
.collectList() :

Mono.just(emptyList());
Expand Down Expand Up @@ -257,4 +239,9 @@ private Mono<List<TpsMeldingResponseDTO>> sendBankkontonummerUtenland(RsDollyUtv
return Mono.just(emptyList());
}
}

private LocalDate toLocalDate(LocalDateTime datoOgTid) {

return nonNull(datoOgTid) ? datoOgTid.toLocalDate() : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import no.nav.testnav.libs.data.kontoregister.v1.BankkontonrNorskDTO;
import no.nav.testnav.libs.data.kontoregister.v1.BankkontonrUtlandDTO;
import no.nav.testnav.libs.data.tpsmessagingservice.v1.PersonMiljoeDTO;
import no.nav.testnav.libs.data.tpsmessagingservice.v1.SpraakDTO;
import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO;
import no.nav.testnav.libs.securitycore.domain.ServerProperties;
import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange;
Expand All @@ -32,7 +31,6 @@ public class TpsMessagingConsumer implements ConsumerStatus {
private static final String BASE_URL = "/api/v1/personer/{ident}";
private static final String UTENLANDSK_BANKKONTO_URL = BASE_URL + "/bankkonto-utenlandsk";
private static final String NORSK_BANKKONTO_URL = BASE_URL + "/bankkonto-norsk";
private static final String SPRAAKKODE_URL = BASE_URL + "/spraakkode";

private final WebClient webClient;
private final TokenExchange tokenService;
Expand Down Expand Up @@ -84,14 +82,6 @@ public Flux<TpsMeldingResponseDTO> deleteEgenansattRequest(String ident, List<St
.flatMapMany(token -> new EgenansattDeleteCommand(webClient, ident, miljoer, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = { "operation", "tps_messaging_createSpraakkode" })
public Flux<TpsMeldingResponseDTO> sendSpraakkodeRequest(String ident, List<String> miljoer, SpraakDTO body) {

return tokenService.exchange(serverProperties)
.flatMapMany(token ->
new TpsMessagingPostCommand(webClient, ident, miljoer, body, SPRAAKKODE_URL, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = { "operation", "tps_messaging_getPerson" })
public Flux<PersonMiljoeDTO> getPerson(String ident, List<String> miljoer) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RsTpsMessaging {

private String spraakKode;
@Field(type = FieldType.Date, format = DateFormat.basic_date, pattern = "uuuu-MM-dd")
private LocalDate egenAnsattDatoFom;
@Field(type = FieldType.Date, format = DateFormat.basic_date, pattern = "uuuu-MM-dd")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class BestillingTpsMessagingStatusMapper {

private static final List<String> HIDE_MILJOER = List.of("t13", "q5", "qa", "qx");
private static final List<String> HIDE_MILJOER = List.of("q5", "qa", "qx");
private static final String OKEY = "OK";
private static final String ADVARSEL = "Advarsel: ";
private static final String FEIL = "Feil: ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void createBestilling()
.thenReturn(Optional.of(new UserInfo(bruker.getBrukerId(), "", "", bruker.getBrukernavn())));

when(miljoerConsumer.getMiljoer())
.thenReturn(Mono.just(List.of("t13", "q1", "q2", "q4", "qx")));
.thenReturn(Mono.just(List.of("q1", "q2", "q4", "qx")));

Testgruppe testgruppe = Testgruppe
.builder()
Expand Down
Loading
Loading