Skip to content

Commit

Permalink
Steg 2.2 - Fjerne minstinntekt og eksisterende saker fra mediator og …
Browse files Browse the repository at this point in the history
  • Loading branch information
geiralund committed Apr 26, 2024
1 parent bcb37c5 commit 6e27b7a
Show file tree
Hide file tree
Showing 22 changed files with 8 additions and 900 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ import no.nav.dagpenger.mottak.behov.saksbehandling.arena.ArenaApiClient
import no.nav.dagpenger.mottak.behov.saksbehandling.arena.ArenaBehovLøser
import no.nav.dagpenger.mottak.behov.saksbehandling.gosys.GosysProxyClient
import no.nav.dagpenger.mottak.behov.saksbehandling.gosys.OpprettGosysOppgaveLøser
import no.nav.dagpenger.mottak.behov.vilkårtester.MinsteinntektVurderingLøser
import no.nav.dagpenger.mottak.behov.vilkårtester.RegelApiHttpClient
import no.nav.dagpenger.mottak.db.InnsendingPostgresRepository
import no.nav.dagpenger.mottak.db.MinsteinntektVurderingPostgresRepository
import no.nav.dagpenger.mottak.db.PostgresDataSourceBuilder
import no.nav.dagpenger.mottak.observers.FerdigstiltInnsendingObserver
import no.nav.dagpenger.mottak.observers.InnsendingProbe
Expand All @@ -36,12 +33,9 @@ private val logg = KotlinLogging.logger {}
internal class ApplicationBuilder(env: Map<String, String>) : RapidsConnection.StatusListener {
private val innsendingRepository = InnsendingPostgresRepository(PostgresDataSourceBuilder.dataSource)
private val safClient = SafClient(Config.properties)
private val regelApiClient = RegelApiHttpClient(Config.properties)
private val arenaApiClient = ArenaApiClient(Config.properties)
private val journalpostApiClient = JournalpostApiClient(tokenProvider = Config.properties.dokarkivTokenProvider)
private val gosysProxyClient = GosysProxyClient(Config.properties)
private val minsteinntektVurderingRepository =
MinsteinntektVurderingPostgresRepository(PostgresDataSourceBuilder.dataSource)
private val ferdigstiltInnsendingObserver = FerdigstiltInnsendingObserver(Config.kafkaProducerProperties)

private val rapidsConnection =
Expand Down Expand Up @@ -80,11 +74,6 @@ internal class ApplicationBuilder(env: Map<String, String>) : RapidsConnection.S
this,
)
SøknadsdataBehovLøser(safClient, this)
MinsteinntektVurderingLøser(
regelApiClient = regelApiClient,
repository = minsteinntektVurderingRepository,
rapidsConnection = this,
)
ArenaBehovLøser(arenaApiClient, this)
OpprettGosysOppgaveLøser(gosysProxyClient, this)

Expand Down
6 changes: 0 additions & 6 deletions mediator/src/main/kotlin/no/nav/dagpenger/mottak/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ internal object Config {
"DB_PORT" to "5432",
"DB_USERNAME" to "username",
"DP_PROXY_SCOPE" to "api://dev-fss.teamdagpenger.dp-proxy/.default",
"DP_REGEL_API_SCOPE" to "api://dev-gcp.teamdagpenger.dp-regel-api/.default",
"DP_REGEL_API_URL" to "http://dp-regel-api.teamdagpenger",
"HTTP_PORT" to "8080",
"KAFKA_CONSUMER_GROUP_ID" to "dp-mottak-v1",
"KAFKA_EXTRA_TOPIC" to "teamdagpenger.mottak.v1,teamdagpenger.regel.v1",
Expand All @@ -50,8 +48,6 @@ internal object Config {
"DOKARKIV_SCOPE" to "api://prod-fss.teamdokumenthandtering.dokarkiv/.default",
"DOKARKIV_INGRESS" to "dokarkiv.prod-fss-pub.nais.io",
"DP_PROXY_SCOPE" to "api://prod-fss.teamdagpenger.dp-proxy/.default",
"DP_REGEL_API_SCOPE" to "api://prod-gcp.teamdagpenger.dp-regel-api/.default",
"PDL_API_SCOPE" to "api://prod-fss.pdl.pdl-api/.default",
"SKJERMING_API_SCOPE" to "api://prod-gcp.nom.skjermede-personer-pip/.default",
),
)
Expand Down Expand Up @@ -127,8 +123,6 @@ internal object Config {

fun Configuration.dpProxyUrl() = this[Key("DP_PROXY_HOST", stringType)].addHttprotocoll()

fun Configuration.dpRegelApiUrl() = this[Key("DP_REGEL_API_URL", stringType)]

fun Configuration.pdlApiUrl() = this[Key("PDL_API_HOST", stringType)].addHttprotocoll()

fun asMap(): Map<String, String> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import mu.KotlinLogging
import no.nav.dagpenger.mottak.db.InnsendingRepository
import no.nav.dagpenger.mottak.meldinger.ArenaOppgaveFeilet
import no.nav.dagpenger.mottak.meldinger.ArenaOppgaveOpprettet
import no.nav.dagpenger.mottak.meldinger.Eksisterendesaker
import no.nav.dagpenger.mottak.meldinger.GosysOppgaveOpprettet
import no.nav.dagpenger.mottak.meldinger.JoarkHendelse
import no.nav.dagpenger.mottak.meldinger.Journalpost
import no.nav.dagpenger.mottak.meldinger.JournalpostFerdigstilt
import no.nav.dagpenger.mottak.meldinger.JournalpostOppdatert
import no.nav.dagpenger.mottak.meldinger.MinsteinntektArbeidsinntektVurdert
import no.nav.dagpenger.mottak.meldinger.PersonInformasjon
import no.nav.dagpenger.mottak.meldinger.PersonInformasjonIkkeFunnet
import no.nav.dagpenger.mottak.meldinger.søknadsdata.Søknadsdata
Expand Down Expand Up @@ -55,18 +53,6 @@ internal class InnsendingMediator(
}
}

fun håndter(minsteinntektVurdering: MinsteinntektArbeidsinntektVurdert) {
håndter(minsteinntektVurdering) { innsending ->
innsending.håndter(minsteinntektVurdering)
}
}

fun håndter(eksisterendeSaker: Eksisterendesaker) {
håndter(eksisterendeSaker) { innsending ->
innsending.håndter(eksisterendeSaker)
}
}

fun håndter(oppgaveOpprettet: GosysOppgaveOpprettet) {
håndter(oppgaveOpprettet) { innsending ->
innsending.håndter(oppgaveOpprettet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import java.time.Duration
import java.time.LocalDate

internal interface ArenaOppslag {
suspend fun harEksisterendeSaker(fnr: String): Boolean

suspend fun opprettStartVedtakOppgave(
journalpostId: String,
parametere: OpprettArenaOppgaveParametere,
Expand Down Expand Up @@ -58,17 +56,6 @@ internal class ArenaApiClient(config: Configuration) : ArenaOppslag {
}
}

override suspend fun harEksisterendeSaker(fnr: String): Boolean {
sikkerlogg.info { "Forsøker å hente eksisterende saker fra arena for fnr $fnr" }
return proxyArenaClient.request("$baseUrl/sak/aktiv") {
header(HttpHeaders.Authorization, "Bearer ${tokenProvider.invoke()}")
header(HttpHeaders.ContentType, "application/json")
header(HttpHeaders.Accept, "application/json")
method = HttpMethod.Post
setBody(AktivSakRequest(fnr))
}.body<AktivSakResponse>().harAktivSak
}

override suspend fun opprettStartVedtakOppgave(
journalpostId: String,
parametere: OpprettArenaOppgaveParametere,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,9 @@ import no.nav.helse.rapids_rivers.withMDC

internal class ArenaBehovLøser(arenaOppslag: ArenaOppslag, rapidsConnection: RapidsConnection) {
init {
EksisterendeSakerBehovLøser(arenaOppslag, rapidsConnection)
OpprettArenaOppgaveBehovLøser(arenaOppslag, rapidsConnection)
}

private class EksisterendeSakerBehovLøser(
private val arenaOppslag: ArenaOppslag,
rapidsConnection: RapidsConnection,
) : River.PacketListener {
companion object {
private val logger = KotlinLogging.logger { }
}

init {
River(rapidsConnection).apply {
validate { it.demandValue("@event_name", "behov") }
validate { it.demandAllOrAny("@behov", listOf("EksisterendeSaker")) }
validate { it.rejectKey("@løsning") }
validate { it.requireKey("@behovId", "journalpostId") }
validate { it.requireKey("fnr") }
}.register(this)
}

override fun onPacket(
packet: JsonMessage,
context: MessageContext,
) {
val journalpostId = packet["journalpostId"].asText()
val behovId = packet["@behovId"].asText()

withMDC(
mapOf(
"behovId" to behovId,
"journalpostId" to journalpostId,
),
) {
try {
runBlocking(MDCContext()) {
arenaOppslag.harEksisterendeSaker(packet["fnr"].asText()).also {
packet["@løsning"] = mapOf("EksisterendeSaker" to mapOf("harEksisterendeSak" to it))
context.publish(packet.toJson())
}
}
} catch (e: Exception) {
logger.info { "Kunne ikke hente eksisterende saker for søknad med journalpostId $journalpostId" }
throw e
}
}
}
}

private class OpprettArenaOppgaveBehovLøser(
private val arenaOppslag: ArenaOppslag,
rapidsConnection: RapidsConnection,
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6e27b7a

Please sign in to comment.