File tree Expand file tree Collapse file tree 4 files changed +62
-48
lines changed
dp-inntekt-api/src/main/kotlin/no/nav/dagpenger/inntekt Expand file tree Collapse file tree 4 files changed +62
-48
lines changed Original file line number Diff line number Diff line change 49
49
deploy-dev :
50
50
name : Deploy to dev
51
51
needs : [build]
52
- if : github.ref == 'refs/heads/main '
52
+ if : github.ref == 'refs/heads/test-logs '
53
53
runs-on : ubuntu-latest
54
54
permissions :
55
55
contents : " read"
@@ -64,21 +64,21 @@ jobs:
64
64
VARS : nais/vars.yaml
65
65
VAR : image=${{ needs.build.outputs.image }}
66
66
PRINT_PAYLOAD : true
67
- deploy-prod :
68
- name : Deploy to Production
69
- needs : [build, deploy-dev]
70
- if : github.ref == 'refs/heads/main'
71
- runs-on : ubuntu-latest
72
- permissions :
73
- contents : " read"
74
- id-token : " write"
75
- environment : prod-gcp
76
- steps :
77
- - uses : actions/checkout@v4
78
- - uses : nais/deploy/actions/deploy@v2
79
- env :
80
- CLUSTER : prod-gcp
81
- RESOURCE : nais/prod/nais.yaml
82
- VARS : nais/vars.yaml
83
- VAR : image=${{ needs.build.outputs.image }}
84
- PRINT_PAYLOAD : true
67
+ # deploy-prod:
68
+ # name: Deploy to Production
69
+ # needs: [build, deploy-dev]
70
+ # if: github.ref == 'refs/heads/main'
71
+ # runs-on: ubuntu-latest
72
+ # permissions:
73
+ # contents: "read"
74
+ # id-token: "write"
75
+ # environment: prod-gcp
76
+ # steps:
77
+ # - uses: actions/checkout@v4
78
+ # - uses: nais/deploy/actions/deploy@v2
79
+ # env:
80
+ # CLUSTER: prod-gcp
81
+ # RESOURCE: nais/prod/nais.yaml
82
+ # VARS: nais/vars.yaml
83
+ # VAR: image=${{ needs.build.outputs.image }}
84
+ # PRINT_PAYLOAD: true
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ internal fun Application.inntektApi(
76
76
install(StatusPages ) {
77
77
exception<Throwable > { call, cause ->
78
78
LOGGER .error(" Request failed!" , cause)
79
+ cause.printStackTrace()
79
80
val error =
80
81
Problem (
81
82
type = URI (" urn:dp:error:inntekt" ),
Original file line number Diff line number Diff line change @@ -176,28 +176,33 @@ fun Route.uklassifisertInntekt(
176
176
.mapToStoredInntekt(
177
177
inntektId = inntektId,
178
178
).let {
179
- val inntektPersonMapping = inntektStore.getInntektPersonMapping(inntektId)
180
- inntektStore.storeInntekt(
181
- StoreInntektCommand (
182
- inntektparametre =
183
- Inntektparametre (
184
- aktørId = inntektPersonMapping.aktørId,
185
- fødselsnummer = it.inntekt.ident.identifikator,
186
- regelkontekst =
187
- RegelKontekst (
188
- inntektPersonMapping.kontekstId,
189
- inntektPersonMapping.kontekstType,
190
- ),
191
- beregningsdato = inntektPersonMapping.beregningsdato,
192
- ),
193
- inntekt = it.inntekt,
194
- manueltRedigert =
195
- ManueltRedigert .from(
196
- true ,
197
- call.getSubject(),
198
- ),
199
- ),
200
- )
179
+ try {
180
+ val inntektPersonMapping = inntektStore.getInntektPersonMapping(inntektId)
181
+ inntektStore.storeInntekt(
182
+ StoreInntektCommand (
183
+ inntektparametre =
184
+ Inntektparametre (
185
+ aktørId = inntektPersonMapping.aktørId,
186
+ fødselsnummer = it.inntekt.ident.identifikator,
187
+ regelkontekst =
188
+ RegelKontekst (
189
+ inntektPersonMapping.kontekstId,
190
+ inntektPersonMapping.kontekstType,
191
+ ),
192
+ beregningsdato = inntektPersonMapping.beregningsdato,
193
+ ),
194
+ inntekt = it.inntekt,
195
+ manueltRedigert =
196
+ ManueltRedigert .from(
197
+ true ,
198
+ call.getSubject(),
199
+ ),
200
+ ),
201
+ )
202
+ } catch (e: Throwable ) {
203
+ logger.error { e }
204
+ throw e
205
+ }
201
206
}.let {
202
207
call.respond(HttpStatusCode .OK , it.inntektId.id)
203
208
}.also {
Original file line number Diff line number Diff line change 1
1
package no.nav.dagpenger.inntekt.v1.models
2
2
3
+ import mu.KotlinLogging
3
4
import no.nav.dagpenger.inntekt.db.InntektId
4
5
import no.nav.dagpenger.inntekt.db.StoredInntekt
5
6
import no.nav.dagpenger.inntekt.inntektskomponenten.v1.Aktoer
@@ -19,13 +20,20 @@ data class InntekterDto(
19
20
val mottaker : Inntektsmottaker ,
20
21
)
21
22
22
- fun InntekterDto.mapToStoredInntekt (inntektId : String ): StoredInntekt =
23
- StoredInntekt (
24
- inntektId = InntektId (id = inntektId),
25
- inntekt = mapToInntektkomponentResponse(this ),
26
- manueltRedigert = true ,
27
- timestamp = now(),
28
- )
23
+ fun InntekterDto.mapToStoredInntekt (inntektId : String ): StoredInntekt {
24
+ val logger = KotlinLogging .logger {}
25
+ return try {
26
+ StoredInntekt (
27
+ inntektId = InntektId (id = inntektId),
28
+ inntekt = mapToInntektkomponentResponse(this ),
29
+ manueltRedigert = true ,
30
+ timestamp = now(),
31
+ )
32
+ } catch (e: Throwable ) {
33
+ logger.error(" Kunne ikke mappe InntekterDto til StoredInntekt" , e)
34
+ throw e
35
+ }
36
+ }
29
37
30
38
private fun mapToInntektkomponentResponse (inntekterDto : InntekterDto ): InntektkomponentResponse {
31
39
val inntektPerÅrOgMåned = mutableMapOf<YearMonth , Pair <MutableList <Inntekt >? , MutableList <Avvik >? >> ()
You can’t perform that action at this time.
0 commit comments