Search in sources :

Example 1 with StubModeAware

use of se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware 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)

Example 2 with StubModeAware

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

the class ListCertificatesForCareResponderStub method listCertificatesForCare.

@Override
@StubLatencyAware
@StubModeAware
public ListCertificatesForCareResponseType listCertificatesForCare(String logicalAddress, ListCertificatesForCareType parameters) {
    ListCertificatesForCareResponseType response = new ListCertificatesForCareResponseType();
    response.setIntygsLista(new ListaType());
    response.getIntygsLista().getIntyg();
    List<CertificateHolder> intygForEnhetAndPersonnummer = intygStore.getIntygForEnhetAndPersonnummer(parameters.getEnhetsId().stream().map(HsaId::getExtension).collect(Collectors.toList()), parameters.getPersonId().getExtension());
    for (CertificateHolder cert : intygForEnhetAndPersonnummer) {
        Intyg intyg = getIntyg(cert);
        intyg.getStatus().addAll(CertificateStateHolderConverter.toIntygsStatusType(cert.getCertificateStates()));
        response.getIntygsLista().getIntyg().add(intyg);
    }
    return response;
}
Also used : CertificateHolder(se.inera.intyg.common.support.modules.support.api.CertificateHolder) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) ListaType(se.riv.clinicalprocess.healthcond.certificate.listcertificatesforcare.v3.ListaType) HsaId(se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId) ListCertificatesForCareResponseType(se.riv.clinicalprocess.healthcond.certificate.listcertificatesforcare.v3.ListCertificatesForCareResponseType) StubModeAware(se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware) StubLatencyAware(se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)

Example 3 with StubModeAware

use of se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware 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 4 with StubModeAware

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

the class RegisterTSBasResponderStub method registerTSBas.

@Override
@StubModeAware
public RegisterTSBasResponseType registerTSBas(String logicalAddress, RegisterTSBasType parameters) {
    intygStore.addIntyg(buildStubInternalCertificate(parameters));
    RegisterTSBasResponseType resp = new RegisterTSBasResponseType();
    ResultatTyp resultatTyp = new ResultatTyp();
    resultatTyp.setResultCode(ResultCodeType.OK);
    resp.setResultat(resultatTyp);
    return resp;
}
Also used : ResultatTyp(se.inera.intygstjanster.ts.services.v1.ResultatTyp) RegisterTSBasResponseType(se.inera.intygstjanster.ts.services.RegisterTSBasResponder.v1.RegisterTSBasResponseType) StubModeAware(se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware)

Example 5 with StubModeAware

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

the class RegisterTSDiabetesResponderStub method registerTSDiabetes.

@Override
@StubModeAware
public RegisterTSDiabetesResponseType registerTSDiabetes(String logicalAddress, RegisterTSDiabetesType parameters) {
    intygStore.addIntyg(buildStubInternalCertificate(parameters));
    RegisterTSDiabetesResponseType resp = new RegisterTSDiabetesResponseType();
    ResultatTyp resultatTyp = new ResultatTyp();
    resultatTyp.setResultCode(ResultCodeType.OK);
    resp.setResultat(resultatTyp);
    return resp;
}
Also used : RegisterTSDiabetesResponseType(se.inera.intygstjanster.ts.services.RegisterTSDiabetesResponder.v1.RegisterTSDiabetesResponseType) ResultatTyp(se.inera.intygstjanster.ts.services.v1.ResultatTyp) 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