Skip to content

Commit

Permalink
IS-1655: Call btsys directly (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersrognstad authored Oct 12, 2023
1 parent 1de98e4 commit ea50fc7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .nais/naiserator-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ spec:
port: 1413
protocol: TCP
- host: "dokarkiv.dev-fss-pub.nais.io"
- host: "isproxy.dev-fss-pub.nais.io"
- host: "pdl-api.dev-fss-pub.nais.io"
- host: "btsys.dev-fss-pub.nais.io"
rules:
- application: padm2pdfgen
- application: clamav
Expand Down Expand Up @@ -112,9 +112,9 @@ spec:
- name: HELSENETT_ENDPOINT_URL
value: http://syfohelsenettproxy.teamsykmelding
- name: LEGE_SUSPENSJON_CLIENT_ID
value: dev-fss.teamsykefravr.isproxy
value: dev-fss.team-rocket.btsys
- name: LEGE_SUSPENSJON_ENDPOINT_URL
value: https://isproxy.dev-fss-pub.nais.io
value: https://btsys.dev-fss-pub.nais.io
- name: SMTSS_CLIENT_ID
value: dev-gcp.teamsykmelding.smtss
- name: SMTSS_URL
Expand Down
6 changes: 3 additions & 3 deletions .nais/naiserator-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ spec:
port: 1414
protocol: TCP
- host: "dokarkiv.prod-fss-pub.nais.io"
- host: "isproxy.prod-fss-pub.nais.io"
- host: "pdl-api.prod-fss-pub.nais.io"
- host: "btsys.prod-fss-pub.nais.io"
rules:
- application: padm2pdfgen
- application: clamav
Expand Down Expand Up @@ -112,9 +112,9 @@ spec:
- name: HELSENETT_ENDPOINT_URL
value: http://syfohelsenettproxy.teamsykmelding
- name: LEGE_SUSPENSJON_CLIENT_ID
value: prod-fss.teamsykefravr.isproxy
value: prod-fss.team-rocket.btsys
- name: LEGE_SUSPENSJON_ENDPOINT_URL
value: https://isproxy.prod-fss-pub.nais.io
value: https://btsys.prod-fss-pub.nais.io
- name: SMTSS_CLIENT_ID
value: prod-gcp.teamsykmelding.smtss
- name: SMTSS_URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class DialogmeldingProcessor(
azureAdV2Client = azureAdV2Client,
endpointUrl = env.legeSuspensjonEndpointURL,
endpointClientId = env.legeSuspensjonClientId,
applicationName = env.applicationName,
httpClient = httpClient,
)
val padm2ReglerService = RuleService(
Expand Down
10 changes: 6 additions & 4 deletions src/main/kotlin/no/nav/syfo/client/LegeSuspensjonClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class LegeSuspensjonClient(
private val azureAdV2Client: AzureAdV2Client,
private val endpointUrl: String,
private val endpointClientId: String,
private val httpClient: HttpClient
private val httpClient: HttpClient,
private val applicationName: String,
) {

suspend fun sjekkSuspensjon(
Expand All @@ -24,19 +25,20 @@ class LegeSuspensjonClient(
val token = azureAdV2Client.getSystemToken(endpointClientId)
?: throw RuntimeException("Failed to sjekk suspensjon: No token was found")

val httpResponse: HttpResponse = httpClient.get("$endpointUrl/api/v1/btsys/suspensjon/status") {
val httpResponse: HttpResponse = httpClient.get("$endpointUrl/api/v1/suspensjon/status") {
accept(ContentType.Application.Json)
headers {
append("Nav-Call-Id", ediloggid)
append("Nav-Consumer-Id", applicationName)
append("Nav-Personident", behandlerId)
append("Authorization", "Bearer ${token.accessToken}")
}
parameter("oppslagsdato", oppslagsdato)
}

if (httpResponse.status != HttpStatusCode.OK) {
logger.error("Btsys (via isproxy) svarte med kode {} for ediloggId {}, {}", httpResponse.status, ediloggid)
throw IOException("Btsys svarte (via isproxy) med uventet kode ${httpResponse.status} for $ediloggid")
logger.error("Btsys svarte med kode {} for ediloggId {}", httpResponse.status, ediloggid)
throw IOException("Btsys svarte med uventet kode ${httpResponse.status} for $ediloggid")
}

return httpResponse.call.response.body()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import no.nav.syfo.util.configure

class LegeSuspensjonEndpointMock {
private val port = getRandomPort()
private val path = "/api/v1/btsys/suspensjon/status"
private val path = "/api/v1/suspensjon/status"
val url = "http://localhost:$port"

val name = "legeSuspensjonEndpoint"
Expand Down

0 comments on commit ea50fc7

Please sign in to comment.