Skip to content

Commit

Permalink
F - Legger til sjekk for tom sakId for kall mot etterlatteService
Browse files Browse the repository at this point in the history
  • Loading branch information
dskarpas committed Nov 27, 2024
1 parent f0ef452 commit 863cc7b
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ class HentSakService(private val etterlatteService: EtterlatteService, private v
}

private fun hentGjennySak(sakIdFromSed: String?, euxCaseId: String): Sak? {
sakIdFromSed?.let { sakId ->
etterlatteService.hentGjennySak(sakId).fold(
onSuccess = { gjennySak -> return Sak(FAGSAK, gjennySak?.id.toString(), EY) },
onFailure = { logger.warn("Finner ingen gjennySak hos etterlatte for rinasakId: $euxCaseId, og sakID: $sakId") }
)
if (sakIdFromSed.isNullOrBlank()) {
logger.warn("sakIdFromSed er tom eller mangler for euxCaseId: $euxCaseId")
return null
}

etterlatteService.hentGjennySak(sakIdFromSed).fold(
onSuccess = { gjennySak -> return Sak(FAGSAK, gjennySak?.id.toString(), EY) },
onFailure = { logger.warn("Finner ingen gjennySak hos etterlatte for rinasakId: $euxCaseId, og sakID: $sakIdFromSed") }
)

return null
}

Expand Down

0 comments on commit 863cc7b

Please sign in to comment.