diff --git a/README.md b/README.md index 361099c..b970e91 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,4 @@ https://github.com/FINTLabs/fint-flyt-instance-gateway-template (or call a frien 1. Install Bruno: `brew install --cask bruno` 2. Open folder `bruno` in Bruno -3. Get `user_session` cookie from https://flyt.vigoiks.no \ No newline at end of file +3. Get `user_session` cookie from https://flyt.vigoiks.no (NB! To make this work, you need to disable 'Send Cookies automatically' in the settings). \ No newline at end of file diff --git a/src/main/java/no/fintlabs/instance/gateway/IncomingInstanceMappingService.java b/src/main/java/no/fintlabs/instance/gateway/IncomingInstanceMappingService.java index 083bd77..b200fd8 100644 --- a/src/main/java/no/fintlabs/instance/gateway/IncomingInstanceMappingService.java +++ b/src/main/java/no/fintlabs/instance/gateway/IncomingInstanceMappingService.java @@ -29,38 +29,20 @@ public IncomingInstanceMappingService( @Override public Mono map(Long sourceApplicationId, IncomingInstance incomingInstance) { if (incomingInstance.getDokument() == null) { - IncomingInstance fiktivInstance = IncomingInstance.builder() - .instansId(incomingInstance.getInstansId()) - .dokumenttype(incomingInstance.getDokumenttype()) - .personalia(incomingInstance.getPersonalia()) - .kontaktinformasjon(incomingInstance.getKontaktinformasjon()) - .inntaksadresse(incomingInstance.getInntaksadresse()) - .dokument(Dokument.builder() - .tittel("Fiktivt dokument") - .dato("1970-01-01") - .filnavn("fiktiv.pdf") - .format("application/pdf") - .fil("RXQgdmFubGlnIHZlZGxlZ2cK") - .build()) - .tilleggsinformasjon(incomingInstance.getTilleggsinformasjon()) - .build(); - return postFile(sourceApplicationId, fiktivInstance) - .map(uuid -> InstanceObject.builder() - .valuePerKey(toValuePerKey(fiktivInstance, uuid)) - .build()); - }else { + return Mono.just(InstanceObject.builder() + .valuePerKey(toValuePerKey(incomingInstance, null)) + .build()); + } else { return postFile(sourceApplicationId, incomingInstance) .map(uuid -> InstanceObject.builder() .valuePerKey(toValuePerKey(incomingInstance, uuid)) .build()); } - } private static Map toValuePerKey(IncomingInstance incomingInstance, UUID uuid) { Set> entries = new HashSet<>(); - entries.add(Map.entry("personaliaFodselsnummer", incomingInstance.getPersonalia().getFodselsnummer())); entries.add(Map.entry("personaliaFornavn", incomingInstance.getPersonalia().getFornavn())); entries.add(Map.entry("personaliaMellomnavn", incomingInstance.getPersonalia().getMellomnavn())); diff --git a/src/test/java/no/fintlabs/instance/gateway/IncomingInstanceMappingServiceTest.java b/src/test/java/no/fintlabs/instance/gateway/IncomingInstanceMappingServiceTest.java index d1c7155..db3f9ee 100644 --- a/src/test/java/no/fintlabs/instance/gateway/IncomingInstanceMappingServiceTest.java +++ b/src/test/java/no/fintlabs/instance/gateway/IncomingInstanceMappingServiceTest.java @@ -116,8 +116,7 @@ void shouldReturnInstanceObjectWhenIncomingInstanceDoesHaveSomeTilleggsinformasj assertEquals("Oslo katedralskole", valuePerKey.get("tilleggsinformasjonSkolenavn")); assertNull(valuePerKey.get("tilleggsinformasjonSkolenummer")); } - - //@Test - Prøver oss med fiktivt dokument på instanser uten dokument + @Test void shouldReturnInstanceObjectWhenIncomingInstanceDoesNotHaveDocument() { UUID uuid = UUID.randomUUID(); when(fileClient.postFile(any(File.class))).thenReturn(Mono.just(uuid));