获取用户可以直接签署文档的信封的Iframe URL

时间:2017-09-05 13:02:10

标签: java rest docusignapi

我是Docusign的新人。

我需要在Iframe中创建信封并显示信封,以添加用户的签名。但我没有通过用户直接签名来获取直接URL。 目前,用户正在获取该用户正在获取URL的邮件。点击该URL后,用户就可以签名了。

我使用下面的代码为Iframe生成网址

public ViewUrl getViewUrl(EnvelopeSummary envelopeSummary, Recipients recipients) throws ApiException{
        EnvelopesApi envelopesApi = new EnvelopesApi(DocusignFactory.appClient());
        RecipientViewRequest returnUrl = new RecipientViewRequest();
        returnUrl.setReturnUrl("https://www.docusign.com/devcenter");
        returnUrl.setAuthenticationMethod("email");
        Signer signer =  recipients.getSigners().get(0);
        returnUrl.setEmail("myemail@gamil.com");
        Tabs tabs = signer.getTabs();
        String usename= tabs.getFirstNameTabs().get(0).getName()+" "+tabs.getLastNameTabs().get(0).getName();
        returnUrl.setUserName(usename);

        return envelopesApi.createRecipientView(DocusignFactory.getDocusignLogin().getAccountId(), envelopeSummary.getEnvelopeId().toString(), returnUrl);}

通过使用上面的代码我得到了URL。但该网址只是显示信封。

从EnvelopeTemplate对象获取Recipients对象并根据我的输入修改对象

public Recipients populateRecipients(Recipients recipients) {
        Signer signer =  recipients.getSigners().get(0);
        signer.setEmail("myemil@gmail.com");
        signer.setName("My Name");
        //signer.setNote("Here");
        signer.setRecipientId("1");
        signer.setClientUserId("1001");
        signer.setDeliveryMethod("Email");
        Tabs tabs = signer.getTabs();

        DateSigned dateSigned =  tabs.getDateSignedTabs().get(0);
        dateSigned.setValue("01/01/2017");
        dateSigned.setDocumentId("1");
        dateSigned.setRecipientId("1");
        //dateSigned.setTabId("1");
        List<DateSigned> dateSigneds = new ArrayList<DateSigned>();
        dateSigneds.add(dateSigned);
        tabs.setDateSignedTabs(dateSigneds);

        EmailAddress emailAddress =tabs.getEmailAddressTabs().get(0);
        emailAddress.setName("myemil@gmail.com");
        emailAddress.setDocumentId("");
        emailAddress.setRecipientId("1");
        //emailAddress.setTabId("2");
        List<EmailAddress> emailAddresss = new ArrayList<EmailAddress>();
        emailAddresss.add(emailAddress);
        tabs.setEmailAddressTabs(emailAddresss);

        FirstName firstName = tabs.getFirstNameTabs().get(0);
        firstName.setName("firstName");
        firstName.setDocumentId("1");
        firstName.setRecipientId("1");
        //firstName.setTabId("3");
        List<FirstName> firstNames = new ArrayList<FirstName>();
        firstNames.add(firstName);
        tabs.setFirstNameTabs(firstNames);

        LastName lastName = tabs.getLastNameTabs().get(0);
        lastName.setName("lastName");
        lastName.setDocumentId("1");
        lastName.setRecipientId("1");
        //lastName.setTabId("4");
        List<LastName> lastNames = new ArrayList<LastName>();
        lastNames.add(lastName);
        tabs.setLastNameTabs(lastNames);

        signer.setTabs(tabs);
        List<Signer> signers = new ArrayList<Signer>();
        signers.add(signer);
        recipients.setSigners(signers);
        return recipients;

1 个答案:

答案 0 :(得分:0)

您错过了收件人视图(https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeViews/createRecipient)方法所需的参数之一 -

clientUserId发件人创建的值,显示收件人是嵌入的(俘虏)。最多100个字符。 为clientUserId创建一个值,并在创建事务时将其包含在签名者中(当您发送签名请求时)。

然后在您想要收件人视图时包含它。这是一项安全措施,可确保您的网络应用程序可以对签名者进行身份验证。

仅为签名者提供clientUserId,您可以自行对其进行身份验证,并计划为他们提供嵌入式签名视图。