Docusign API - 自签名

时间:2016-05-24 15:56:31

标签: docusignapi

我们有一个要求,我们需要使用HTML链接向用户提供几个PDF表单,以便签名,但签名者应该是自签名者。换句话说,一旦签名者使用Docusign完成签名,他们应该能够下载签名文档。但是,如果HTML链接不希望接收这些已保存的文档,我们作为发件人,因为他们有个人身份信息。签名者将在稍后将这些文件单独上传到我们的申请中。

我搜索过,但无法找到为自签名者生成HTML链接的方法。我能够创建一个适用于普通签名者的原型,但不适用于自我签名者。

非常感谢任何帮助。现在这是我的代码右侧代码段:

        // specify the document we want signed
        string SignTest1File = @"C:\Users\skosuri.AA\Desktop\of0306.pdf";

        string SignTest2File = @"C:\Users\skosuri.AA\Desktop\epa-credit-release-authorization.pdf";

        // Enter recipient (signer) name and email address
        string recipientName = "Chris";
        string recipientEmail = "xxx.xxx@epa.gov";

        // instantiate api client with appropriate environment (for production change to www.docusign.net/restapi)
        string basePath = "https://demo.docusign.net/restapi";

        // instantiate a new api client
        ApiClient apiClient = new ApiClient(basePath);

        // set client in global config so we don't need to pass it to each API object
        Configuration.Default.ApiClient = apiClient;

        string authHeader = "{\"Username\":\"" + Username + "\", \"Password\":\"" + Password + "\", \"IntegratorKey\":\"" + IntegratorKey + "\"}";
        Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader);

        // we will retrieve this from the login() results
        string accountId = null;

        // the authentication api uses the apiClient (and X-DocuSign-Authentication header) that are set in Configuration object
        AuthenticationApi authApi = new AuthenticationApi();
        LoginInformation loginInfo = authApi.Login();

        // user might be a member of multiple accounts
        accountId = loginInfo.LoginAccounts[0].AccountId;

        Console.WriteLine("LoginInformation: {0}", loginInfo.ToJson());

        // Read a file from disk to use as a document
        byte[] fileBytes = File.ReadAllBytes(SignTest1File);

        byte[] fileBytes2 = File.ReadAllBytes(SignTest2File);

        EnvelopeDefinition envDef = new EnvelopeDefinition();
        envDef.EmailSubject = "Please complete and sign these documents";

        // Add a document to the envelope
        Document doc = new Document();
        doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes);
        doc.Name = "of0306.pdf";
        doc.DocumentId = "1";
        doc.TransformPdfFields = "true";


        envDef.Documents = new List<Document>();
        envDef.Documents.Add(doc);

        // Add a second document to the envelope
        Document doc2 = new Document();
        doc2.DocumentBase64 = System.Convert.ToBase64String(fileBytes2);
        doc2.Name = "epa-credit-release-authorization.pdf";
        doc2.DocumentId = "2";
        doc2.TransformPdfFields = "true";

        envDef.Documents.Add(doc2);

        // Add a recipient to sign the documeent
        Signer signer = new Signer();
        signer.Name = recipientName;
        signer.Email = recipientEmail;
        signer.RecipientId = "1";
        signer.DefaultRecipient = "true";

        // must set |clientUserId| to embed the recipient
        signer.ClientUserId = "1234";

        // Create a |SignHere| tab on the document for the recipient to sign
        signer.Tabs = new Tabs();
        signer.Tabs.SignHereTabs = new List<SignHere>();
        signer.Tabs.DateSignedTabs = new List<DateSigned>();
        signer.Tabs.FullNameTabs = new List<FullName>();

        SignHere signHere = new SignHere();

        signHere.AnchorString = "Applicant's Signature:";
        signHere.AnchorXOffset = "1.5";
        signHere.AnchorYOffset = "0";
        signHere.AnchorIgnoreIfNotPresent = "false";
        signHere.AnchorUnits = "inches";
        signHere.DocumentId = "1";
        signHere.RecipientId = "1";
        signer.Tabs.SignHereTabs.Add(signHere);

        DateSigned ds = new DateSigned();
        ds.PageNumber = "3";
        ds.XPosition = "380";
        ds.YPosition = "550";
        ds.DocumentId = "1";
        ds.RecipientId = "1";
        ds.TabLabel = "Date Signed";
        signer.Tabs.DateSignedTabs.Add(ds);

        // Create a |SignHere| tab on the second document for the recipient to sign

        SignHere signHere2 = new SignHere();


        signHere2.PageNumber = "1";
        signHere2.XPosition = "80";
        signHere2.YPosition = "375";
        signHere2.DocumentId = "2";
        signHere2.RecipientId = "1";
        signer.Tabs.SignHereTabs.Add(signHere2);

        FullName fn = new FullName();
        fn.PageNumber = "1";
        fn.XPosition = "80";
        fn.YPosition = "300";
        fn.DocumentId = "2";
        fn.RecipientId = "1";
        signer.Tabs.FullNameTabs.Add(fn);

        DateSigned ds2 = new DateSigned();
        ds2.PageNumber = "1";
        ds2.XPosition = "80";
        ds2.YPosition = "475";
        ds2.DocumentId = "2";
        ds2.RecipientId = "1";
        signer.Tabs.DateSignedTabs.Add(ds2);



        envDef.Recipients = new Recipients();
        envDef.Recipients.Signers = new List<Signer>();
        envDef.Recipients.Signers.Add(signer);

        // set envelope status to "sent" to immediately send the signature request
        envDef.Status = "sent";

        // Use the EnvelopesApi to create and send the signature request
        EnvelopesApi envelopesApi = new EnvelopesApi();
        EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);


        Console.WriteLine("EnvelopeSummary:\n{0}", JsonConvert.SerializeObject(envelopeSummary));

        RecipientViewRequest viewOptions = new RecipientViewRequest()
        {
            ReturnUrl = "https://www.epa.gov",
            ClientUserId = "1234",  // must match clientUserId set in step #2!
            AuthenticationMethod = "email",
            UserName = recipientName,
            Email = recipientEmail
        };

        // create the recipient view (aka signing URL)
        ViewUrl recipientView = envelopesApi.CreateRecipientView(accountId, envelopeSummary.EnvelopeId, viewOptions);

        // print the JSON response
        Console.WriteLine("ViewUrl:\n{0}", JsonConvert.SerializeObject(recipientView));

        // Start the embedded signing session!
        System.Diagnostics.Process.Start(recipientView.Url);

1 个答案:

答案 0 :(得分:2)

我不太明白你的问题。

您的应用可以使用“系统用户”(电子邮件帐户,例如“noreply@company.com”)作为发件人,并向“自我签名者”提交嵌入式签名请求。

这样“自我签名者”就可以填写信息和签名。

签名文档只能(通过DocuSign)显示给系统用户。您还可以设置清除策略。

但要求

,这不是一个友好的用户体验
  

签名者将在稍后将这些文件单独上传到我们的申请中。

相反,我建议您查看文本(数据)标签的concealValueOnDocument参数。

文档:

  

设置为true时,当收件人在字段中添加或修改信息时,该字段会正常显示,但数据不可见(字符由星号隐藏)给任何其他签名者或发件人。

     

信封完成后,发件人可通过DocuSign控制台中的表格数据链接获取信息。   此设置仅适用于文本框,不会影响列表框,单选按钮或复选框。

使用此设置可使签名者在签名时查看PII,但后续签名者或信息查看者无法看到该信息。

PII数据仍可通过API获取,因此您的集成可以根据需要进行处理。