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;
}
Aggregations