use of se.inera.intyg.infra.integration.pu.model.PersonSvar in project webcert by sklintyg.
the class ElegWebCertUserDetailsServiceTest method buildPersonSvar.
private PersonSvar buildPersonSvar(boolean sekretessMarkerad, PersonSvar.Status status) {
Personnummer personnummer = Personnummer.createPersonnummer(PERSON_ID).get();
Person person = new Person(personnummer, sekretessMarkerad, false, "fornamn", "", "Efternamn", "gatan", "12345", "postort");
return new PersonSvar(person, status);
}
use of se.inera.intyg.infra.integration.pu.model.PersonSvar in project webcert by sklintyg.
the class RouteTest method setup.
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
MockEndpoint.resetMocks(camelContext);
when(moduleRegistry.getModuleApi(anyString())).thenReturn(moduleApi);
when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(new Fk7263Utlatande());
when(moduleApi.getIntygFromUtlatande(any())).thenReturn(NotificationTestHelper.createIntyg("fk7263"));
when(mockedPuService.getPerson(any())).thenReturn(new PersonSvar(NotificationTestHelper.buildPerson(false), PersonSvar.Status.FOUND));
}
use of se.inera.intyg.infra.integration.pu.model.PersonSvar in project webcert by sklintyg.
the class CopyUtkastServiceImpl method refreshPatientDetailsFromPUService.
private Person refreshPatientDetailsFromPUService(AbstractCreateCopyRequest copyRequest) {
Personnummer personnummer;
if (copyRequest.containsNyttPatientPersonnummer()) {
LOG.debug("Request contained a new personnummer to use for the copy");
personnummer = copyRequest.getNyttPatientPersonnummer();
} else {
personnummer = copyRequest.getPatient().getPersonId();
}
LOG.debug("Refreshing person data to use for the copy");
PersonSvar personSvar = getPersonSvar(personnummer);
if (PersonSvar.Status.ERROR.equals(personSvar.getStatus())) {
LOG.error("An error occured when using '{}' to lookup person data", personnummer.getPersonnummerHash());
return null;
} else if (PersonSvar.Status.NOT_FOUND.equals(personSvar.getStatus())) {
LOG.error("No person data was found using '{}' to lookup person data", personnummer.getPersonnummerHash());
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.DATA_NOT_FOUND, "No person data found using '" + personnummer.getPersonnummerHash() + "'");
}
return personSvar.getPerson();
}
use of se.inera.intyg.infra.integration.pu.model.PersonSvar in project webcert by sklintyg.
the class ElegWebCertUserDetailsService method decorateWebcertUserWithSekretessMarkering.
private void decorateWebcertUserWithSekretessMarkering(WebCertUser webCertUser, HoSPersonType hosPerson) {
// Make sure we have a valid personnr to work with..
Personnummer personNummer = Personnummer.createPersonnummer(hosPerson.getPersonId().getExtension()).orElseThrow(() -> new WebCertServiceException(WebCertServiceErrorCodeEnum.PU_PROBLEM, String.format("Can't determine sekretesstatus for invalid personId %s", hosPerson.getPersonId().getExtension())));
PersonSvar person = puService.getPerson(personNummer);
if (person.getStatus() == PersonSvar.Status.FOUND) {
webCertUser.setSekretessMarkerad(person.getPerson().isSekretessmarkering());
} else {
throw new WebCertServiceException(WebCertServiceErrorCodeEnum.PU_PROBLEM, String.format("PU replied with %s - Sekretesstatus cannot be determined for person %s", person.getStatus(), personNummer.getPersonnummerWithDash()));
}
}
use of se.inera.intyg.infra.integration.pu.model.PersonSvar in project webcert by sklintyg.
the class CopyUtkastServiceImplTest method expectCallToPUService.
@Before
public void expectCallToPUService() throws Exception {
PersonSvar personSvar = new PersonSvar(new Person(PATIENT_SSN, false, false, "Adam", "Bertilsson", "Cedergren", "Testgatan 12", "12345", "Testberga"), PersonSvar.Status.FOUND);
when(mockPUService.getPerson(PATIENT_SSN)).thenReturn(personSvar);
}
Aggregations