Skip to content

Commit

Permalink
videre send forespørsel til opprett oppgave og sak
Browse files Browse the repository at this point in the history
Co-authored-by: Magnus Sælensminde <magnus.selensminde@nav.no>
  • Loading branch information
b162214 and magnusae committed Oct 30, 2024
1 parent 486bbce commit f6dbd75
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ import kotlinx.serialization.json.JsonElement
import no.nav.helsearbeidsgiver.felles.BehovType
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.domene.Forespoersel
import no.nav.helsearbeidsgiver.felles.domene.Person
import no.nav.helsearbeidsgiver.felles.json.les
import no.nav.helsearbeidsgiver.felles.json.lesOrNull
import no.nav.helsearbeidsgiver.felles.json.orgMapSerializer
import no.nav.helsearbeidsgiver.felles.json.personMapSerializer
import no.nav.helsearbeidsgiver.felles.json.toJson
import no.nav.helsearbeidsgiver.felles.rapidsrivers.model.Fail
import no.nav.helsearbeidsgiver.felles.rapidsrivers.publish
import no.nav.helsearbeidsgiver.felles.rapidsrivers.service.ServiceMed2Steg
import no.nav.helsearbeidsgiver.felles.utils.Log
import no.nav.helsearbeidsgiver.utils.collection.mapValuesNotNull
import no.nav.helsearbeidsgiver.utils.json.serializer.UuidSerializer
import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.log.logger
Expand All @@ -29,6 +32,7 @@ data class Steg0(
val orgnr: Orgnr,
val fnr: Fnr,
val skalHaPaaminnelse: Boolean,
val forespoersel: Forespoersel?,
)

data class Steg1(
Expand All @@ -54,6 +58,7 @@ class HentDataTilSakOgOppgaveService(
orgnr = Key.ORGNRUNDERENHET.les(Orgnr.serializer(), melding),
fnr = Key.FNR.les(Fnr.serializer(), melding),
skalHaPaaminnelse = Key.SKAL_HA_PAAMINNELSE.les(Boolean.serializer(), melding),
forespoersel = Key.FORESPOERSEL.lesOrNull(Forespoersel.serializer(), melding),
)

override fun lesSteg1(melding: Map<Key, JsonElement>): Steg1 =
Expand Down Expand Up @@ -137,7 +142,9 @@ class HentDataTilSakOgOppgaveService(
Key.SYKMELDT to sykmeldt.toJson(Person.serializer()),
Key.VIRKSOMHET to orgNavn.toJson(),
Key.SKAL_HA_PAAMINNELSE to steg0.skalHaPaaminnelse.toJson(Boolean.serializer()),
).toJson(),
Key.FORESPOERSEL to steg0.forespoersel?.toJson(Forespoersel.serializer()),
).mapValuesNotNull { it }
.toJson(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import kotlinx.serialization.json.JsonObject
import no.nav.helsearbeidsgiver.felles.BehovType
import no.nav.helsearbeidsgiver.felles.EventName
import no.nav.helsearbeidsgiver.felles.Key
import no.nav.helsearbeidsgiver.felles.domene.Forespoersel
import no.nav.helsearbeidsgiver.felles.domene.Person
import no.nav.helsearbeidsgiver.felles.json.orgMapSerializer
import no.nav.helsearbeidsgiver.felles.json.personMapSerializer
Expand All @@ -20,11 +21,11 @@ import no.nav.helsearbeidsgiver.felles.rapidsrivers.model.Fail
import no.nav.helsearbeidsgiver.felles.rapidsrivers.service.ServiceRiverStateless
import no.nav.helsearbeidsgiver.felles.test.json.lesBehov
import no.nav.helsearbeidsgiver.felles.test.json.plusData
import no.nav.helsearbeidsgiver.felles.test.mock.mockForespoersel
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.firstMessage
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.message
import no.nav.helsearbeidsgiver.felles.test.rapidsrivers.sendJson
import no.nav.helsearbeidsgiver.utils.json.toJson
import no.nav.helsearbeidsgiver.utils.test.wrapper.genererGyldig
import no.nav.helsearbeidsgiver.utils.wrapper.Fnr
import no.nav.helsearbeidsgiver.utils.wrapper.Orgnr
import java.util.UUID
Expand Down Expand Up @@ -74,6 +75,7 @@ class HentDataTilSakOgOppgaveServiceTest :
.first()
.toJson(),
Key.SKAL_HA_PAAMINNELSE to Mock.SKAL_HA_PAAMINNELSE.toJson(Boolean.serializer()),
Key.FORESPOERSEL to Mock.forespoersel.toJson(Forespoersel.serializer()),
).toJson(),
)
}
Expand Down Expand Up @@ -107,10 +109,11 @@ class HentDataTilSakOgOppgaveServiceTest :

private object Mock {
const val SKAL_HA_PAAMINNELSE = true
val transaksjonId: UUID = UUID.randomUUID()
val forespoersel = mockForespoersel()
val transaksjonId: UUID = forespoersel.vedtaksperiodeId
val forespoerselId: UUID = UUID.randomUUID()
val orgnr = Orgnr.genererGyldig()
val fnr = Fnr.genererGyldig()
val orgnr = Orgnr(forespoersel.orgnr)
val fnr = Fnr(forespoersel.fnr)
val orgnrMedNavn = mapOf(orgnr to "Kåre Conradis Kål og Kålrabi")
val personer = mapOf(fnr to Person(fnr, "Kåre Conradi"))

Expand All @@ -124,6 +127,7 @@ private object Mock {
Key.ORGNRUNDERENHET to orgnr.toJson(),
Key.FNR to fnr.toJson(),
Key.SKAL_HA_PAAMINNELSE to SKAL_HA_PAAMINNELSE.toJson(Boolean.serializer()),
Key.FORESPOERSEL to forespoersel.toJson(Forespoersel.serializer()),
).toJson(),
)

Expand Down

0 comments on commit f6dbd75

Please sign in to comment.