Skip to content

Commit

Permalink
🏦Migrering som logger annulleringer som ikke er overført til oppdrag
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Maximilian Forsman <[email protected]>
  • Loading branch information
amalieem and fraadsbrandth committed Jan 22, 2024
1 parent 32b1eca commit 1718ddb
Show file tree
Hide file tree
Showing 5 changed files with 1,160 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ import no.nav.helse.serde.migration.V281ForkasteAvsluttedePerioderMedUberegnetGe
import no.nav.helse.serde.migration.V282HengendeRevurderinger
import no.nav.helse.serde.migration.V283BeregningsgrunnlagPåØkonomi
import no.nav.helse.serde.migration.V284GjelderPeriodeArbeidsgiverInntektsopplysning
import no.nav.helse.serde.migration.V285LoggeRareAnnulleringer
import no.nav.helse.serde.migration.V28HendelsesIderPåVedtaksperiode
import no.nav.helse.serde.migration.V29LeggerTilInntektsKildeType
import no.nav.helse.serde.migration.V2Medlemskapstatus
Expand Down Expand Up @@ -577,7 +578,8 @@ class SerialisertPerson(val json: String) {
V281ForkasteAvsluttedePerioderMedUberegnetGenerasjon(),
V282HengendeRevurderinger(),
V283BeregningsgrunnlagPåØkonomi(),
V284GjelderPeriodeArbeidsgiverInntektsopplysning()
V284GjelderPeriodeArbeidsgiverInntektsopplysning(),
V285LoggeRareAnnulleringer()
)

fun gjeldendeVersjon() = JsonMigration.gjeldendeVersjon(migrations)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode
import java.time.LocalDateTime
import org.slf4j.LoggerFactory

internal class V285LoggeRareAnnulleringer: JsonMigration(version = 285) {
internal class V285LoggeRareAnnulleringer(private val forkast: Set<String> = setOf("ec293bc9-73ce-4c5f-b7a8-18451f5f623c")): JsonMigration(version = 285) {
override val description = "Logger rare utbetalinger"

override fun doMigration(jsonNode: ObjectNode, meldingerSupplier: MeldingerSupplier) {
Expand All @@ -21,7 +21,7 @@ internal class V285LoggeRareAnnulleringer: JsonMigration(version = 285) {
val nåværendeStatus = rarAnnullering.path("status").asText()
val oppdatert = LocalDateTime.parse(rarAnnullering.path("oppdatert").asText())
sikkerLogg.warn("Annullering $id i Status $nåværendeStatus ser ikke ut til å være overført til Oppdrag (sist oppdatert $oppdatert). AktørId $aktørId, Organisasjonsnummer $organisasjonsnummer")
if (id == testkanin) {
if (id in forkast) {
sikkerLogg.info("Setter status på $id til ")
rarAnnullering as ObjectNode
rarAnnullering.put("status","FORKASTET")
Expand All @@ -32,6 +32,5 @@ internal class V285LoggeRareAnnulleringer: JsonMigration(version = 285) {

private companion object {
private val sikkerLogg = LoggerFactory.getLogger("tjenestekall")
private val testkanin = "ec293bc9-73ce-4c5f-b7a8-18451f5f623c"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package no.nav.helse.serde.migration

import org.junit.jupiter.api.Test

internal class V285LoggeRareAnnulleringerTest: MigrationTest(V285LoggeRareAnnulleringer(forkast = setOf("52fc8116-1757-45bc-8ca1-d333b33d3496"))) {

@Test
fun `forkaster annulleringer som ikke er sendt til oppdrag`() {
assertMigration("/migrations/285/expected.json", "/migrations/285/original.json")
}
}
Loading

0 comments on commit 1718ddb

Please sign in to comment.