嵌入式人员签名流程?

时间:2015-01-06 16:09:20

标签: c# asp.net docusignapi

我'一直在试图拼了命这个工作,我'敢肯定它' S简单的东西,但我'在亏损米向右现在

我正在使用SDK for DocuSign示例。我已轻易修改它以尝试嵌入InPersonSigner:

private Recipient[] ConstructRecipients()
{
    // Construct the recipients
        var runningList = new List<Recipient>();

        for (int i = 1; i <= Request.Form.Count; i++)
        {
            if (null !=Request.Form[Keys.RecipientName + i])
            {
                var r = new Recipient
                    {
                        UserName = Request.Form[Keys.RecipientName + i],
                        Email = Request.Form[Keys.RecipientEmail + i] // <-- Using my DocuSign account email for simplicity
                    };

                // Get and set the security settings
                string security = Request.Form[Keys.RecipientSecurity + i];
                if (null != security)
                {
                    //...Code still here, just making this post shorter
                }
            }
            // Try InPerson Signing
            r.RequireIDLookup = false;
            r.UserName = "AccountUserName"; //<-- Again, My Account user name for simplicity
            r.SignerName = Request.Form[Keys.RecipientName + i]; // "BB King"
            r.Type = RecipientTypeCode.InPersonSigner;

            r.ID = i.ToString();
            //r.Type = RecipientTypeCode.Signer;

            if (null == Request.Form[Keys.RecipientInviteToggle + i])
                {
                    // we want an embedded signer
                    r.CaptiveInfo = new RecipientCaptiveInfo {ClientUserId = i.ToString()};
                }
                runningList.Add(r);
            }
            else
            {
                break;
            }
        }
        return runningList.ToArray();
    }

通过电子邮件发送时,它可以正常工作,主持人(我)收到电子邮件,并且能够通过&#34; In Person Singing Process&#34;。

发送嵌入式结果时(请记住我使用开箱即用的嵌入式部件的SDK - 包括ClientID),此消息出错:&#34;您已识别的收件人不是指定信封的有效收件人。&#34;

我需要添加什么才能使Embedded SDK示例与In Person签名会话一起使用?

----编辑---- 我发现了这个问题,但不知道最好的解决方案。显然,GetStatusAndDocs.aspx.cs文件包含以下行:

DocuSignAPI.FilteredEnvelopeStatuses statuses = client.RequestStatusesEx(filter);

Statuses包含一个EnvelopeStatus对象,它包含一个RecipientStatus对象。 RecipientStatus对象返回UserName字段作为我输入的SignerName,而不是我输入的UserName。

此RecipientStatus对象甚至没有SignerName属性/字段???为什么呢?

我应该使用哪个属性/字段传递给RequestRecipientToken用户名参数?如果它是我的一个现场代理,我需要知道如何完全识别这个人和他们的帐户,以确定他们去了现场,启动应用程序,然后亲自签名。

虽然到目前为止我已经想到了这个但仍处于迷失状态?

1 个答案:

答案 0 :(得分:1)

我找到了答案:

对于嵌入式RecipientTypeCode.InPersonSigner,电子邮件地址可能是假的,假的,垃圾等等(只要它是电子邮件格式&#34; somethingdotsomething@someplacedotsomething.whatever")。

当它是RecipientTypeCode.InPersonSigner时,您传递给RequestRecipientToken()的用户名是Actual Account Holder userName。不是您作为代理或组的某个部分访问您的主帐户的帐户,而不是签名者/收件人名称,而是用于嵌入式签名的帐户凭据上的帐户持有者名称。

可以按如下方式修改GetStatusAndDocs.aspx.cs页面上的代码来完成此任务:

    protected System.Web.UI.HtmlControls.HtmlGenericControl CreateEnvelopeTable(DocuSignAPI.EnvelopeStatus status)
    {
        var envelopeDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("div");

        int recipIndex = 0;

        foreach (DocuSignAPI.RecipientStatus recipient in status.RecipientStatuses)
        {
            var info = new System.Web.UI.HtmlControls.HtmlGenericControl("p");

            String recipId = "Recipient_Detail_" + status.EnvelopeID + "_" + recipient.RoutingOrder + "_" + recipient.UserName + "_" + recipient.Email + "_" + recipIndex++;

            info.InnerHtml = "<a href=\"javascript:toggle('" + recipId + "');\"><img src=\"images/plus.png\"></a> Recipient - " +
                recipient.UserName + ": " + recipient.Status.ToString();
            if (recipient.Status != DocuSignAPI.RecipientStatusCode.Completed && null != recipient.ClientUserId)
            {
                // For InPersonSigner, this will not work because the recipient.UserName needs to be the credentialed account actual user name, not the recipieint userName.
                //info.InnerHtml += " <input type=\"submit\" id=\"" + status.EnvelopeID + "\" value=\"Start Signing\" name=\"DocEnvelope+" + status.EnvelopeID + "&Email+" + recipient.Email + "&UserName+" +
                //    recipient.UserName + "&CID+" + recipient.ClientUserId + "\">";

                // In order to make this work for InPersonSigner, we need the envelope account (the credentialed account) userName instead of recipient.UserName
                // Get correct user name depending on recipient type
                string userName = (recipient.Type == RecipientTypeCode.InPersonSigner) ? status.ACHolder : recipient.UserName;

                info.InnerHtml += " <input type=\"submit\" id=\"" + status.EnvelopeID + "\" value=\"Start Signing\" name=\"DocEnvelope+" + status.EnvelopeID + "&Email+" + recipient.Email + "&UserName+" +
                    userName + "&CID+" + recipient.ClientUserId + "\">";
            }

            if (null != recipient.TabStatuses)
            {
                // Code here is the same, just making it shorter for this response
            }
            envelopeDiv.Controls.Add(info);
        }

        // Code between here and return is the same, just making it shorter for this response

        return envelopeDiv;
    }