Search in sources :

Example 1 with GetMedicalCertificateResponseType

use of se.inera.intyg.clinicalprocess.healthcond.certificate.getmedicalcertificate.v1.GetMedicalCertificateResponseType in project webcert by sklintyg.

the class GetMedicalCertificateResponderStub method getMedicalCertificate.

@Override
@StubLatencyAware
@StubModeAware
public GetMedicalCertificateResponseType getMedicalCertificate(String logicalAddress, GetMedicalCertificateRequestType request) {
    GetMedicalCertificateResponseType response = new GetMedicalCertificateResponseType();
    CertificateHolder intygResponse = intygStore.getIntygForCertificateId(request.getCertificateId());
    if (intygResponse != null) {
        response.setMeta(ModelConverter.toCertificateMetaType(intygResponse));
        attachCertificateDocument(intygResponse, response);
        if (intygResponse.isRevoked()) {
            response.setResult(ResultTypeUtil.errorResult(ErrorIdType.REVOKED, String.format("Certificate '%s' has been revoked", intygResponse.getId())));
        } else {
            response.setResult(ResultTypeUtil.okResult());
        }
    } else {
        response.setResult(ResultTypeUtil.errorResult(ErrorIdType.VALIDATION_ERROR, "Intyg not found in stub"));
    }
    return response;
}
Also used : GetMedicalCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.getmedicalcertificate.v1.GetMedicalCertificateResponseType) CertificateHolder(se.inera.intyg.common.support.modules.support.api.CertificateHolder) StubModeAware(se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware) StubLatencyAware(se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)

Aggregations

GetMedicalCertificateResponseType (se.inera.intyg.clinicalprocess.healthcond.certificate.getmedicalcertificate.v1.GetMedicalCertificateResponseType)1 CertificateHolder (se.inera.intyg.common.support.modules.support.api.CertificateHolder)1 StubLatencyAware (se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)1 StubModeAware (se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware)1