Search in sources :

Example 6 with StubModeAware

use of se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware in project webcert by sklintyg.

the class RevokeMedicalCertificateResponderStub method revokeMedicalCertificate.

@Override
@StubModeAware
public RevokeMedicalCertificateResponseType revokeMedicalCertificate(AttributedURIType attributedURIType, RevokeMedicalCertificateRequestType revokeMedicalCertificateRequestType) {
    CertificateHolder certResponseType = intygStore.getIntygForCertificateId(revokeMedicalCertificateRequestType.getRevoke().getLakarutlatande().getLakarutlatandeId());
    RevokeMedicalCertificateResponseType responseType = new RevokeMedicalCertificateResponseType();
    ResultOfCall resultOfCall = new ResultOfCall();
    if (certResponseType == null) {
        resultOfCall.setResultCode(ResultCodeEnum.ERROR);
        resultOfCall.setErrorId(ErrorIdEnum.APPLICATION_ERROR);
        responseType.setResult(resultOfCall);
        return responseType;
    }
    if (!isRevoked(certResponseType.getCertificateStates())) {
        intygStore.addStatus(certResponseType.getId(), new CertificateStateHolder(attributedURIType.getValue(), CertificateState.CANCELLED, LocalDateTime.now()));
    }
    resultOfCall.setResultCode(ResultCodeEnum.OK);
    responseType.setResult(resultOfCall);
    return responseType;
}
Also used : ResultOfCall(se.inera.ifv.insuranceprocess.healthreporting.v2.ResultOfCall) CertificateStateHolder(se.inera.intyg.common.support.modules.support.api.CertificateStateHolder) CertificateHolder(se.inera.intyg.common.support.modules.support.api.CertificateHolder) RevokeMedicalCertificateResponseType(se.inera.ifv.insuranceprocess.healthreporting.revokemedicalcertificateresponder.v1.RevokeMedicalCertificateResponseType) StubModeAware(se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware)

Aggregations

StubModeAware (se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware)6 CertificateHolder (se.inera.intyg.common.support.modules.support.api.CertificateHolder)4 StubLatencyAware (se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)3 CertificateStateHolder (se.inera.intyg.common.support.modules.support.api.CertificateStateHolder)2 ResultatTyp (se.inera.intygstjanster.ts.services.v1.ResultatTyp)2 RevokeMedicalCertificateResponseType (se.inera.ifv.insuranceprocess.healthreporting.revokemedicalcertificateresponder.v1.RevokeMedicalCertificateResponseType)1 ResultOfCall (se.inera.ifv.insuranceprocess.healthreporting.v2.ResultOfCall)1 GetMedicalCertificateResponseType (se.inera.intyg.clinicalprocess.healthcond.certificate.getmedicalcertificate.v1.GetMedicalCertificateResponseType)1 RegisterTSBasResponseType (se.inera.intygstjanster.ts.services.RegisterTSBasResponder.v1.RegisterTSBasResponseType)1 RegisterTSDiabetesResponseType (se.inera.intygstjanster.ts.services.RegisterTSDiabetesResponder.v1.RegisterTSDiabetesResponseType)1 ListCertificatesForCareResponseType (se.riv.clinicalprocess.healthcond.certificate.listcertificatesforcare.v3.ListCertificatesForCareResponseType)1 ListaType (se.riv.clinicalprocess.healthcond.certificate.listcertificatesforcare.v3.ListaType)1 SendCertificateToRecipientResponseType (se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType)1 HsaId (se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId)1 Intyg (se.riv.clinicalprocess.healthcond.certificate.v3.Intyg)1 ResultType (se.riv.clinicalprocess.healthcond.certificate.v3.ResultType)1