Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bytt til å bruke vedtak/perioder for tiltakspenger #1515

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,46 @@ servers:
security:
- Authorization: []
paths:
/behandling:
post:
description: ""
responses:
"400":
description: "Bad Request"
content:
'*/*':
schema:
$ref: "#/components/schemas/ErrorJson"
"200":
description: "OK"
content:
'*/*':
schema:
type: "object"
/behandlinger/perioder:
post:
tags:
- Tiltakspenger
description: ""
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/VedtakReqDTO"
required: true
responses:
"400":
description: "Bad Request"
content:
'*/*':
schema:
$ref: "#/components/schemas/MappingError"
"200":
description: "OK"
content:
application/json:
schema:
$ref: "#/components/schemas/BehandlingPerioderResponse"
/isalive:
get:
tags:
Expand Down Expand Up @@ -38,6 +78,31 @@ paths:
examples:
Example#1:
value: "READY"
"503":
description: "Service Unavailable"
content:
text/plain:
schema:
type: "string"
examples:
Example#1:
value: "NOT READY"
/vedtak:
post:
description: ""
responses:
"400":
description: "Bad Request"
content:
'*/*':
schema:
$ref: "#/components/schemas/ErrorJson"
"200":
description: "OK"
content:
'*/*':
schema:
type: "object"
/vedtak/detaljer:
post:
tags:
Expand All @@ -52,18 +117,12 @@ paths:
responses:
"400":
description: "Bad Request"
content:
'*/*':
schema:
$ref: "#/components/schemas/MappingError"
"200":
description: "OK"
content:
'*/*':
application/json:
schema:
type: "array"
items:
$ref: "#/components/schemas/Vedtak"
$ref: "#/components/schemas/VedtakDetaljer"
/vedtak/perioder:
post:
tags:
Expand All @@ -85,20 +144,21 @@ paths:
"200":
description: "OK"
content:
'*/*':
application/json:
schema:
type: "array"
items:
$ref: "#/components/schemas/Periode"
$ref: "#/components/schemas/VedtakPerioderResponse"
components:
schemas:
ExceptionResponse:
ErrorJson:
type: "object"
properties:
message:
melding:
type: "string"
kode:
type: "string"
required:
- "message"
- "melding"
- "kode"
VedtakReqDTO:
type: "object"
properties:
Expand All @@ -108,63 +168,138 @@ components:
type: "string"
tom:
type: "string"
MappingError:
type: "object"
VedtakDetaljer:
type: "array"
items:
type: "object"
properties:
fom:
type: "string"
format: "date"
description: "The start date in YYYY-MM-DD format"
tom:
type: "string"
format: "date"
description: "The end date in YYYY-MM-DD format"
antallDager:
type: "number"
description: "The number of days"
dagsatsTiltakspenger:
type: "integer"
description: "The daily rate for tiltakspenger"
dagsatsBarnetillegg:
type: "integer"
description: "The daily rate for barnetillegg"
antallBarn:
type: "integer"
description: "The number of children"
relaterteTiltak:
type: "string"
description: "Related measures"
rettighet:
type: "string"
enum:
- TILTAKSPENGER
- BARNETILLEGG
- TILTAKSPENGER_OG_BARNETILLEGG
- INGENTING
description: "The right associated with the vedtak"
vedtakId:
type: "string"
description: "The ID of the vedtak"
sakId:
type: "string"
description: "The ID of the case"
saksnummer:
type: "string"
description: "The case number"
kilde:
type: "string"
description: "The source of the vedtak"
required: [ "fom", "tom", "antallDager", "dagsatsTiltakspenger", "dagsatsBarnetillegg", "antallBarn", "relaterteTiltak", "rettighet", "vedtakId", "sakId", "saksnummer", "kilde" ]
VedtakPerioderResponse:
type: array
items:
type: object
properties:
vedtakId:
type: string
description: 'Id for vedtaket, enten fra arena eller tpsak'
rettighet:
type: string
enum:
- TILTAKSPENGER
- TILTAKSPENGER_OG_BARNETILLEGG
description: Rettigheten fra vedtaket
periode:
$ref: '#/components/schemas/Periode'
kilde:
type: string
enum:
- TPSAK
- ARENA
description: Kilden for vedtaket
barnetillegg:
type: object
properties:
perioder:
type: array
items:
$ref: '#/components/schemas/Barnetilleggperiode'
required:
- vedtakId
- rettighet
- periode
- kilde
Periode:
type: object
required:
- fraOgMed
- tilOgMed
properties:
feilmelding:
type: "string"
fraOgMed:
type: string
format: date
description: Startdato på format YYYY-MM-DD
tilOgMed:
type: string
format: date
description: Sluttdato på format YYYY-MM-DD
Barnetilleggperiode:
type: object
required:
- "feilmelding"
Vedtak:
type: "object"
- antallBarn
- periode
properties:
fom:
type: "string"
format: "date"
tom:
type: "string"
format: "date"
antallDager:
type: "number"
format: "double"
dagsatsTiltakspenger:
type: "integer"
format: "int32"
dagsatsBarnetillegg:
type: "integer"
format: "int32"
antallBarn:
type: "integer"
format: "int32"
relaterteTiltak:
type: "string"
rettighet:
type: "string"
enum:
- "TILTAKSPENGER"
- "BARNETILLEGG"
- "TILTAKSPENGER_OG_BARNETILLEGG"
- "INGENTING"
vedtakId:
type: "string"
sakId:
type: "string"
required:
- "fom"
- "tom"
- "relaterteTiltak"
- "rettighet"
- "vedtakId"
- "sakId"
Periode:
type: integer
description: Antall barn
periode:
$ref: '#/components/schemas/Periode'
BehandlingPerioderResponse:
type: array
items:
type: object
properties:
behandlingId:
type: string
description: 'The ID of the behandling. Ulid, prefixed with ''beh_'''
fom:
type: string
format: date
description: The start date in YYYY-MM-DD format
tom:
type: string
format: date
description: The end date in YYYY-MM-DD format
required:
- behandlingId
- fom
- tom
MappingError:
type: "object"
properties:
fom:
type: "string"
format: "date"
tom:
feilmelding:
type: "string"
format: "date"
required:
- "fom"
- "tom"
- "feilmelding"
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import no.nav.common.health.selftest.SelfTestCheck
import no.nav.common.types.identer.Fnr
import no.nav.common.utils.UrlUtils
import no.nav.modiapersonoversikt.consumer.tiltakspenger.generated.apis.TiltakspengerApi
import no.nav.modiapersonoversikt.consumer.tiltakspenger.generated.models.Vedtak
import no.nav.modiapersonoversikt.consumer.tiltakspenger.generated.models.VedtakPerioderResponseInner
import no.nav.modiapersonoversikt.consumer.tiltakspenger.generated.models.VedtakReqDTO
import no.nav.modiapersonoversikt.infrastructure.ping.Pingable
import org.springframework.cache.annotation.CacheConfig
import org.springframework.cache.annotation.Cacheable

interface TiltakspengerService {
fun hentVedtakDetaljer(
fun hentVedtakPerioder(
fodselsnummer: Fnr,
fom: String?,
tom: String?,
): List<Vedtak>
): List<VedtakPerioderResponseInner>
}

@CacheConfig(cacheNames = ["tiltakspengerCache"], keyGenerator = "userkeygenerator")
Expand All @@ -25,11 +25,12 @@ open class TiltakspengerServiceImpl(
) : TiltakspengerService,
Pingable {
@Cacheable
override fun hentVedtakDetaljer(
override fun hentVedtakPerioder(
fodselsnummer: Fnr,
fom: String?,
tom: String?,
): List<Vedtak> = tiltakspengerApi.vedtakDetaljerPost(vedtakReqDTO = VedtakReqDTO(ident = fodselsnummer.get(), fom, tom)).orEmpty()
): List<VedtakPerioderResponseInner> =
tiltakspengerApi.vedtakPerioderPost(vedtakReqDTO = VedtakReqDTO(ident = fodselsnummer.get(), fom, tom)).orEmpty()

override fun ping() =
SelfTestCheck("Tiltakspenger datadeling", true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import no.nav.modiapersonoversikt.consumer.pensjon.PensjonEtteroppgjorshistorikk
import no.nav.modiapersonoversikt.consumer.pensjon.PensjonSak
import no.nav.modiapersonoversikt.consumer.pensjon.PensjonService
import no.nav.modiapersonoversikt.consumer.tiltakspenger.TiltakspengerService
import no.nav.modiapersonoversikt.consumer.tiltakspenger.generated.models.Vedtak
import no.nav.modiapersonoversikt.consumer.tiltakspenger.generated.models.VedtakPerioderResponseInner
import no.nav.modiapersonoversikt.infrastructure.naudit.Audit
import no.nav.modiapersonoversikt.infrastructure.naudit.AuditIdentifier
import no.nav.modiapersonoversikt.infrastructure.naudit.AuditResources
Expand Down Expand Up @@ -63,11 +63,11 @@ class YtelseControllerV2
@PostMapping("tiltakspenger")
fun hentTiltakspenger(
@RequestBody fnrRequest: FnrDatoRangeRequest,
): List<Vedtak> =
): List<VedtakPerioderResponseInner> =
tilgangskontroll
.check(Policies.tilgangTilBruker(Fnr(fnrRequest.fnr)))
.get(Audit.describe(Audit.Action.READ, AuditResources.Person.Tiltakspenger, AuditIdentifier.FNR to fnrRequest.fnr)) {
tiltakspengerService.hentVedtakDetaljer(Fnr(fnrRequest.fnr), fnrRequest.fom, fnrRequest.tom)
tiltakspengerService.hentVedtakPerioder(Fnr(fnrRequest.fnr), fnrRequest.fom, fnrRequest.tom)
}

@PostMapping("pensjon")
Expand Down