-
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.
- Loading branch information
Showing
26 changed files
with
499 additions
and
348 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
6 changes: 6 additions & 0 deletions
6
common/domain/src/main/kotlin/no/nav/su/se/bakover/common/domain/extensions/IntEx.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,6 @@ | ||
package no.nav.su.se.bakover.common.domain.extensions | ||
|
||
fun Int.toStringWithDecimals(decimalPlaces: Int): String { | ||
if (decimalPlaces <= 0) return this.toString() | ||
return "$this.${"0".repeat(decimalPlaces)}" | ||
} |
13 changes: 13 additions & 0 deletions
13
common/domain/src/test/kotlin/no/nav/su/se/bakover/common/domain/extensions/IntExKtTest.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,13 @@ | ||
package no.nav.su.se.bakover.common.domain.extensions | ||
|
||
import io.kotest.matchers.shouldBe | ||
import org.junit.jupiter.api.Test | ||
|
||
internal class IntExKtTest { | ||
@Test | ||
fun `toStringWithDecimals should return the integer as a string with the specified number of decimal places`() { | ||
42.toStringWithDecimals(2) shouldBe "42.00" | ||
42.toStringWithDecimals(0) shouldBe "42" | ||
42.toStringWithDecimals(5) shouldBe "42.00000" | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...pdrag/simulering/SimuleringSoapBuilder.kt → ...nfrastructure/soap/SoapEnvelopeBuilder.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
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
19 changes: 19 additions & 0 deletions
19
test-common/src/main/kotlin/tilbakekreving/TilbakekrevingSoapResponses.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,19 @@ | ||
package no.nav.su.se.bakover.test.tilbakekreving | ||
|
||
/** | ||
* Mottatt i preprod ved å sende en request til tilbakekreving med en ugyldig request (decimal på feil format) | ||
*/ | ||
fun tilbakekrevingSoapResponseConversionError() = """ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> | ||
<SOAP-ENV:Body> | ||
<SOAP-ENV:Fault> | ||
<faultcode>SOAP-ENV:Server</faultcode> | ||
<faultstring>Conversion from SOAP failed</faultstring> | ||
<detail> | ||
<CICSFault xmlns="http://www.ibm.com/software/htp/cics/WSFault">DFHPI1009 08/02/2024 10:04:56 CICSQ1OS OSW8 85071 XML to data transformation failed. A conversion error (INVALID_CHARACTER) occurred when converting field belopTilbakekreves for WEBSERVICE tilbakekreving-v1-tjenestespesif.</CICSFault> | ||
</detail> | ||
</SOAP-ENV:Fault> | ||
</SOAP-ENV:Body> | ||
</SOAP-ENV:Envelope> | ||
""".trimIndent() |
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
81 changes: 81 additions & 0 deletions
81
...ure/src/main/kotlin/tilbakekreving/infrastructure/client/TilbakekrevingSoapBodyBuilder.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,81 @@ | ||
@file:Suppress("HttpUrlsUsage") | ||
|
||
package tilbakekreving.infrastructure.client | ||
|
||
import no.nav.su.se.bakover.common.domain.extensions.toStringWithDecimals | ||
import no.nav.su.se.bakover.common.ident.NavIdentBruker | ||
import tilbakekreving.domain.vurdering.PeriodevurderingMedKrav | ||
import tilbakekreving.domain.vurdering.VurderingerMedKrav | ||
import tilbakekreving.infrastructure.client.dto.AksjonsKode | ||
import tilbakekreving.infrastructure.client.dto.Skyld | ||
import tilbakekreving.infrastructure.client.dto.TilbakekrevingsHjemmel | ||
import tilbakekreving.infrastructure.client.dto.Tilbakekrevingsresultat | ||
import tilbakekreving.infrastructure.client.dto.TilbakekrevingsÅrsak | ||
import kotlin.math.max | ||
|
||
/** | ||
* Se: https://confluence.adeo.no/display/OKSY/Detaljer+om+de+enkelte+ID-koder | ||
* Se: https://github.com/navikt/tjenestespesifikasjoner/blob/master/tilbakekreving-v1-tjenestespesifikasjon/src/main/wsdl/no/nav/tilbakekreving/tilbakekreving-v1-tjenestespesifikasjon.wsdl | ||
*/ | ||
internal fun buildTilbakekrevingSoapRequest( | ||
vurderingerMedKrav: VurderingerMedKrav, | ||
attestertAv: NavIdentBruker.Attestant, | ||
): String { | ||
// TODO jah: Vurder om vi skal legge til datoVedtakFagsystem istedenfor å få dagens dato. | ||
return """ | ||
<ns4:tilbakekrevingsvedtakRequest xmlns:ns2="urn:no:nav:tilbakekreving:typer:v1" | ||
xmlns:ns4="http://okonomi.nav.no/tilbakekrevingService/" | ||
xmlns:ns3="urn:no:nav:tilbakekreving:tilbakekrevingsvedtak:vedtak:v1"> | ||
<tilbakekrevingsvedtak> | ||
<ns3:kodeAksjon>${AksjonsKode.FATT_VEDTAK.nummer}</ns3:kodeAksjon> | ||
<ns3:vedtakId>${vurderingerMedKrav.eksternVedtakId}</ns3:vedtakId> | ||
<ns3:kodeHjemmel>${TilbakekrevingsHjemmel.T}</ns3:kodeHjemmel> | ||
<ns3:renterBeregnes>N</ns3:renterBeregnes> | ||
<ns3:enhetAnsvarlig>8020</ns3:enhetAnsvarlig> | ||
<ns3:kontrollfelt>${vurderingerMedKrav.eksternKontrollfelt}</ns3:kontrollfelt> | ||
<ns3:saksbehId>$attestertAv</ns3:saksbehId> | ||
${ | ||
vurderingerMedKrav.perioder.joinToString(separator = "\n") { periode -> | ||
""" | ||
<ns3:tilbakekrevingsperiode> | ||
<ns3:periode> | ||
<ns2:fom>${periode.periode.fraOgMed}</ns2:fom> | ||
<ns2:tom>${periode.periode.tilOgMed}</ns2:tom> | ||
</ns3:periode> | ||
<ns3:renterBeregnes>N</ns3:renterBeregnes> | ||
<ns3:belopRenter>0.00</ns3:belopRenter> | ||
<ns3:tilbakekrevingsbelop> | ||
<ns3:kodeKlasse>SUUFORE</ns3:kodeKlasse> | ||
<ns3:belopOpprUtbet>${periode.bruttoTidligereUtbetalt.toStringWithDecimals(2)}</ns3:belopOpprUtbet> | ||
<ns3:belopNy>${periode.bruttoNyUtbetaling.toStringWithDecimals(2)}</ns3:belopNy> | ||
<ns3:belopTilbakekreves>${periode.bruttoSkalTilbakekreve.toStringWithDecimals(2)}</ns3:belopTilbakekreves> | ||
<ns3:belopUinnkrevd>${periode.bruttoSkalIkkeTilbakekreve.toStringWithDecimals(2)}</ns3:belopUinnkrevd> | ||
<ns3:belopSkatt>${periode.skattSomGårTilReduksjon.toStringWithDecimals(2)}</ns3:belopSkatt> | ||
<ns3:kodeResultat>${ | ||
when (periode) { | ||
is PeriodevurderingMedKrav.SkalIkkeTilbakekreve -> Tilbakekrevingsresultat.INGEN_TILBAKEKREV.toString() | ||
is PeriodevurderingMedKrav.SkalTilbakekreve -> Tilbakekrevingsresultat.FULL_TILBAKEKREV.toString() | ||
} | ||
}</ns3:kodeResultat> | ||
<ns3:kodeAarsak>${TilbakekrevingsÅrsak.ANNET}</ns3:kodeAarsak> | ||
<ns3:kodeSkyld>${ | ||
when (periode) { | ||
is PeriodevurderingMedKrav.SkalIkkeTilbakekreve -> Skyld.IKKE_FORDELT.toString() | ||
is PeriodevurderingMedKrav.SkalTilbakekreve -> Skyld.BRUKER.toString() | ||
} | ||
}</ns3:kodeSkyld> | ||
</ns3:tilbakekrevingsbelop> | ||
<ns3:tilbakekrevingsbelop> | ||
<ns3:kodeKlasse>KL_KODE_FEIL_INNT</ns3:kodeKlasse> | ||
<ns3:belopOpprUtbet>0.00</ns3:belopOpprUtbet> | ||
<ns3:belopNy>${max(periode.bruttoSkalTilbakekreve, periode.bruttoSkalIkkeTilbakekreve).toStringWithDecimals(2)}</ns3:belopNy> | ||
<ns3:belopTilbakekreves>0.00</ns3:belopTilbakekreves> | ||
<ns3:belopUinnkrevd>0.00</ns3:belopUinnkrevd> | ||
</ns3:tilbakekrevingsbelop> | ||
</ns3:tilbakekrevingsperiode>""" | ||
} | ||
} | ||
</tilbakekrevingsvedtak> | ||
</ns4:tilbakekrevingsvedtakRequest> | ||
""".trimIndent() | ||
} |
Oops, something went wrong.