Skip to content

Commit

Permalink
Legg til støtte for Prøvingsdato
Browse files Browse the repository at this point in the history
Co-authored-by: Geir André Lund <geir.andre.lund@nav.no>
  • Loading branch information
richardmartinsen and geiralund committed Jan 16, 2025
1 parent 6041e94 commit ff289b6
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal class InntektClient(
behandlingId: UUID,
aktørId: String? = null,
dselsnummer: String? = null,
virkningsTidspunkt: LocalDate,
prøvingsdato: LocalDate,
callId: String? = null,
): Inntekt {
val response =
Expand All @@ -47,7 +47,7 @@ internal class InntektClient(
aktørId = aktørId,
fødselsnummer = fødselsnummer,
regelkontekst = RegelKontekst(id = behandlingId.toString(), type = "saksbehandling"),
beregningsDato = virkningsTidspunkt,
beregningsDato = prøvingsdato,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal class InntektNesteMånedService(
inntektClient.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = packet["ident"].asText(),
virkningsTidspunkt = inntektsrapporteringsperiode.neste().fom(),
prøvingsdato = inntektsrapporteringsperiode.neste().fom(),
callId = callId,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal class SykepengerLøsningService(
inntektClient.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = packet["ident"].asText(),
virkningsTidspunkt = packet["Virkningstidspunkt"].asLocalDate(),
prøvingsdato = packet["Virkningstidspunkt"].asLocalDate(),
callId = callId,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ internal class InntektBehovløser(
it.forbid("@løsning")
it.requireKey("@id", "@behovId")
it.requireKey(behov)
it.require("$behov.Virkningsdato") {
it.interestedIn("$behov.Virkningsdato") {
it.asLocalDate()
}
it.interestedIn("$behov.Prøvingsdato") {
it.asLocalDate()
}
it.requireKey("ident", "behandlingId")
Expand Down Expand Up @@ -60,15 +63,20 @@ internal class InntektBehovløser(
"behandlingId" to behandlingId.toString(),
) {
// @todo: Vi må hente ut inntekt basert på opptjeningsperiode
val virkningsdato = packet[behov]["Virkningsdato"].asLocalDate()
val prøvingsdato =
if (packet[behov].has("Prøvingsdato")) {
packet[behov]["Prøvingsdato"].asLocalDate()
} else {
packet[behov]["Virkningsdato"].asLocalDate()
}
val inntekt =
runBlocking {
kotlin
.runCatching {
inntektClient.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = packet["ident"].asText(),
virkningsTidspunkt = virkningsdato,
prøvingsdato = prøvingsdato,
callId = behovId,
)
}.onFailure {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal class InntektNesteMånedServiceTest {
it.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = "12345678911",
virkningsTidspunkt = LocalDate.parse("2021-06-08"),
prøvingsdato = LocalDate.parse("2021-06-08"),
callId = any(),
)
} returns inntekt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal class SykepengerLøsningServiceTest {
it.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = "12345678911",
virkningsTidspunkt = LocalDate.parse("2020-11-18"),
prøvingsdato = LocalDate.parse("2020-11-18"),
callId = any(),
)
} returns inntekt
Expand All @@ -70,7 +70,7 @@ internal class SykepengerLøsningServiceTest {
inntektClient.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = "12345678911",
virkningsTidspunkt = LocalDate.parse("2020-11-18"),
prøvingsdato = LocalDate.parse("2020-11-18"),
callId = any(),
)
}
Expand Down Expand Up @@ -102,7 +102,7 @@ internal class SykepengerLøsningServiceTest {
it.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = "12345678911",
virkningsTidspunkt = LocalDate.parse("2020-11-18"),
prøvingsdato = LocalDate.parse("2020-11-18"),
callId = any(),
)
} returns inntekt
Expand All @@ -118,7 +118,7 @@ internal class SykepengerLøsningServiceTest {
inntektClient.hentKlassifisertInntekt(
behandlingId = behandlingId,
fødselsnummer = "12345678911",
virkningsTidspunkt = LocalDate.parse("2020-11-18"),
prøvingsdato = LocalDate.parse("2020-11-18"),
callId = any(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal class InntektBehovløserTest {
behandlingId = any(),
aktørId = any(),
fødselsnummer = "12345678911",
virkningsTidspunkt = LocalDate.parse("2024-01-01"),
prøvingsdato = LocalDate.parse("2024-01-01"),
callId = any(),
)
} returns inntekt
Expand Down Expand Up @@ -83,7 +83,7 @@ internal class InntektBehovløserTest {
"ident": "12345678911",
"behandlingId": "018dac22-2664-7724-95a6-2cd1ed9d3a07",
"Inntekt": {
"Virkningsdato": "2024-01-01"
"Prøvingsdato": "2024-01-01"
},
"@id": "f0d97980-93e0-4638-8a61-337978466d7e",
Expand Down

0 comments on commit ff289b6

Please sign in to comment.