Search in sources :

Example 1 with ReceiveMedicalCertificateQuestionResponseType

use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType in project webcert by sklintyg.

the class ReceiveQuestionResponderImpl method receiveMedicalCertificateQuestion.

@Override
public ReceiveMedicalCertificateQuestionResponseType receiveMedicalCertificateQuestion(AttributedURIType logicalAddress, ReceiveMedicalCertificateQuestionType request) {
    ReceiveMedicalCertificateQuestionResponseType response = new ReceiveMedicalCertificateQuestionResponseType();
    // Validate incoming request
    List<String> validationMessages = QuestionAnswerValidator.validate(request);
    if (!validationMessages.isEmpty()) {
        response.setResult(ResultOfCallUtil.failResult(Joiner.on(",").join(validationMessages)));
        return response;
    }
    // Transform to a FragaSvar object
    FragaSvar fragaSvar = converter.convert(request.getQuestion());
    // Notify stakeholders
    sendNotification(processQuestion(fragaSvar));
    // Set result and send response back to caller
    response.setResult(ResultOfCallUtil.okResult());
    return response;
}
Also used : FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) ReceiveMedicalCertificateQuestionResponseType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType)

Example 2 with ReceiveMedicalCertificateQuestionResponseType

use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType in project webcert by sklintyg.

the class ReceiveQuestionResponderImplTest method testReceiveQuestionValidationError.

@Test
public void testReceiveQuestionValidationError() {
    ReceiveMedicalCertificateQuestionType request = createRequest("RecieveQuestionAnswerResponders/question-from-fk-integrated.xml");
    // invalid
    request.getQuestion().setAmne(null);
    ReceiveMedicalCertificateQuestionResponseType response = receiveQuestionResponder.receiveMedicalCertificateQuestion(null, request);
    verifyZeroInteractions(mockNotificationService);
    verifyZeroInteractions(mockFragaSvarService);
    assertNotNull(response);
    assertEquals(ResultCodeEnum.ERROR, response.getResult().getResultCode());
    assertEquals(ErrorIdEnum.VALIDATION_ERROR, response.getResult().getErrorId());
    assertEquals("Amne är felaktigt", response.getResult().getErrorText());
}
Also used : ReceiveMedicalCertificateQuestionType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType) ReceiveMedicalCertificateQuestionResponseType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType) Test(org.junit.Test)

Example 3 with ReceiveMedicalCertificateQuestionResponseType

use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType in project webcert by sklintyg.

the class ReceiveQuestionResponderImplTest method testReceiveQuestionOK.

@Test
public void testReceiveQuestionOK() {
    FragaSvar fraga = buildFraga(INTEGRERAD_ENHET, Status.PENDING_INTERNAL_ACTION);
    when(mockFragaSvarService.processIncomingQuestion(any(FragaSvar.class))).thenReturn(fraga);
    ReceiveMedicalCertificateQuestionType request = createRequest("RecieveQuestionAnswerResponders/question-from-fk-integrated.xml");
    ReceiveMedicalCertificateQuestionResponseType response = receiveQuestionResponder.receiveMedicalCertificateQuestion(null, request);
    // should place notification on queue
    verify(mockNotificationService).sendNotificationForQuestionReceived(any(FragaSvar.class));
    assertNotNull(response);
    assertEquals(ResultCodeEnum.OK, response.getResult().getResultCode());
}
Also used : ReceiveMedicalCertificateQuestionType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType) ReceiveMedicalCertificateQuestionResponseType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType) Test(org.junit.Test)

Aggregations

ReceiveMedicalCertificateQuestionResponseType (se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType)3 Test (org.junit.Test)2 ReceiveMedicalCertificateQuestionType (se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType)2 FragaSvar (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)1