Skip to content

Commit

Permalink
Fjern forventing om identer i meldinga
Browse files Browse the repository at this point in the history
Co-authored-by: Tonje Mjøvik Myran <tonje.mjovik.myran@nav.no>
Co-authored-by: Eivind Havnelid Røyrvik <eivind.havnelid.royrvik@nav.no>
Co-authored-by: Mette Wendy Lindberg Gulbrandsen <mette.wendy.lindberg.gulbrandsen@nav.no>
  • Loading branch information
4 people committed Dec 10, 2024
1 parent 85f80ad commit fac6c36
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import mu.withLoggingContext
import no.nav.dagpenger.inntekt.v1.Inntekt
import no.nav.dagpenger.oppslag.inntekt.InntektClient
import no.nav.dagpenger.oppslag.inntekt.asUUID
import no.nav.dagpenger.oppslag.inntekt.fodselsnummer
import no.nav.dagpenger.oppslag.inntekt.harAktørEllerFnr
import java.time.LocalDate
import java.time.YearMonth

Expand All @@ -40,12 +38,7 @@ internal class InntektNesteMånedService(
validate {
it.forbid("@løsning")
it.requireKey("@id", "@behovId")
it.requireArray("identer") {
requireKey("type", "historisk", "id")
}
it.require("identer", ::harAktørEllerFnr)
it.requireKey("Virkningstidspunkt")
it.interestedIn("ident")
it.requireKey("Virkningstidspunkt", "ident")
it.interestedIn("avklaringId", "behandlingId")
}
}.register(this)
Expand All @@ -71,24 +64,22 @@ internal class InntektNesteMånedService(
runBlocking {
inntektClient.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = packet.fodselsnummer(),
fødselsnummer = packet["ident"].asText(),
virkningsTidspunkt = inntektsrapporteringsperiode.neste().fom(),
callId = callId,
)
}
val løsning =
packet["@behov"]
.map { it.asText() }
.filter { it in løserBehov }
.map { behov ->
behov to
when (behov) {
"HarRapportertInntektNesteMåned" ->
inntekt.harInntektFor(inntektsrapporteringsperiode.fom())
.filter { it in løserBehov }.associateWith { behov ->
when (behov) {
"HarRapportertInntektNesteMåned" ->
inntekt.harInntektFor(inntektsrapporteringsperiode.fom())

else -> throw IllegalArgumentException("Ukjent behov $behov")
}
}.toMap()
else -> throw IllegalArgumentException("Ukjent behov $behov")
}
}

packet["@løsning"] = løsning
log.info { "Løst behov $løserBehov" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import no.nav.dagpenger.inntekt.v1.Inntekt
import no.nav.dagpenger.inntekt.v1.InntektKlasse
import no.nav.dagpenger.oppslag.inntekt.InntektClient
import no.nav.dagpenger.oppslag.inntekt.asUUID
import no.nav.dagpenger.oppslag.inntekt.fodselsnummer
import no.nav.dagpenger.oppslag.inntekt.harAktørEllerFnr

internal class SykepengerLøsningService(
rapidsConnection: RapidsConnection,
Expand All @@ -32,12 +30,7 @@ internal class SykepengerLøsningService(

it.forbid("@løsning")
it.requireKey("@id", "@behovId")
it.requireArray("identer") {
requireKey("type", "historisk", "id")
}
it.require("identer", ::harAktørEllerFnr)
it.requireKey("Virkningstidspunkt")
it.interestedIn("ident")
it.requireKey("Virkningstidspunkt", "ident")
it.interestedIn("avklaringId", "behandlingId")
}
}.register(this)
Expand Down Expand Up @@ -71,7 +64,7 @@ internal class SykepengerLøsningService(
runBlocking {
inntektClient.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = packet.fodselsnummer(),
fødselsnummer = packet["ident"].asText(),
virkningsTidspunkt = packet["Virkningstidspunkt"].asLocalDate(),
callId = callId,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ internal class InntektNesteMånedServiceTest {
assertEquals(true, testRapid.inspektør.message(0)["@løsning"]["HarRapportertInntektNesteMåned"].asBoolean())
}

@Test
fun `skal droppe behov hvor aktørid mangler`() {
InntektNesteMånedService(testRapid, mockk())
testRapid.sendTestMessage(behovUtenIdent)
assertEquals(0, testRapid.inspektør.size)
}

// language=JSON
private val behovForInntektNesteMåned =
"""
Expand All @@ -85,7 +78,6 @@ internal class InntektNesteMånedServiceTest {
"Virkningstidspunkt": "2021-05-06",
"behandlingId" : "$behandlingId",
"ident" : "12345678911",
"identer":[{"id":"32542134","type":"aktørid","historisk":false},{"id":"32542134","type":"folkeregisterident","historisk":false}],
"FangstOgFiske": false,
"fakta": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ internal class SykepengerLøsningServiceTest {
"Virkningstidspunkt": "2020-11-18",
"behandlingId": "$behandlingId",
"ident" : "12345678911",
"identer":[{"id":"32542134","type":"aktørid","historisk":false}, {"id":"32542134","type":"folkeregisterident","historisk":false}],
"FangstOgFiskeInntektSiste36mnd": false,
"fakta": [
{
Expand Down

0 comments on commit fac6c36

Please sign in to comment.