Search in sources :

Example 11 with HoSPersonType

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);
}
Also used : ArrayList(java.util.ArrayList) SpecialitetType(se.riv.infrastructure.directory.privatepractitioner.v1.SpecialitetType)

Example 12 with HoSPersonType

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());
}
Also used : HoSPersonType(se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType) EnhetType(se.riv.infrastructure.directory.privatepractitioner.v1.EnhetType) Test(org.junit.Test)

Example 13 with HoSPersonType

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);
}
Also used : HoSPersonType(se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType) Test(org.junit.Test)

Example 14 with 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);
}
Also used : ValidatePrivatePractitionerType(se.riv.infrastructure.directory.privatepractitioner.validateprivatepractitionerresponder.v1.ValidatePrivatePractitionerType) ValidatePrivatePractitionerResponseType(se.riv.infrastructure.directory.privatepractitioner.validateprivatepractitionerresponder.v1.ValidatePrivatePractitionerResponseType) HoSPersonType(se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType) ObjectCreator(se.inera.intyg.webcert.integration.pp.util.ObjectCreator) Test(org.junit.Test)

Example 15 with HoSPersonType

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;
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) GetPrivatePractitionerResponseType(se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType) HoSPersonType(se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException)

Aggregations

HoSPersonType (se.riv.infrastructure.directory.privatepractitioner.v1.HoSPersonType)16 Test (org.junit.Test)9 EnhetType (se.riv.infrastructure.directory.privatepractitioner.v1.EnhetType)6 ArrayList (java.util.ArrayList)3 GetPrivatePractitionerResponseType (se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerResponseType)3 Address (javax.mail.Address)2 MimeMessage (javax.mail.internet.MimeMessage)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 Personnummer (se.inera.intyg.schemas.contract.Personnummer)2 ObjectCreator (se.inera.intyg.webcert.integration.pp.util.ObjectCreator)2 ValidatePrivatePractitionerResponseType (se.riv.infrastructure.directory.privatepractitioner.validateprivatepractitionerresponder.v1.ValidatePrivatePractitionerResponseType)2 MessagingException (javax.mail.MessagingException)1 WebServiceException (javax.xml.ws.WebServiceException)1 MailSendException (org.springframework.mail.MailSendException)1 HsaServiceCallException (se.inera.intyg.infra.integration.hsa.exception.HsaServiceCallException)1 Role (se.inera.intyg.infra.security.common.model.Role)1 GetPrivatePractitionerType (se.riv.infrastructure.directory.privatepractitioner.getprivatepractitionerresponder.v1.GetPrivatePractitionerType)1 HsaId (se.riv.infrastructure.directory.privatepractitioner.types.v1.HsaId)1 PersonId (se.riv.infrastructure.directory.privatepractitioner.types.v1.PersonId)1