Skip to content

Commit

Permalink
Ta imot skalhapaaminnelse fra Storebror
Browse files Browse the repository at this point in the history
  • Loading branch information
magnusae committed Oct 23, 2024
1 parent 38d4be1 commit 18c707f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ enum class Key(
EKSTERN_INNTEKTSMELDING("eksternInntektsmelding"),
ER_DUPLIKAT_IM("er_duplikat_im"),
INNSENDING_ID("innsending_id"),
SKAL_HA_PAAMINNELSE("skal_ha_paaminnelse"),
;

override fun toString(): String = str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ object Pri {
FORESPOERSEL_ID("forespoerselId"),
SPINN_INNTEKTSMELDING_ID("spinnInntektsmeldingId"),
VEDTAKSPERIODE_ID_LISTE("vedtaksperiode_id_liste"),
SKAL_HA_PAAMINNELSE("skal_ha_paaminnelse"),
;

override fun toString(): String = str
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.helsearbeidsgiver.inntektsmelding.forespoerselmottatt

import kotlinx.serialization.builtins.MapSerializer
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.json.JsonElement
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
Expand All @@ -25,6 +26,7 @@ data class Melding(
val forespoerselId: UUID,
val orgnr: Orgnr,
val fnr: Fnr,
val skalHaPaaminnelse: Boolean,
)

/** Tar imot notifikasjon om at det er kommet en forespørsel om arbeidsgiveropplysninger. */
Expand All @@ -39,6 +41,7 @@ class ForespoerselMottattRiver : PriObjectRiver<Melding>() {
forespoerselId = Pri.Key.FORESPOERSEL_ID.les(UuidSerializer, json),
orgnr = Pri.Key.ORGNR.les(Orgnr.serializer(), json),
fnr = Pri.Key.FNR.les(Fnr.serializer(), json),
skalHaPaaminnelse = Pri.Key.SKAL_HA_PAAMINNELSE.les(Boolean.serializer(), json),
)

override fun Melding.haandter(json: Map<Pri.Key, JsonElement>): Map<Key, JsonElement> {
Expand All @@ -53,6 +56,7 @@ class ForespoerselMottattRiver : PriObjectRiver<Melding>() {
Key.FORESPOERSEL_ID to forespoerselId.toJson(),
Key.ORGNRUNDERENHET to orgnr.toJson(),
Key.FNR to fnr.toJson(),
Key.SKAL_HA_PAAMINNELSE to skalHaPaaminnelse.toJson(Boolean.serializer()),
).toJson(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import io.kotest.matchers.maps.shouldContainKey
import io.mockk.clearAllMocks
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.json.JsonElement
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
Expand Down Expand Up @@ -50,6 +51,7 @@ class ForespoerselMottattRiverTest :
Key.FORESPOERSEL_ID to innkommendeMelding.forespoerselId.toJson(),
Key.ORGNRUNDERENHET to innkommendeMelding.orgnr.toJson(),
Key.FNR to innkommendeMelding.fnr.toJson(),
Key.SKAL_HA_PAAMINNELSE to innkommendeMelding.skalHaPaaminnelse.toJson(Boolean.serializer()),
).toJson(),
)
}
Expand All @@ -62,6 +64,7 @@ private fun mockInnkommendeMelding(): Melding =
forespoerselId = UUID.randomUUID(),
orgnr = Orgnr.genererGyldig(),
fnr = Fnr.genererGyldig(),
skalHaPaaminnelse = true,
)

private fun Melding.toMap(): Map<Pri.Key, JsonElement> =
Expand All @@ -70,4 +73,5 @@ private fun Melding.toMap(): Map<Pri.Key, JsonElement> =
Pri.Key.FORESPOERSEL_ID to forespoerselId.toJson(),
Pri.Key.ORGNR to orgnr.toJson(),
Pri.Key.FNR to fnr.toJson(),
Pri.Key.SKAL_HA_PAAMINNELSE to skalHaPaaminnelse.toJson(Boolean.serializer()),
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.helsearbeidsgiver.inntektsmelding.notifikasjon

import com.github.navikt.tbd_libs.rapids_and_rivers_api.RapidsConnection
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.json.JsonElement
import no.nav.helsearbeidsgiver.felles.BehovType
import no.nav.helsearbeidsgiver.felles.EventName
Expand Down Expand Up @@ -73,7 +74,7 @@ class HentDataTilSakOgOppgaveService(
sikkerLogger.info(it)
}

// Brukes midlertidig til å lagre forspørsel, til tabellen fjernes
// Brukes midlertidig til å lagre forespørsel, til tabellen fjernes
rapid.publish(
Key.EVENT_NAME to eventName.toJson(),
Key.BEHOV to BehovType.LAGRE_FORESPOERSEL.toJson(BehovType.serializer()),
Expand Down Expand Up @@ -160,6 +161,7 @@ class HentDataTilSakOgOppgaveService(
Key.ORGNRUNDERENHET to steg0.orgnr.toJson(),
Key.SYKMELDT to sykmeldt.toJson(Person.serializer()),
Key.VIRKSOMHET to orgNavn.toJson(),
Key.SKAL_HA_PAAMINNELSE to false.toJson(Boolean.serializer()), // TODO: Erstatt default false med SKAL_HA_PAAMINNELSE fra melding
).toJson(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.maps.shouldContainExactly
import io.kotest.matchers.shouldBe
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonObject
import no.nav.helsearbeidsgiver.felles.BehovType
Expand Down Expand Up @@ -103,6 +104,7 @@ class HentDataTilSakOgOppgaveServiceTest :
Mock.orgnrMedNavn.values
.first()
.toJson(),
Key.SKAL_HA_PAAMINNELSE to Mock.skalHaPaaminnelse.toJson(Boolean.serializer()),
).toJson(),
)
}
Expand Down Expand Up @@ -141,6 +143,7 @@ private object Mock {
val fnr = Fnr.genererGyldig()
val orgnrMedNavn = mapOf(orgnr to "Kåre Conradis Kål og Kålrabi")
val personer = mapOf(fnr to Person(fnr, "Kåre Conradi", 22.april))
val skalHaPaaminnelse = false // TODO: Bytt ut default false

fun steg0(): Map<Key, JsonElement> =
mapOf(
Expand Down

0 comments on commit 18c707f

Please sign in to comment.