-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oppretter avkorting med inntekt fra omregningdata
- Loading branch information
Showing
7 changed files
with
79 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
apps/etterlatte-beregning/src/main/kotlin/avkorting/MottattInntektsjusteringService.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package no.nav.etterlatte.avkorting | ||
|
||
import no.nav.etterlatte.libs.common.beregning.AvkortingGrunnlagLagreDto | ||
import no.nav.etterlatte.libs.common.beregning.MottattInntektsjusteringAvkortigRequest | ||
import no.nav.etterlatte.libs.ktor.token.BrukerTokenInfo | ||
|
||
class MottattInntektsjusteringService( | ||
private val avkortingService: AvkortingService, | ||
) { | ||
suspend fun opprettAvkortingMedBrukeroppgittInntekt( | ||
request: MottattInntektsjusteringAvkortigRequest, | ||
brukerTokenInfo: BrukerTokenInfo, | ||
): Avkorting { | ||
val (behandlingId, virkningstidspunkt, inntekt, inntektUtland) = request | ||
|
||
avkortingService.tilstandssjekk(behandlingId, brukerTokenInfo) | ||
|
||
// Avkorting opprettes her med tidligere årsoppgjør | ||
avkortingService.hentOpprettEllerReberegnAvkorting(behandlingId, brukerTokenInfo) | ||
|
||
val nyttGrunnlag = | ||
AvkortingGrunnlagLagreDto( | ||
inntektTom = inntekt, | ||
fratrekkInnAar = 0, // TODO må tilpasses når vi skal støtte inntektsjustering inneværende år | ||
inntektUtlandTom = inntektUtland, | ||
fratrekkInnAarUtland = 0, // TODO må tilpasses når vi skal støtte inntektsjustering inneværende år | ||
spesifikasjon = "Mottatt inntekt fra bruker gjennom selvbetjening", // TODO avklar med fag | ||
fom = virkningstidspunkt, | ||
) | ||
avkortingService.beregnAvkortingMedNyttGrunnlag(behandlingId, brukerTokenInfo, nyttGrunnlag) | ||
|
||
return avkortingService.hentAvkorting(behandlingId) ?: throw AvkortingFinnesIkkeException(behandlingId) | ||
} | ||
} |
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