use of se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType in project webcert by sklintyg.
the class SendCertificateToRecipientResponderStub method sendCertificateToRecipient.
@Override
@StubLatencyAware
@StubModeAware
public SendCertificateToRecipientResponseType sendCertificateToRecipient(String logicalAddress, SendCertificateToRecipientType parameters) {
CertificateHolder fromStore = intygStore.getIntygForCertificateId(parameters.getIntygsId().getExtension());
SendCertificateToRecipientResponseType responseType = new SendCertificateToRecipientResponseType();
if (fromStore == null) {
ResultType resultOfCall = new ResultType();
resultOfCall.setResultCode(ResultCodeType.ERROR);
resultOfCall.setErrorId(ErrorIdType.APPLICATION_ERROR);
responseType.setResult(resultOfCall);
return responseType;
}
intygStore.addStatus(parameters.getIntygsId().getExtension(), new CertificateStateHolder("FKASSA", CertificateState.SENT, LocalDateTime.now()));
ResultType resultType = new ResultType();
resultType.setResultCode(ResultCodeType.OK);
responseType.setResult(resultType);
return responseType;
}
use of se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType in project webcert by sklintyg.
the class CertificateSendProcessorTest method testSendCertificateThrowsTemporaryOnTechnicalError.
@Test(expected = TemporaryException.class)
public void testSendCertificateThrowsTemporaryOnTechnicalError() throws Exception {
// Given
SendCertificateToRecipientResponseType response = createResponse(ResultCodeType.ERROR, ErrorIdType.TECHNICAL_ERROR);
when(sendServiceClient.sendCertificate(INTYGS_ID1, PERSON_ID1, SKICKAT_AV, RECIPIENT1, LOGICAL_ADDRESS1)).thenReturn(response);
// When
certificateSendProcessor.process(SKICKAT_AV, INTYGS_ID1, PERSON_ID1, RECIPIENT1, LOGICAL_ADDRESS1);
// Then
verify(sendServiceClient).sendCertificate(INTYGS_ID1, PERSON_ID1, SKICKAT_AV, RECIPIENT1, LOGICAL_ADDRESS1);
}
use of se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType in project webcert by sklintyg.
the class CertificateSendProcessorTest method testSendCertificateThrowsPermanentOnRevokedError.
@Test(expected = PermanentException.class)
public void testSendCertificateThrowsPermanentOnRevokedError() throws Exception {
// Given
SendCertificateToRecipientResponseType response = createResponse(ResultCodeType.ERROR, ErrorIdType.REVOKED);
when(sendServiceClient.sendCertificate(INTYGS_ID1, PERSON_ID1, SKICKAT_AV, RECIPIENT1, LOGICAL_ADDRESS1)).thenReturn(response);
// When
certificateSendProcessor.process(SKICKAT_AV, INTYGS_ID1, PERSON_ID1, RECIPIENT1, LOGICAL_ADDRESS1);
// Then
verify(sendServiceClient).sendCertificate(INTYGS_ID1, PERSON_ID1, SKICKAT_AV, RECIPIENT1, LOGICAL_ADDRESS1);
}
use of se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType in project webcert by sklintyg.
the class SendCertificateServiceClientImpl method sendCertificate.
@Override
public SendCertificateToRecipientResponseType sendCertificate(String intygsId, String personId, String skickatAvJson, String recipient, String logicalAddress) {
validateArgument(intygsId, "Cannot send certificate, argument 'intygsId' is null or empty.");
validateArgument(personId, "Cannot send certificate, argument 'personId' is null or empty.");
validateArgument(skickatAvJson, "Cannot send certificate, argument 'skickatAvJson' is null or empty.");
validateArgument(recipient, "Cannot send certificate, argument 'recipient' is null or empty.");
validateArgument(logicalAddress, "Cannot send certificate, argument 'logicalAddress' is null or empty.");
HoSPersonal skickatAv = parseJson(skickatAvJson);
SendCertificateToRecipientType request = SendCertificateToRecipientTypeConverter.convert(intygsId, personId, skickatAv, recipient);
return sendService.sendCertificateToRecipient(logicalAddress, request);
}
use of se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType in project webcert by sklintyg.
the class SendCertificateServiceClientTest method testSendCertificateOk.
@Test
public void testSendCertificateOk() {
when(response.getResult()).thenReturn(buildResultOfCall(ResultCodeType.OK));
when(sendService.sendCertificateToRecipient(anyString(), any(SendCertificateToRecipientType.class))).thenReturn(response);
SendCertificateToRecipientResponseType resp = testee.sendCertificate(INTYGS_ID, PERSON_ID, SKICKAT_AV_JSON, RECIPIENT, LOGICAL_ADDRESS);
assertEquals(ResultCodeType.OK, resp.getResult().getResultCode());
}
Aggregations