-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sjekker frilansarbeidsforhold fra aareg mot inntekter
inntektskomponenten sluttet å svare med frilansarbeidsforhold 4. november, uten noen forvarsel eller ettervarsel. :) Co-authored-by: Simen Ullern <simen.ullern@nav.no> Co-authored-by: Sivert Lunsæter <Sivert.Frang.Lunseter@nav.no>
- Loading branch information
1 parent
90f2683
commit d4ce978
Showing
49 changed files
with
221 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
sykepenger-mediators/src/test/kotlin/no/nav/helse/spleis/mediator/e2e/FrilanserTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 2 additions & 68 deletions
70
sykepenger-model/src/main/kotlin/no/nav/helse/hendelser/InntektForSykepengegrunnlag.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,9 @@ | ||
package no.nav.helse.hendelser | ||
|
||
import java.time.LocalDate | ||
import java.time.YearMonth | ||
import java.util.UUID | ||
import no.nav.helse.etterlevelse.Subsumsjonslogg | ||
import no.nav.helse.hendelser.ArbeidsgiverInntekt.Companion.antallMåneder | ||
import no.nav.helse.hendelser.ArbeidsgiverInntekt.Companion.avklarSykepengegrunnlag | ||
import no.nav.helse.hendelser.ArbeidsgiverInntekt.Companion.harInntektFor | ||
import no.nav.helse.hendelser.ArbeidsgiverInntekt.Companion.harInntektI | ||
import no.nav.helse.person.Person | ||
import no.nav.helse.person.aktivitetslogg.IAktivitetslogg | ||
import no.nav.helse.person.aktivitetslogg.Varselkode.RV_IV_3 | ||
import no.nav.helse.person.inntekt.Inntektsgrunnlag | ||
import no.nav.helse.person.inntekt.SkattSykepengegrunnlag | ||
|
||
class InntektForSykepengegrunnlag( | ||
private val inntekter: List<ArbeidsgiverInntekt>, | ||
private val arbeidsforhold: List<Arbeidsforhold> | ||
) { | ||
data class InntektForSykepengegrunnlag(val inntekter: List<ArbeidsgiverInntekt>) { | ||
init { | ||
require(inntekter.antallMåneder() <= 3L) { "Forventer maks 3 inntektsmåneder" } | ||
} | ||
|
||
internal fun avklarSykepengegrunnlag( | ||
aktivitetslogg: IAktivitetslogg, | ||
person: Person, | ||
rapporterteArbeidsforhold: Map<String, SkattSykepengegrunnlag>, | ||
skjæringstidspunkt: LocalDate, | ||
meldingsreferanseId: UUID, | ||
subsumsjonslogg: Subsumsjonslogg | ||
): Inntektsgrunnlag = | ||
inntekter.avklarSykepengegrunnlag(aktivitetslogg, person, rapporterteArbeidsforhold, skjæringstidspunkt, meldingsreferanseId, subsumsjonslogg) | ||
|
||
internal fun valider( | ||
aktivitetslogg: IAktivitetslogg, | ||
): IAktivitetslogg { | ||
if (finnerFrilansinntektDeSiste3Månedene()) | ||
aktivitetslogg.funksjonellFeil(RV_IV_3) | ||
return aktivitetslogg | ||
} | ||
|
||
private fun finnerFrilansinntektDeSiste3Månedene() = | ||
arbeidsforhold.any { arbeidsforhold -> | ||
arbeidsforhold.månedligeArbeidsforhold.any { | ||
it.erFrilanser && inntekter.harInntektFor(arbeidsforhold.orgnummer, it.yearMonth) | ||
} | ||
} | ||
|
||
internal fun finnerFrilansinntektDenSisteMåneden(skjæringstidspunkt: LocalDate): Boolean { | ||
val månedFørSkjæringstidspunkt = YearMonth.from(skjæringstidspunkt.minusMonths(1)) | ||
return arbeidsforhold.any { arbeidsforhold -> | ||
arbeidsforhold.månedligeArbeidsforhold.any { | ||
it.erFrilanser && inntekter.harInntektFor(arbeidsforhold.orgnummer, månedFørSkjæringstidspunkt) | ||
} | ||
} | ||
} | ||
|
||
internal fun harInntektI(måned: YearMonth): Boolean { | ||
return inntekter.harInntektI(måned) | ||
} | ||
|
||
class Arbeidsforhold( | ||
val orgnummer: String, | ||
val månedligeArbeidsforhold: List<MånedligArbeidsforhold> | ||
) | ||
|
||
class MånedligArbeidsforhold( | ||
val yearMonth: YearMonth, | ||
val erFrilanser: Boolean | ||
) | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.