Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lagt til midlertidlig SPINN_INNTEKTSMELDING_ID_V2 key #792

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Måtte gjøre dette for å unngå "Cannot merge due to merge conflicts" feil

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