Skip to content

Commit

Permalink
Oppdater BeløpshistorikkGrunnlag (#436)
Browse files Browse the repository at this point in the history
* Oppdater BeløpshistorikkGrunnlag

* Oppdater BeløpshistorikkGrunnlag
  • Loading branch information
ugur93 authored Feb 4, 2025
1 parent d7fc8e5 commit c41789c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ fun stubKodeverkProvider() {
mockkStatic(::finnVisningsnavnSkattegrunnlag)
mockkStatic(::finnVisningsnavnLønnsbeskrivelse)
mockkStatic(::finnVisningsnavnForKode)
mockkStatic(::hentNavSkjemaKodeverk)
every { finnVisningsnavnForKode(any(), any()) } returns "Visningsnavn"
every { hentNavSkjemaKodeverk() } returns emptyMap()
every {
finnVisningsnavnLønnsbeskrivelse(any())
} returns "Visningsnavn lønnsbeskrivelse"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ package no.nav.bidrag.transport.behandling.felles.grunnlag

import no.nav.bidrag.domene.tid.ÅrMånedsperiode
import java.math.BigDecimal
import java.time.LocalDateTime

data class BeløpshistorikkGrunnlag(
val tidspunktInnhentet: LocalDateTime = LocalDateTime.now(),
val førsteIndeksreguleringsår: Int?,
val beløpshistorikk: List<BeløpshistorikkPeriode>,
) : GrunnlagInnhold

data class BeløpshistorikkPeriode(
val periode: ÅrMånedsperiode,
val beløp: BigDecimal,
val beløp: BigDecimal?,
val valutakode: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ data class HentStønadHistoriskRequest(
@Schema(description = "Personidenten til den som krever stønadem")
val kravhaver: Personident,
@Schema(description = "Tidspunkt som det ønskes å hente gyldige perioder for")
val gyldigTidspunkt: LocalDateTime,
val gyldigTidspunkt: LocalDateTime = LocalDateTime.now(),
)
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package no.nav.bidrag.transport.felles

import java.time.LocalDate
import java.time.LocalDateTime
import java.time.YearMonth
import java.time.format.DateTimeFormatter

val formatterCompact = DateTimeFormatter.ofPattern("yyyyMMdd")
val formatterCompactLocalDateTime = DateTimeFormatter.ofPattern("yyyyMMddHHmmss")
val formatterCompactYearMonth = DateTimeFormatter.ofPattern("yyyyMM")

fun LocalDate?.toCompactString(): String = this?.format(formatterCompact) ?: ""

fun LocalDateTime?.toCompactString(): String = this?.format(formatterCompactLocalDateTime) ?: ""

fun YearMonth?.toCompactString(): String = this?.format(formatterCompactYearMonth) ?: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package no.nav.bidrag.transport.felles

import io.kotest.matchers.shouldBe
import java.time.LocalDateTime
import kotlin.test.Test

class DateUtilsKtTest {
@Test
fun `skal konvertere dato til string`() {
val dato = LocalDateTime.of(2021, 1, 1, 2, 3, 4)
dato.toCompactString() shouldBe "20210101020304"
}
}

0 comments on commit c41789c

Please sign in to comment.