@Test public void findReturnErrorUrl() { String intygsId = UUID.randomUUID().toString(); Utkast utkastLocal = new Utkast(); utkastLocal.setIntygsTyp("lisjp"); utkastLocal.setIntygTypeVersion("1.1"); ReflectionTestUtils.setField(dssSignatureService, "dssClientEntityHostUrl", "https: ReflectionTestUtils.setField(dssSignatureService, "dssClientResponseHostUrl", "https: when(utkastRepository.findById(anyString())).thenReturn(utkastOptional); when(utkastOptional.isPresent()).thenReturn(true); when(utkastOptional.get()).thenReturn(utkastLocal); String returnUrl = dssSignatureService.findReturnErrorUrl(intygsId, "123"); assertEquals(String.format("https: }
public String findReturnErrorUrl(String intygsId, String ticketId) { var utkastOptional = utkastRepository.findById(intygsId); if (utkastOptional.isPresent()) { var utkast = utkastOptional.get(); var intygsTyp = utkast.getIntygsTyp(); var intygTypeVersion = utkast.getIntygTypeVersion(); return String .format("%s/#/%s/%s/edit/%s/?error&ticket=%s", dssClientResponseHostUrl, intygsTyp, intygTypeVersion, intygsId, ticketId); } else { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Can't find certificate to return to!"); } }
DssSignatureService { public String findReturnErrorUrl(String intygsId, String ticketId) { var utkastOptional = utkastRepository.findById(intygsId); if (utkastOptional.isPresent()) { var utkast = utkastOptional.get(); var intygsTyp = utkast.getIntygsTyp(); var intygTypeVersion = utkast.getIntygTypeVersion(); return String .format("%s/#/%s/%s/edit/%s/?error&ticket=%s", dssClientResponseHostUrl, intygsTyp, intygTypeVersion, intygsId, ticketId); } else { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Can't find certificate to return to!"); } } }
DssSignatureService { public String findReturnErrorUrl(String intygsId, String ticketId) { var utkastOptional = utkastRepository.findById(intygsId); if (utkastOptional.isPresent()) { var utkast = utkastOptional.get(); var intygsTyp = utkast.getIntygsTyp(); var intygTypeVersion = utkast.getIntygTypeVersion(); return String .format("%s/#/%s/%s/edit/%s/?error&ticket=%s", dssClientResponseHostUrl, intygsTyp, intygTypeVersion, intygsId, ticketId); } else { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Can't find certificate to return to!"); } } @Autowired  DssSignatureService(DssMetadataService dssMetadataService, DssSignMessageService dssSignMessageService,
        WebCertUserService userService, UtkastRepository utkastRepository, UnderskriftService underskriftService,
        RedisTicketTracker redisTicketTracker, MonitoringLogService monitoringLogService, IntygModuleRegistry moduleRegistry); }
DssSignatureService { public String findReturnErrorUrl(String intygsId, String ticketId) { var utkastOptional = utkastRepository.findById(intygsId); if (utkastOptional.isPresent()) { var utkast = utkastOptional.get(); var intygsTyp = utkast.getIntygsTyp(); var intygTypeVersion = utkast.getIntygTypeVersion(); return String .format("%s/#/%s/%s/edit/%s/?error&ticket=%s", dssClientResponseHostUrl, intygsTyp, intygTypeVersion, intygsId, ticketId); } else { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Can't find certificate to return to!"); } } @Autowired  DssSignatureService(DssMetadataService dssMetadataService, DssSignMessageService dssSignMessageService,
        WebCertUserService userService, UtkastRepository utkastRepository, UnderskriftService underskriftService,
        RedisTicketTracker redisTicketTracker, MonitoringLogService monitoringLogService, IntygModuleRegistry moduleRegistry); boolean isUnitInIeWhitelist(String currentCareUnitHsaId); DssSignRequestDTO createSignatureRequestDTO(SignaturBiljett sb); String createTransactionID(); @SuppressWarnings("unchecked") SignaturBiljett receiveSignResponse(String relayState, String eIdSignResponse); String findReturnErrorUrl(String intygsId, String ticketId); String findReturnUrl(String intygsId); SignaturBiljett updateSignatureTicketWithError(String relayState); }
DssSignatureService { public String findReturnErrorUrl(String intygsId, String ticketId) { var utkastOptional = utkastRepository.findById(intygsId); if (utkastOptional.isPresent()) { var utkast = utkastOptional.get(); var intygsTyp = utkast.getIntygsTyp(); var intygTypeVersion = utkast.getIntygTypeVersion(); return String .format("%s/#/%s/%s/edit/%s/?error&ticket=%s", dssClientResponseHostUrl, intygsTyp, intygTypeVersion, intygsId, ticketId); } else { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Can't find certificate to return to!"); } } @Autowired  DssSignatureService(DssMetadataService dssMetadataService, DssSignMessageService dssSignMessageService,
        WebCertUserService userService, UtkastRepository utkastRepository, UnderskriftService underskriftService,
        RedisTicketTracker redisTicketTracker, MonitoringLogService monitoringLogService, IntygModuleRegistry moduleRegistry); boolean isUnitInIeWhitelist(String currentCareUnitHsaId); DssSignRequestDTO createSignatureRequestDTO(SignaturBiljett sb); String createTransactionID(); @SuppressWarnings("unchecked") SignaturBiljett receiveSignResponse(String relayState, String eIdSignResponse); String findReturnErrorUrl(String intygsId, String ticketId); String findReturnUrl(String intygsId); SignaturBiljett updateSignatureTicketWithError(String relayState); static final String RESULTMAJOR_SUCCESS; static final String REQUESTED_SIGN_ALGORITHM; }