-
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.
Rettet navn i ApplicationTestContext, lagt til to i BekreftelseMeldin…
…gTopology.kt, flyttet opprettelsen av bekreftelse til punctuator, lagt til fungerende punctuator test, endret logikk i KontrolerFrister.kt.
- Loading branch information
1 parent
3860f8a
commit 08badc2
Showing
8 changed files
with
82 additions
and
42 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
20 changes: 10 additions & 10 deletions
20
apps/bekreftelse-tjeneste/src/main/kotlin/no/nav/paw/bekreftelsetjeneste/KontrolerFrister.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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
package no.nav.paw.bekreftelsetjeneste | ||
|
||
import arrow.core.NonEmptyList | ||
import no.nav.paw.bekreftelsetjeneste.tilstand.Bekreftelse | ||
import no.nav.paw.bekreftelsetjeneste.tilstand.BekreftelseConfig | ||
import java.time.Instant | ||
|
||
fun Bekreftelse.erKlarForUtfylling(now: Instant): Boolean = | ||
gjelderTil.minus(BekreftelseConfig.bekreftelseTilgjengeligOffset).isAfter(now) | ||
now.isAfter(gjelderTil.minus(BekreftelseConfig.bekreftelseTilgjengeligOffset)) | ||
|
||
fun Bekreftelse.harFristUtloept(now: Instant): Boolean = | ||
gjelderTil.isBefore(now) | ||
now.isAfter(gjelderTil) | ||
|
||
fun Bekreftelse.erSisteVarselOmGjenstaaendeGraceTid(now: Instant): Boolean = | ||
sisteVarselOmGjenstaaendeGraceTid == null && gjelderTil.plus( | ||
sisteVarselOmGjenstaaendeGraceTid == null && now.isAfter(gjelderTil.plus( | ||
BekreftelseConfig.varselFoerGracePeriodeUtloept | ||
).isAfter(now) | ||
)) | ||
|
||
fun Bekreftelse.harGracePeriodeUtloept(now: Instant): Boolean = | ||
gjelderTil.plus(BekreftelseConfig.gracePeriode) | ||
.isAfter(now) | ||
now.isAfter(gjelderTil.plus(BekreftelseConfig.gracePeriode)) | ||
|
||
fun skalLageNyBekreftelseTilgjengelig(now: Instant, bekreftelser: List<Bekreftelse>): Boolean = | ||
bekreftelser.maxOf { it.gjelderTil } | ||
.minus(BekreftelseConfig.bekreftelseTilgjengeligOffset) | ||
.isAfter(now) | ||
fun skalLageNyBekreftelseTilgjengelig(now: Instant, bekreftelser: NonEmptyList<Bekreftelse>): Boolean = | ||
now.isAfter( | ||
bekreftelser.maxOf { it.gjelderTil }.minus(BekreftelseConfig.bekreftelseTilgjengeligOffset) | ||
) | ||
|
||
|
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
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
33 changes: 31 additions & 2 deletions
33
...else-tjeneste/src/test/kotlin/no/nav/paw/bekreftelsetjeneste/BekreftelsePunctuatorTest.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