Skip to content

Commit

Permalink
Lagt til midlertidlig SPINN_INNTEKTSMELDING_ID_V2 key (#792)
Browse files Browse the repository at this point in the history
* Lagt til midlertidlig SPINN_INNTEKTSMELDING_ID_V2 key

* lagt til logging av pri-topic melding

* endret navn på variabel key til ORGNR_UNDERENHET

* merget endringer fra main
  • Loading branch information
Jesper-Hustad authored Nov 26, 2024
1 parent ed918d9 commit 49f4860
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
**/build
out
.DS_Store
.kotlin
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TilgangRiver(
behovType = Key.BEHOV.krev(BehovType.TILGANGSKONTROLL, BehovType.serializer(), json),
transaksjonId = Key.KONTEKST_ID.les(UuidSerializer, json),
data = data,
orgnr = Key.ORGNRUNDERENHET.les(Orgnr.serializer(), data),
orgnr = Key.ORGNR_UNDERENHET.les(Orgnr.serializer(), data),
fnr = Key.FNR.les(Fnr.serializer(), data),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private object MockTilgang {
transaksjonId = UUID.randomUUID(),
data =
mapOf(
Key.ORGNRUNDERENHET to orgnr.toJson(Orgnr.serializer()),
Key.ORGNR_UNDERENHET to orgnr.toJson(Orgnr.serializer()),
Key.FNR to fnr.toJson(Fnr.serializer()),
),
orgnr = orgnr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TilgangProducer(
EventName.TILGANG_ORG_REQUESTED,
transaksjonId,
fnr,
Key.ORGNRUNDERENHET to orgnr.toJson(),
Key.ORGNR_UNDERENHET to orgnr.toJson(),
)

private fun publish(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class InntektSelvbestemtProducer(
Key.DATA to
mapOf(
Key.FNR to request.sykmeldtFnr.toJson(),
Key.ORGNRUNDERENHET to request.orgnr.toJson(),
Key.ORGNR_UNDERENHET to request.orgnr.toJson(),
Key.INNTEKTSDATO to request.inntektsdato.toJson(),
).toJson(),
).also { json ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class InntektSelvbestemtProducerTest :
Key.DATA to
mapOf(
Key.FNR to sykmeldtFnr.toJson(),
Key.ORGNRUNDERENHET to orgnr.toJson(),
Key.ORGNR_UNDERENHET to orgnr.toJson(),
Key.INNTEKTSDATO to inntektsdato.toJson(),
).toJson(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ enum class Key(
VEDTAKSPERIODE_ID_LISTE("vedtaksperiode_id_liste"),
VIRKSOMHET("virksomhet"),
VIRKSOMHETER("virksomheter"),
ORGNRUNDERENHET("orgnr_underenhet"),
ORGNR_UNDERENHET("orgnr_underenhet"),

// ulik formattering
SPINN_INNTEKTSMELDING_ID("spinnInntektsmeldingId"),
SPINN_INNTEKTSMELDING_ID_V2("spinn_inntektsmelding_id"),

;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RedisStoreTest :
"$keyPrefix#$transaksjonId" to "\"mango\"",
"$keyPrefix#$transaksjonId#${Key.SAK_ID}#feil" to "\"papaya\"",
"$keyPrefix#$transaksjonId#${Key.FNR}" to "\"ananas\"",
"$keyPrefix#$transaksjonId#${Key.ORGNRUNDERENHET}" to "\"kokosnøtt\"",
"$keyPrefix#$transaksjonId#${Key.ORGNR_UNDERENHET}" to "\"kokosnøtt\"",
"$keyPrefix#$transaksjonId#${Key.TILGANG}" to null,
),
),
Expand All @@ -42,7 +42,7 @@ class RedisStoreTest :
redisStore.lesAlleMellomlagrede(transaksjonId) shouldContainExactly
mapOf(
Key.FNR to "ananas".toJson(),
Key.ORGNRUNDERENHET to "kokosnøtt".toJson(),
Key.ORGNR_UNDERENHET to "kokosnøtt".toJson(),
)
}

Expand All @@ -60,7 +60,7 @@ class RedisStoreTest :
"${Key.FNR}" to "\"bringebær\"",
"$transaksjonId#${Key.FNR}" to "\"blåbær\"",
"$keyPrefix#$transaksjonId#ikkeEnKey" to "\"tyttebær\"",
"$keyPrefix#$transaksjonId#${Key.ORGNRUNDERENHET}" to "\"kokosnøtt\"",
"$keyPrefix#$transaksjonId#${Key.ORGNR_UNDERENHET}" to "\"kokosnøtt\"",
),
),
keyPrefix = keyPrefix,
Expand All @@ -70,7 +70,7 @@ class RedisStoreTest :

redisStore.lesAlleMellomlagrede(transaksjonId) shouldContainExactly
mapOf(
Key.ORGNRUNDERENHET to "kokosnøtt".toJson(),
Key.ORGNR_UNDERENHET to "kokosnøtt".toJson(),
)
}

Expand All @@ -85,7 +85,7 @@ class RedisStoreTest :
mockStorageInit =
mapOf(
"$keyPrefix#$transaksjonId#${Key.FNR}" to "\"ananas\"",
"$keyPrefix#$transaksjonId#${Key.ORGNRUNDERENHET}" to "streng uten ekstra fnutter",
"$keyPrefix#$transaksjonId#${Key.ORGNR_UNDERENHET}" to "streng uten ekstra fnutter",
"$keyPrefix#$transaksjonId#${Key.PERSONER}" to "{true}",
"$keyPrefix#$transaksjonId#${Key.VIRKSOMHETER}" to "]]42[[",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,21 @@ class ForespoerselBesvartRiver : PriObjectRiver<BesvartMelding>() {

Metrics.forespoerslerBesvartFraSpleis.inc()

return mapOf(
Key.EVENT_NAME to EventName.FORESPOERSEL_BESVART.toJson(),
Key.KONTEKST_ID to transaksjonId.toJson(),
Key.DATA to
mapOf(
Key.FORESPOERSEL_ID to forespoerselId.toJson(),
Key.SPINN_INNTEKTSMELDING_ID to spinnInntektsmeldingId?.toJson(),
).mapValuesNotNull { it }
.toJson(),
)
val resultat =
mapOf(
Key.EVENT_NAME to EventName.FORESPOERSEL_BESVART.toJson(),
Key.KONTEKST_ID to transaksjonId.toJson(),
Key.DATA to
mapOf(
Key.FORESPOERSEL_ID to forespoerselId.toJson(),
Key.SPINN_INNTEKTSMELDING_ID to spinnInntektsmeldingId?.toJson(),
Key.SPINN_INNTEKTSMELDING_ID_V2 to spinnInntektsmeldingId?.toJson(),
).mapValuesNotNull { it }
.toJson(),
)
logger.info("Sendt en melding fra pri-topic.")
sikkerLogger.info("Sendt en melding fra pri-topic:\n${resultat.toJson()}")
return resultat
}

override fun BesvartMelding.haandterFeil(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class ForespoerselBesvartRiverTest :
mapOf(
Key.FORESPOERSEL_ID to forespoerselId.toJson(),
Key.SPINN_INNTEKTSMELDING_ID to spinnInntektsmeldingId.toJson(),
Key.SPINN_INNTEKTSMELDING_ID_V2 to spinnInntektsmeldingId.toJson(),
).toJson(),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class InntektSelvbestemtService(
override fun lesSteg0(melding: Map<Key, JsonElement>): Steg0 =
Steg0(
transaksjonId = Key.KONTEKST_ID.les(UuidSerializer, melding),
orgnr = Key.ORGNRUNDERENHET.les(Orgnr.serializer(), melding),
orgnr = Key.ORGNR_UNDERENHET.les(Orgnr.serializer(), melding),
sykmeldtFnr = Key.FNR.les(Fnr.serializer(), melding),
inntektsdato = Key.INNTEKTSDATO.les(LocalDateSerializer, melding),
)
Expand All @@ -74,7 +74,7 @@ class InntektSelvbestemtService(
data
.plus(
mapOf(
Key.ORGNRUNDERENHET to steg0.orgnr.toJson(),
Key.ORGNR_UNDERENHET to steg0.orgnr.toJson(),
Key.FNR to steg0.sykmeldtFnr.toJson(),
Key.INNTEKTSDATO to steg0.inntektsdato.toJson(),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private object Mock {

val steg0Data =
mapOf(
Key.ORGNRUNDERENHET to Orgnr.genererGyldig().toJson(),
Key.ORGNR_UNDERENHET to Orgnr.genererGyldig().toJson(),
Key.FNR to Fnr.genererGyldig().toJson(),
Key.INNTEKTSDATO to 14.april.toJson(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class HentInntektRiver(
behovType = Key.BEHOV.krev(BehovType.HENT_INNTEKT, BehovType.serializer(), json),
transaksjonId = Key.KONTEKST_ID.les(UuidSerializer, json),
data = data,
orgnr = Key.ORGNRUNDERENHET.les(Orgnr.serializer(), data),
orgnr = Key.ORGNR_UNDERENHET.les(Orgnr.serializer(), data),
fnr = Key.FNR.les(Fnr.serializer(), data),
inntektsdato = Key.INNTEKTSDATO.les(LocalDateSerializer, data),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private object Mock {
transaksjonId = UUID.randomUUID(),
data =
mapOf(
Key.ORGNRUNDERENHET to orgnr.toJson(),
Key.ORGNR_UNDERENHET to orgnr.toJson(),
Key.FNR to fnr.toJson(),
Key.INNTEKTSDATO to inntektsdato.toJson(),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class InntektService(
data
.plus(
mapOf(
Key.ORGNRUNDERENHET to steg1.forespoersel.orgnr.toJson(),
Key.ORGNR_UNDERENHET to steg1.forespoersel.orgnr.toJson(),
Key.FNR to steg1.forespoersel.fnr.toJson(),
Key.INNTEKTSDATO to steg0.skjaeringstidspunkt.toJson(),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class InntektSelvbestemtIT : EndToEndTest() {
Key.DATA to
mapOf(
Key.FNR to Mock.fnr.toJson(),
Key.ORGNRUNDERENHET to Mock.orgnr.toJson(),
Key.ORGNR_UNDERENHET to Mock.orgnr.toJson(),
Key.INNTEKTSDATO to Mock.inntektsdato.toJson(),
).toJson(),
)
Expand All @@ -49,7 +49,7 @@ class InntektSelvbestemtIT : EndToEndTest() {
Key.KONTEKST_ID to Mock.transaksjonId.toJson(),
Key.DATA to
mapOf(
Key.ORGNRUNDERENHET to Mock.orgnr.toJson(),
Key.ORGNR_UNDERENHET to Mock.orgnr.toJson(),
Key.FNR to Mock.fnr.toJson(),
Key.INNTEKTSDATO to Mock.inntektsdato.toJson(),
).toJson(),
Expand All @@ -65,7 +65,7 @@ class InntektSelvbestemtIT : EndToEndTest() {
Key.KONTEKST_ID to Mock.transaksjonId.toJson(),
Key.DATA to
mapOf(
Key.ORGNRUNDERENHET to Mock.orgnr.toJson(),
Key.ORGNR_UNDERENHET to Mock.orgnr.toJson(),
Key.FNR to Mock.fnr.toJson(),
Key.INNTEKTSDATO to Mock.inntektsdato.toJson(),
Key.INNTEKT to Mock.inntektPerMaaned.toJson(Inntekt.serializer()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class TilgangForespoerselService(
data
.plus(
mapOf(
Key.ORGNRUNDERENHET to steg1.forespoersel.orgnr.toJson(),
Key.ORGNR_UNDERENHET to steg1.forespoersel.orgnr.toJson(),
Key.FNR to steg0.avsenderFnr.toJson(),
),
).toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TilgangOrgService(
override fun lesSteg0(melding: Map<Key, JsonElement>): Steg0 =
Steg0(
transaksjonId = Key.KONTEKST_ID.les(UuidSerializer, melding),
orgnr = Key.ORGNRUNDERENHET.les(Orgnr.serializer(), melding),
orgnr = Key.ORGNR_UNDERENHET.les(Orgnr.serializer(), melding),
fnr = Key.FNR.les(Fnr.serializer(), melding),
)

Expand All @@ -70,7 +70,7 @@ class TilgangOrgService(
data
.plus(
mapOf(
Key.ORGNRUNDERENHET to steg0.orgnr.toJson(),
Key.ORGNR_UNDERENHET to steg0.orgnr.toJson(),
Key.FNR to steg0.fnr.toJson(),
),
).toJson(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class HentForespoerselService(
Key.DATA to
mapOf(
Key.FORESPOERSEL_ID to steg0.forespoerselId.toJson(),
Key.ORGNRUNDERENHET to steg1.forespoersel.orgnr.toJson(),
Key.ORGNR_UNDERENHET to steg1.forespoersel.orgnr.toJson(),
Key.FNR to steg1.forespoersel.fnr.toJson(),
Key.INNTEKTSDATO to inntektsdato.toJson(),
).toJson(),
Expand Down

0 comments on commit 49f4860

Please sign in to comment.