Search in sources :

Example 1 with CertificateStateHolder

use of se.inera.intyg.common.support.modules.support.api.CertificateStateHolder 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;
}
Also used : SendCertificateToRecipientResponseType(se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType) CertificateStateHolder(se.inera.intyg.common.support.modules.support.api.CertificateStateHolder) CertificateHolder(se.inera.intyg.common.support.modules.support.api.CertificateHolder) ResultType(se.riv.clinicalprocess.healthcond.certificate.v3.ResultType) StubModeAware(se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware) StubLatencyAware(se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)

Example 2 with CertificateStateHolder

use of se.inera.intyg.common.support.modules.support.api.CertificateStateHolder 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

CertificateHolder (se.inera.intyg.common.support.modules.support.api.CertificateHolder)2 CertificateStateHolder (se.inera.intyg.common.support.modules.support.api.CertificateStateHolder)2 StubModeAware (se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware)2 RevokeMedicalCertificateResponseType (se.inera.ifv.insuranceprocess.healthreporting.revokemedicalcertificateresponder.v1.RevokeMedicalCertificateResponseType)1 ResultOfCall (se.inera.ifv.insuranceprocess.healthreporting.v2.ResultOfCall)1 StubLatencyAware (se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)1 SendCertificateToRecipientResponseType (se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType)1 ResultType (se.riv.clinicalprocess.healthcond.certificate.v3.ResultType)1