-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EY-4328: Flyttar over og flettar inn frå libs-repoet og hit. Har kun …
…tatt med det som er ulikt, og gjort så få endringar som mogleg for å få det så likt som mogleg. Samkøyring og forenkling får komme etterpå (#323)
- Loading branch information
1 parent
84046bf
commit 504fba8
Showing
26 changed files
with
2,836 additions
and
4 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,88 @@ | ||
name: Release common | ||
|
||
on: | ||
workflow_dispatch: # Allow manually triggered workflow run | ||
push: | ||
paths: | ||
- common | ||
- gradle/libs.versions.toml | ||
|
||
jobs: | ||
build: | ||
name: Verification | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 21 | ||
cache: gradle | ||
|
||
# Build | ||
- name: Test and build | ||
run: ./gradlew :common:build | ||
|
||
release-dev: | ||
name: Create Release - Dev | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
if: github.ref != 'refs/heads/main' | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 21 | ||
cache: gradle | ||
- name: Create Release | ||
id: create_release | ||
uses: elgohr/Github-Release-Action@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
title: common.dev | ||
prerelease: true | ||
- name: Upload artifact | ||
run: ./gradlew :common:publish -Pversion="dev.$(echo $GITHUB_SHA | cut -c 1-12).dev" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release: | ||
name: Create Release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 21 | ||
cache: gradle | ||
- name: Set release tag | ||
run: | | ||
export TAG_NAME="$(TZ="Europe/Oslo" date +%Y.%m.%d-%H.%M).$(echo $GITHUB_SHA | cut -c 1-12)" | ||
echo "RELEASE_TAG=$TAG_NAME" >> $GITHUB_ENV | ||
- name: Create Release | ||
id: create_release | ||
uses: elgohr/Github-Release-Action@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
title: common.${{ env.RELEASE_TAG }} | ||
- name: Upload artifact | ||
run: ./gradlew :common:publish -Pversion="${{ env.RELEASE_TAG }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import org.gradle.accessors.dm.LibrariesForLibs | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
|
||
val libs = the<LibrariesForLibs>() | ||
|
||
plugins { | ||
kotlin("jvm") | ||
application | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
tasks { | ||
withType<Test> { | ||
useJUnitPlatform() | ||
testLogging { | ||
events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) | ||
} | ||
} | ||
} |
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,52 @@ | ||
plugins { | ||
id("maven-publish") | ||
id("etterlatte") | ||
} | ||
|
||
dependencies { | ||
api(kotlin("stdlib")) | ||
api(kotlin("reflect")) | ||
|
||
api(libs.jacksonDatatypejsr310) | ||
api(libs.jackson.datatypejdk8) | ||
api(libs.jackson.modulekotlin) | ||
|
||
testImplementation(libs.jupiter.api) | ||
testImplementation(libs.test.kotest.assertionscore) | ||
testImplementation(libs.mockk) | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
url = uri("https://maven.pkg.github.com/navikt/pensjon-etterlatte-felles") | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
|
||
pom { | ||
name.set("common") | ||
url.set("https://github.com/navikt/pensjon-etterlatte-felles") | ||
|
||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://opensource.org/licenses/MIT") | ||
} | ||
} | ||
|
||
scm { | ||
connection.set("scm:git:https://github.com/navikt/pensjon-etterlatte-felles.git") | ||
developerConnection.set("scm:git:https://github.com/navikt/pensjon-etterlatte-felles.git") | ||
url.set("https://github.com/navikt/pensjon-etterlatte-felles") | ||
} | ||
} | ||
from(components["java"]) | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...rc/main/kotlin/no/nav/etterlatte/libs/common/innsendtsoeknad/barnepensjon/Barnepensjon.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,49 @@ | ||
package no.nav.etterlatte.libs.common.innsendtsoeknad.barnepensjon | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import java.time.LocalDate | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.BankkontoType | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.Kontaktinfo | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.Spraak | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.UtbetalingsInformasjon | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.Barn | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.BetingetOpplysning | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.EnumSvar | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.ImageTag | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.Innsender | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.InnsendtSoeknad | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.Opplysning | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.Person | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.PersonType | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.common.SoeknadType | ||
import no.nav.etterlatte.libs.common.person.Foedselsnummer | ||
import java.time.LocalDateTime | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Barnepensjon( | ||
override val imageTag: ImageTag, | ||
override val spraak: Spraak, | ||
override val innsender: Innsender, | ||
override val harSamtykket: Opplysning<Boolean>, | ||
override val utbetalingsInformasjon: BetingetOpplysning<EnumSvar<BankkontoType>, UtbetalingsInformasjon>?, | ||
override val soeker: Barn, | ||
val foreldre: List<Person>, | ||
val soesken: List<Barn>, | ||
) : InnsendtSoeknad { | ||
override val versjon = "2" | ||
override val type = SoeknadType.BARNEPENSJON | ||
override val mottattDato: LocalDateTime = LocalDateTime.now() | ||
} | ||
|
||
data class GjenlevendeForelder( | ||
override val fornavn: Opplysning<String>, | ||
override val etternavn: Opplysning<String>, | ||
override val foedselsnummer: Opplysning<Foedselsnummer>, | ||
override val foedselsdato: Opplysning<LocalDate>? = null, | ||
|
||
val adresse: Opplysning<String>, | ||
val statsborgerskap: Opplysning<String>, | ||
val kontaktinfo: Kontaktinfo, | ||
) : Person { | ||
override val type = PersonType.GJENLEVENDE_FORELDER | ||
} |
46 changes: 46 additions & 0 deletions
46
...n/src/main/kotlin/no/nav/etterlatte/libs/common/innsendtsoeknad/common/InnsendtSoeknad.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,46 @@ | ||
package no.nav.etterlatte.libs.common.innsendtsoeknad.common | ||
|
||
import com.fasterxml.jackson.annotation.JsonGetter | ||
import com.fasterxml.jackson.annotation.JsonSubTypes | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.BankkontoType | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.Spraak | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.UtbetalingsInformasjon | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.barnepensjon.Barnepensjon | ||
import no.nav.etterlatte.libs.common.innsendtsoeknad.omstillingsstoenad.Omstillingsstoenad | ||
import java.time.LocalDateTime | ||
|
||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.EXISTING_PROPERTY, | ||
property = "type", | ||
) | ||
@JsonSubTypes( | ||
JsonSubTypes.Type(value = Barnepensjon::class, name = "BARNEPENSJON"), | ||
JsonSubTypes.Type(value = Omstillingsstoenad::class, name = "OMSTILLINGSSTOENAD"), | ||
) | ||
interface InnsendtSoeknad : PDFMal { | ||
val versjon: String | ||
val spraak: Spraak | ||
val imageTag: ImageTag | ||
val type: SoeknadType | ||
val mottattDato: LocalDateTime | ||
val innsender: Innsender | ||
val soeker: Person | ||
val harSamtykket: Opplysning<Boolean> | ||
val utbetalingsInformasjon: BetingetOpplysning<EnumSvar<BankkontoType>, UtbetalingsInformasjon>? | ||
|
||
@JsonGetter("template") | ||
fun template(): String = "${type.name.lowercase()}_v$versjon" | ||
} | ||
|
||
/** | ||
* Docker Image Tag | ||
* Gjør det mulig å vite hvilken versjon | ||
*/ | ||
typealias ImageTag = String | ||
|
||
// Kan inneholde søknad for både omstillingsstønad og barnepensjon | ||
data class SoeknadRequest( | ||
val soeknader: List<InnsendtSoeknad>, | ||
) |
33 changes: 33 additions & 0 deletions
33
common/src/main/kotlin/no/nav/etterlatte/libs/common/innsendtsoeknad/common/Opplysning.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,33 @@ | ||
package no.nav.etterlatte.libs.common.innsendtsoeknad.common | ||
|
||
import java.time.LocalDate | ||
|
||
data class Opplysning<T>( | ||
val svar: T, | ||
val spoersmaal: String? = null, | ||
) | ||
|
||
data class BetingetOpplysning<T, R>( | ||
val svar: T, | ||
val spoersmaal: String? = null, | ||
val opplysning: R?, | ||
) | ||
|
||
interface Svar { | ||
val innhold: Any | ||
} | ||
|
||
data class FritekstSvar( | ||
override val innhold: String, | ||
) : Svar | ||
|
||
data class DatoSvar( | ||
override val innhold: LocalDate, | ||
) : Svar | ||
|
||
data class EnumSvar<E : Enum<E>>( | ||
val verdi: E, | ||
override val innhold: String, | ||
) : Svar | ||
|
||
enum class JaNeiVetIkke { JA, NEI, VET_IKKE } |
Oops, something went wrong.