Search in sources :

Example 1 with SendIntygConfiguration

use of se.inera.intyg.webcert.web.service.intyg.config.SendIntygConfiguration in project webcert by sklintyg.

the class IntygServiceImpl method sendIntyg.

@Override
public IntygServiceResult sendIntyg(String intygsId, String typ, String recipient, boolean delay) {
    Utlatande intyg = getUtlatandeForIntyg(intygsId, typ);
    verifyEnhetsAuth(intyg, true);
    if (isRevoked(intygsId, typ, false)) {
        LOG.debug("Cannot send certificate with id '{}', the certificate is revoked", intygsId);
        throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INVALID_STATE, "Certificate is revoked");
    }
    verifyNotReplacedBySignedIntyg(intygsId, "send");
    // WC-US-SM-001 - vi får ej skicka FK-intyg för sekretessmarkerad patient som innehåller personuppgifter.
    verifyNoExposureOfSekretessmarkeradPatient(intyg);
    SendIntygConfiguration sendConfig = new SendIntygConfiguration(recipient, webCertUserService.getUser());
    monitoringService.logIntygSent(intygsId, recipient);
    // send PDL log event
    LogRequest logRequest = LogRequestFactory.createLogRequestFromUtlatande(intyg);
    logRequest.setAdditionalInfo(sendConfig.getPatientConsentMessage());
    logService.logSendIntygToRecipient(logRequest);
    markUtkastWithSendDateAndRecipient(intygsId, recipient);
    return sendIntygToCertificateSender(sendConfig, intyg, delay);
}
Also used : SendIntygConfiguration(se.inera.intyg.webcert.web.service.intyg.config.SendIntygConfiguration) LogRequest(se.inera.intyg.webcert.web.service.log.dto.LogRequest) Utlatande(se.inera.intyg.common.support.model.common.internal.Utlatande) WebCertServiceException(se.inera.intyg.webcert.common.service.exception.WebCertServiceException)

Aggregations

Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)1 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)1 SendIntygConfiguration (se.inera.intyg.webcert.web.service.intyg.config.SendIntygConfiguration)1 LogRequest (se.inera.intyg.webcert.web.service.log.dto.LogRequest)1