Skip to content

Commit

Permalink
sett personident header for skatt istedenfor som request-param
Browse files Browse the repository at this point in the history
  • Loading branch information
RamziAbuQassim committed Oct 4, 2024
1 parent 738dc3b commit 284ef4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,14 @@ class SkatteClient(
): Either<SkatteoppslagFeil, Skattegrunnlag.SkattegrunnlagForÅr> {
val url = "${skatteetatenConfig.apiBaseUrl}/api/v2/summertskattegrunnlag"
val params =
"personidentifikator=$fnr&inntektsaar=$inntektsÅr&stadie=${stadie.verdi}&rettighetspakke=${skatteetatenConfig.rettighetspakke}"
"inntektsaar=$inntektsÅr&stadie=${stadie.verdi}&rettighetspakke=${skatteetatenConfig.rettighetspakke}"
val getRequest = HttpRequest.newBuilder()
.uri(URI.create("$url?$params"))
.setHeader("Accept", "application/json")
.setHeader("Authorization", "Bearer $token")
.setHeader("Nav-Call-Id", correlationId.toString())
.setHeader("Nav-Consumer-Id", skatteetatenConfig.consumerId)
.setHeader("Nav-Personident", fnr.toString())
.GET()
.build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package vilkår.skatt.infrastructure.client
import arrow.core.left
import arrow.core.right
import com.github.tomakehurst.wiremock.client.WireMock
import com.github.tomakehurst.wiremock.client.WireMock.matching
import com.github.tomakehurst.wiremock.http.Body
import com.github.tomakehurst.wiremock.http.Fault
import io.kotest.assertions.arrow.core.shouldBeLeft
Expand Down Expand Up @@ -267,9 +268,11 @@ internal class SkatteClientTest {

@Test
fun `success response gir mapped data`() {
val fnr = Fnr(fnr = "04900148157")
startedWireMockServerWithCorrelationId {
stubFor(
WireMock.get(WireMock.urlPathEqualTo("/api/v2/summertskattegrunnlag"))
.withHeader("Nav-Personident", matching(fnr.toString()))
.willReturn(
WireMock.ok(
"""
Expand Down Expand Up @@ -333,7 +336,7 @@ internal class SkatteClientTest {

val år = Year.of(2021)
client(baseUrl()).hentSamletSkattegrunnlag(
fnr = Fnr(fnr = "04900148157"),
fnr = fnr,
år = år,
) shouldBe SamletSkattegrunnlagForÅr(
utkast = SamletSkattegrunnlagForÅrOgStadie.Utkast(
Expand Down

0 comments on commit 284ef4d

Please sign in to comment.