-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eksponer inntektsmelding til innsyn (#2734)
- Loading branch information
Showing
11 changed files
with
130 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
java temurin-21.0.3+9.0.LTS |
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
6 changes: 0 additions & 6 deletions
6
domene/src/main/java/no/nav/foreldrepenger/selvbetjening/innsyn/InntektsmeldingDto.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
...no/nav/foreldrepenger/selvbetjening/innsyn/inntektsmelding/InntektsmeldingController.java
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,30 @@ | ||
package no.nav.foreldrepenger.selvbetjening.innsyn.inntektsmelding; | ||
|
||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import no.nav.foreldrepenger.common.domain.Saksnummer; | ||
import no.nav.foreldrepenger.common.innsyn.inntektsmelding.FpOversiktInntektsmeldingDto; | ||
import no.nav.foreldrepenger.selvbetjening.http.ProtectedRestController; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
|
||
import java.util.List; | ||
|
||
@ProtectedRestController("/rest/innsyn/inntektsmeldinger") | ||
public class InntektsmeldingController { | ||
private final InntektsmeldingTjeneste inntektsmeldingTjeneste; | ||
|
||
@Autowired | ||
public InntektsmeldingController(InntektsmeldingTjeneste inntektsmeldingTjeneste) { | ||
this.inntektsmeldingTjeneste = inntektsmeldingTjeneste; | ||
} | ||
|
||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) | ||
public List<FpOversiktInntektsmeldingDto> hentInntektsmeldinger(@RequestParam @Valid @NotNull Saksnummer saksnummer) { | ||
return inntektsmeldingTjeneste.hentInntektsmeldinger(saksnummer); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...a/no/nav/foreldrepenger/selvbetjening/innsyn/inntektsmelding/InntektsmeldingTjeneste.java
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,23 @@ | ||
package no.nav.foreldrepenger.selvbetjening.innsyn.inntektsmelding; | ||
|
||
import no.nav.foreldrepenger.common.domain.Saksnummer; | ||
import no.nav.foreldrepenger.common.innsyn.inntektsmelding.FpOversiktInntektsmeldingDto; | ||
import no.nav.foreldrepenger.selvbetjening.innsyn.Innsyn; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
public class InntektsmeldingTjeneste { | ||
|
||
private final Innsyn innsyn; | ||
|
||
public InntektsmeldingTjeneste(Innsyn innsyn) { | ||
this.innsyn = innsyn; | ||
} | ||
|
||
public List<FpOversiktInntektsmeldingDto> hentInntektsmeldinger(Saksnummer saksnummer) { | ||
return innsyn.inntektsmeldinger(saksnummer); | ||
} | ||
} |
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
50 changes: 50 additions & 0 deletions
50
...av/foreldrepenger/selvbetjening/innsyn/inntektsmelding/InntektsmeldingControllerTest.java
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,50 @@ | ||
package no.nav.foreldrepenger.selvbetjening.innsyn.inntektsmelding; | ||
|
||
import no.nav.foreldrepenger.common.domain.Saksnummer; | ||
import no.nav.foreldrepenger.common.innsyn.inntektsmelding.FpOversiktInntektsmeldingDto; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.math.BigDecimal; | ||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class InntektsmeldingControllerTest { | ||
|
||
|
||
private static final String FAKE_SAKSNUMMER = "123456789"; | ||
private InntektsmeldingTjeneste inntektsmeldingTjeneste = mock(InntektsmeldingTjeneste.class); | ||
|
||
@Test | ||
void sakErOppdatertHvisOppdateringstidspunktErEtterMottattidspunktetTilJournalposten() { | ||
var imController = new InntektsmeldingController(inntektsmeldingTjeneste); | ||
|
||
when(inntektsmeldingTjeneste.hentInntektsmeldinger(new Saksnummer(FAKE_SAKSNUMMER))).thenReturn(List.of(standardInntektsmelding())); | ||
|
||
var result = imController.hentInntektsmeldinger(new Saksnummer(FAKE_SAKSNUMMER)); | ||
assertThat(result).hasSize(1); | ||
} | ||
|
||
private static FpOversiktInntektsmeldingDto standardInntektsmelding() { | ||
return new FpOversiktInntektsmeldingDto( | ||
2, | ||
true, | ||
BigDecimal.valueOf(70), | ||
BigDecimal.valueOf(5000), | ||
BigDecimal.valueOf(5000), | ||
"Arbeidsgiver", | ||
"123123123", | ||
"1", | ||
LocalDateTime.now(), | ||
LocalDate.now(), | ||
List.of(), | ||
List.of() | ||
); | ||
} | ||
|
||
} |
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