use of se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType in project webcert by sklintyg.
the class ElegWebCertUserDetailsService method decorateWebCertUserWithSpecialiceringar.
private void decorateWebCertUserWithSpecialiceringar(HoSPersonType hosPerson, WebCertUser webCertUser) {
List<String> specialiteter = new ArrayList<>();
for (SpecialitetType st : hosPerson.getSpecialitet()) {
specialiteter.add(st.getNamn());
}
webCertUser.setSpecialiseringar(specialiteter);
}
use of se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType in project webcert by sklintyg.
the class MailNotificationServiceImplTest method testSendMailForIncomingAnswerHsaIsNotCalledIfPrivatePractitioner.
@Test
public void testSendMailForIncomingAnswerHsaIsNotCalledIfPrivatePractitioner() throws Exception {
// Given
HoSPersonType hoSPersonType = new HoSPersonType();
EnhetType enhet = new EnhetType();
enhet.setEpost("test@test.se");
enhet.setEnhetsnamn("TestEnhet");
hoSPersonType.setEnhet(enhet);
doReturn(hoSPersonType).when(ppService).getPrivatePractitioner(anyString(), isNull(), isNull());
MailNotification mailNotification = mailNotification("intygsId", MailNotificationServiceImpl.PRIVATE_PRACTITIONER_HSAID_PREFIX + "1234");
// When
mailNotificationService.sendMailForIncomingAnswer(mailNotification);
// Then
verify(hsaOrganizationUnitService, times(0)).getVardenhet(anyString());
}
use of se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType in project webcert by sklintyg.
the class PPServiceTest method checkNonExistingPerson.
@Test
public void checkNonExistingPerson() {
HoSPersonType hoSPersonType = service.getPrivatePractitioner("address", null, GetPrivatePractitionerResponderStub.PERSONNUMMER_NONEXISTING);
assertNull(hoSPersonType);
}
use of se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType in project webcert by sklintyg.
the class ValidatePrivatePractitionerResponderTest method verifyExistingPerson.
@Test
public void verifyExistingPerson() {
// Given
ObjectCreator objectCreator = new ObjectCreator();
HoSPersonType hoSPersonType = objectCreator.getHoSPersonType();
ValidatePrivatePractitionerType request = defaultRequest();
ValidatePrivatePractitionerResponseType expected = new ValidatePrivatePractitionerResponseType();
expected.setResultCode(ResultCodeEnum.OK);
// When
when(personStub.get(PERSONNUMMER)).thenReturn(hoSPersonType);
// Call web service
ValidatePrivatePractitionerResponseType actual = ws.validatePrivatePractitioner("address", request);
// Then
assertTrue(ResultCodeEnum.OK == actual.getResultCode());
verify(personStub, times(1)).get(PERSONNUMMER);
}
use of se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType in project webcert by sklintyg.
the class GetPrivatePractitionerResponderStub method getGetPrivatePractitionerResponseTypeForPnr.
private GetPrivatePractitionerResponseType getGetPrivatePractitionerResponseTypeForPnr(GetPrivatePractitionerType parameters) {
String id = parameters.getPersonalIdentityNumber();
Personnummer personnummer = Personnummer.createPersonnummer(id).orElse(null);
GetPrivatePractitionerResponseType response = new GetPrivatePractitionerResponseType();
// if matching -- create error response
if (PERSONNUMMER_ERROR_RESPONSE.equals(id)) {
response.setHoSPerson(null);
response.setResultCode(ResultCodeEnum.ERROR);
response.setResultText("FAILURE: an error occured while trying to get private practitioner with personal identity number: " + Personnummer.getPersonnummerHashSafe(personnummer) + " exists.");
return response;
}
// if matching -- throw exception
if (PERSONNUMMER_THROW_EXCEPTION.equals(id)) {
throw new SOAPFaultException(createSOAPFault());
}
HoSPersonType person = personStub.get(id);
if (person == null) {
response.setResultCode(ResultCodeEnum.INFO);
response.setResultText("No private practitioner with personal identity number: " + Personnummer.getPersonnummerHashSafe(personnummer) + " exists.");
} else {
response.setHoSPerson(person);
response.setResultCode(ResultCodeEnum.OK);
}
return response;
}
Aggregations