@Test public void embeddedSigningTest() throws Exception { String envelopeId = ""; // will retrieve // // Step 1 - login // DocuSignClient client = new DocuSignClient( TestSettings.TEST_EMAIL, TestSettings.TEST_PASSWORD, TestSettings.TEST_INTEGRATOR_KEY); boolean result = client.login(); Assert.assertTrue("login should work", result); // // STEP 2 - Send signature request from template // RequestSignatureFromTemplate request = new RequestSignatureFromTemplate(); request.setEmailSubject("From a Unit Test"); request.setEmailBlurb("Blurb from a Unit Test"); request.setTemplateId(TestSettings.TEMPLATE_ID); request.setStatus("sent"); // need to fill out who signs this TemplateRole role = new TemplateRole(); role.setName("Mike Borozdin"); role.setEmail(TestSettings.SAMPLE_EMAIL); role.setRoleName("Signer1"); role.setClientUserId("internal-id"); List<TemplateRole> roles = new ArrayList<TemplateRole>(1); roles.add(role); request.setTemplateRoles(roles); envelopeId = client.requestSignatureFromTemplate(request); Assert.assertTrue(envelopeId.length() > 0); // // STEP 3 - Get the Send View // String viewUrl = client.requestRecipientView( envelopeId, "Mike Borozdin", TestSettings.SAMPLE_EMAIL, "internal-id", "http://www.docusign.com/devcenter", "none"); System.out.println("Recipient View URL: " + viewUrl); Assert.assertTrue(viewUrl.length() > 0); Assert.assertTrue(viewUrl.startsWith(client.getServerUrl())); }
@Test public void requestSignatureTest() throws Exception { String envelopeId = ""; // will retrieve // // Step 1 - login // DocuSignClient client = new DocuSignClient( TestSettings.TEST_EMAIL, TestSettings.TEST_PASSWORD, TestSettings.TEST_INTEGRATOR_KEY); boolean result = client.login(); Assert.assertTrue("login should work", result); // // STEP 2 - Send signature request from template // RequestSignatureFromTemplate request = new RequestSignatureFromTemplate(); request.setEmailSubject("From a Unit Test"); request.setEmailBlurb("Blurb from a Unit Test"); request.setTemplateId(TestSettings.TEMPLATE_ID); request.setStatus("sent"); // need to fill out who signs this TemplateRole role = new TemplateRole(); role.setName("Mike Borozdin"); role.setEmail(TestSettings.SAMPLE_EMAIL); role.setRoleName("Signer1"); List<TemplateRole> roles = new ArrayList<TemplateRole>(1); roles.add(role); request.setTemplateRoles(roles); RequestSignatureResponse response = client.requestSignatureFromTemplate(request); Assert.assertNotNull(response); envelopeId = response.getEnvelopeId(); System.out.println("envelopeId = " + envelopeId); }