/** * Create Fast Track Package. * * @param packageId The id of the package to start FastTrack * @param signers The signers to get the signing url * @return The signing url */ public String startFastTrack(PackageId packageId, List<FastTrackSigner> signers) { String token = getFastTrackToken(packageId, true); String path = template.urlFor(UrlTemplate.START_FAST_TRACK_PATH).replace("{token}", token).build(); List<FastTrackRole> roles = new ArrayList<FastTrackRole>(); for (FastTrackSigner signer : signers) { FastTrackRole role = FastTrackRoleBuilder.newRoleWithId(signer.getId()) .withName(signer.getId()) .withSigner(signer) .build(); roles.add(role); } String json = Serialization.toJson(roles); try { String response = client.post(path, json); SigningUrl signingUrl = Serialization.fromJson(response, SigningUrl.class); return signingUrl.getUrl(); } catch (RequestException e) { throw new EslException("Could not start fast track.", e); } catch (Exception e) { throw new EslException("Could not start fast track." + " Exception: " + e.getMessage()); } }
private String getFastTrackUrl(PackageId packageId, Boolean signing) { String path = template .urlFor(UrlTemplate.FAST_TRACK_URL_PATH) .replace("{packageId}", packageId.getId()) .replace("{signing}", signing.toString()) .build(); try { String json = client.get(path); SigningUrl signingUrl = Serialization.fromJson(json, SigningUrl.class); return signingUrl.getUrl(); } catch (RequestException e) { throw new EslException("Could not get a fastTrack url.", e); } catch (Exception e) { throw new EslException("Could not get a fastTrack url." + " Exception: " + e.getMessage()); } }
private String getSigningUrl(PackageId packageId, Role role) { String path = template .urlFor(UrlTemplate.SIGNER_URL_PATH) .replace("{packageId}", packageId.getId()) .replace("{roleId}", role.getId()) .build(); try { String response = client.get(path); SigningUrl signingUrl = Serialization.fromJson(response, SigningUrl.class); return signingUrl.getUrl(); } catch (RequestException e) { throw new EslException("Could not get a signing url.", e); } catch (Exception e) { throw new EslException("Could not get a signing url." + " Exception: " + e.getMessage()); } }