-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and add Skattekort retrieval functionality #deploy-skattekor…
…t-service SokosResponse was renamed to SokosGetRequest and moved to a separate libraries. Updated relevant fields of the class to align with new requirements. Introduced new GET API for Skattekort retrieval in the SkattekortController. Implemented the retrieval functionality in SkattekortService and SokosSkattekortConsumer using a new SokosGetCommand.
- Loading branch information
Showing
6 changed files
with
65 additions
and
9 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
34 changes: 34 additions & 0 deletions
34
...kort-service/src/main/java/no/nav/skattekortservice/consumer/command/SokosGetCommand.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,34 @@ | ||
package no.nav.skattekortservice.consumer.command; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
import reactor.core.publisher.Mono; | ||
|
||
import java.util.UUID; | ||
import java.util.concurrent.Callable; | ||
|
||
import static org.apache.hc.core5.http.HttpHeaders.AUTHORIZATION; | ||
|
||
@RequiredArgsConstructor | ||
public class SokosGetCommand implements Callable<Mono<String>> { | ||
|
||
private static final String SOKOS_URL = "/api/v1/skattekort/hent/{fnr}/{inntektsaar}"; | ||
|
||
private final WebClient webClient; | ||
private final String ident; | ||
private final String inntektsaar; | ||
private final String token; | ||
|
||
@Override | ||
public Mono<String> call() { | ||
|
||
return webClient | ||
.get() | ||
.uri(uriBuilder -> uriBuilder.path(SOKOS_URL) | ||
.build(ident, inntektsaar)) | ||
.header(AUTHORIZATION, "Bearer " + token) | ||
.header("korrelasjonsid", UUID.randomUUID().toString()) | ||
.retrieve() | ||
.bodyToMono(String.class); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -14,4 +14,4 @@ public class SokosRequest { | |
private String fnr; | ||
private String inntektsar; | ||
private String skattekort; | ||
} | ||
} |
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