-
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.
Tsf 3739 send brev til tredjepart (#5276)
* Oppdater personopplysningerTsType.ts til å matche backend PersonopplysningDto.java Legger til property ektefelle i PersonopplysningerBasic, og endre property statsborgerskap til å inkludere navn property. Dette slik at den stemmer betre med det backend definerer og returnerer. * Forbetra mock data til story sak/sak-meldinger. Kan no sjå komponenten i meir reelle situasjoner i storybook, med data henta frå Q. * Fjern jest setup som kasta exception ved warning logging. Denne førte til at test av ny kode for sending av brev til tredjepart feila, pga at ein bruker ein form prop til både ein select og ein input der, ut frå andre valg. Når ein då satte verdi gjennom tekst input logga select komponent advarsel om at satt verdi ikkje fantes som option verdi. Dette førte igjen til at tester av dette feila. Test bør fungere mest mulig likt reell bruk av koden, og viss noko skal feile bør det kastast error, eller i alle fall logge som error. Ein advarsel er spesifikt ikkje meint å føre til fatal feil som det her gjorde. * GUI for sending av brev til tredjepart lagt til. I panelet for sending av brev er der no ein ny avkryssingsboks for "Send til tredjepartsmottaker". Denne visast når valgt brevmal returnert frå backend har prop støtterTredjepartsmottaker == true. Når bruker aktiverer denne avkrysning visast eit input felt for organisasjonsnr. Bruker kan deretter taste inn eit organisasjonsnr som brevet skal sendast til, istadenfor å velge det frå forhåndsdefinerte mottakere i nedtrekkslista. Når bruker fyller inn organisasjonsnr søkast namnet til organisasjonen opp og visast i panelet. Dette søket går foreløpig direkte til Brønnøysundregisteret sitt opne api, men skal endrast til å bruke eit nytt endepunkt på k9-sak backend. Foreløpig funksjonalitet er lagt inn så vi kan starte litt testing i Q uten å vente på backend implementasjon. Når bruker har fyllt inn tredjepartsmottaker og trykker send blir det utfyllte organisasjonsnr sendt til backend på samme måte som viss bruker valgte førehandsdefinert mottaker i nedtrekksliste. * CSP: La til data.brreg.no som tillatt connect-src (midlertidig). Tillater denne midlertidig slik at ny funksjonalitet for sending av brev til tredjepart kan testast i Q før eigen api backend for søk i enhetsregisteret er implementert. * Tillat nested-ternary i eslint config. * Lint fixes. * CSS lint fixes. * Minor testfix, MeldingIndex.spec.tsx. Text selector had not been changed after gui text changed.
- Loading branch information
Showing
33 changed files
with
777 additions
and
85 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
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
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
25 changes: 25 additions & 0 deletions
25
packages/sak-app/src/behandlingsupport/melding/MeldingBackendClient.ts
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { EregOrganizationLookupResponse } from "@k9-sak-web/types"; | ||
import { BackendApi } from "./MeldingIndex"; | ||
|
||
export default class MeldingBackendClient implements BackendApi { | ||
// TODO Bytt ut denne implementasjonen med ein som går mot eigen backend, og bruker requestApi, eller ein lågare nivå | ||
// http klient dependency injecta i konstruktør (axios) | ||
async getTredjepartsmottakerInfo(orgnr: string): Promise<EregOrganizationLookupResponse> { | ||
const resp = await fetch(`https://data.brreg.no/enhetsregisteret/api/enheter/${orgnr}`, { | ||
headers: { | ||
'Accept': 'application/vnd.brreg.enhetsregisteret.enhet.v2+json;charset=UTF-8' | ||
} | ||
}) | ||
if(resp.ok) { | ||
const json = await resp.json() | ||
return {name: json.navn} | ||
} | ||
if(resp.status === 400) { | ||
return {invalidOrgnum: true} | ||
} | ||
if(resp.status === 404) { | ||
return {notFound: true} | ||
} | ||
throw new Error(`Unexpected response from data.brreg.no: ${resp.status} - ${resp.statusText}`) | ||
} | ||
} |
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
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,3 +1,3 @@ | ||
export { default } from './src/MeldingerSakIndex'; | ||
export { default, type BackendApi as MeldingerSakIndexBackendApi } from './src/MeldingerSakIndex'; | ||
export { default as MessagesModalSakIndex } from './src/MessagesModalSakIndex'; | ||
export type { FormValues } from './src/components/Messages'; |
Oops, something went wrong.