使用复合模板的 Docusign 嵌入式签名
Docusign Embedded Signing with Composite Template
鉴于我有多个模板,假设:
模板一:A和Manager需要签字
模板二:只有A需要签名
是否可以将其组合成 1 个信封并在应用程序中显示?
我目前的顺序是:
* create an envelope for the template 2
* retrieve the uri
* call `POST /accounts/{accountId}/envelopes/{envelopeId}/views/recipient`
with body specifying the return url (back to my site)
* get the embedded signing url
* create another envelope for template 1
* retrieve the uri
* call `POST /accounts/{accountId}/envelopes/{envelopeId}/views/recipient`
with body specifying the return url
(embedded signing url for the above template)
* call `POST /accounts/{accountId}/envelopes/{envelopeId}/views/recipient`
with body specifying the return url
(embedded signing url for the above because it needs different signer)
* retrieve the embedded signing url
* open the embedded signing url on the UI
这种方式的问题是,如果用户在第一份文件上花费的时间太长(超过 5 分钟),url 将过期,他们将无法签署其余文件文档。
所以,经过一些谷歌搜索,听起来我应该使用复合模板,但我找不到任何关于如何检索嵌入式签名的示例 url。
注意:我使用的是嵌入式签名,所以我需要能够检索显示签名页面的 url,并且还指定了 return url 一旦签名完成。
更新
我使用 API Explorer 生成正确的 JSON,似乎适用于 1 个模板,将尝试用于多个模板和多个用户。
更新:
我创建了一个 JSON,它 运行(两个模板现在都在一个信封里,我可以看到并签名),但只有一个用户。我怎样才能使它起作用,以便其他人也可以签名?
即:模板1:2人需要在不同的地方签到,模板2:只有1人需要签到
下面是JSON,带有一些随机变量,例如模板id
{
"compositeTemplates": [
{
"inlineTemplates": [
{
"customFields": {
"listCustomFields": [
{
"name": "OpportunityId",
"required": "True",
"show": "False",
"value": "2096"
},
{
"name": "DocuInfoId",
"required": "True",
"show": "False",
"value": "2"
}
]
},
"recipients": {
"signers": [
{
"clientUserId": "1",
"email": "someone@email.com",
"name": "Some One",
"recipientId": "1",
"roleName": "Occupant",
"tabs": {
"dateTabs": [
{
"tabLabel": "*ExpDate",
"value": "2/20/2018"
}
],
"listTabs": [
{
"listItems": [
{
"selected": "False",
"text": "True",
"value": "True"
},
{
"selected": "True",
"text": "False",
"value": "False"
}
],
"tabLabel": "ShowCOI"
},
{
"listItems": [
{
"selected": "False",
"text": "Y",
"value": "Y"
},
{
"selected": "True",
"text": "N",
"value": "N"
}
],
"tabLabel": "BillingOption"
}
],
"numberTabs": [
{
"tabLabel": "*ValueOfGoods",
"value": ",000.00"
}
],
"radioGroupTabs": [
{
"groupName": "Some Radio",
"radios": [
{
"selected": "false",
"value": "on property"
},
{
"selected": "true",
"value": "off property"
}
]
},
{
"groupName": "ServiceSchedule",
"radios": [
{
"selected": "false",
"value": "Yes"
},
{
"selected": "true",
"value": "No"
}
]
}
],
"textTabs": [
{
"tabLabel": "*SomeLabel",
"value": "SomeValue"
},
{
"tabLabel": "*SomeAddress",
"value": "SomeAddress "
},
]
}
},
{
"clientUserId": "2",
"email": "managerone@email.com",
"name": "Manager One",
"recipientId": "2",
"roleName": "Owner"
}
]
},
"sequence": "1"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "<templateId1>"
}
]
},
{
"inlineTemplates": [
{
"customFields": {
"listCustomFields": [
{
"name": "OpportunityId",
"required": "True",
"show": "False",
"value": "2096"
},
{
"name": "DocuInfoId",
"required": "True",
"show": "False",
"value": "1"
}
]
},
"recipients": {
"signers": [
{
"clientUserId": "1",
"email": "someone@email.com",
"name": "Some One",
"recipientId": "1",
"roleName": "Occupant"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "2",
"templateId": "<templateId2>"
}
]
}
],
"emailSubject": "DocuSign API - Composite Templates",
"eventNotification": {
"envelopeEvents": [
{
"envelopeEventStatusCode": "Sent"
},
{
"envelopeEventStatusCode": "Completed",
"includeDocuments": "true"
}
],
"includeCertificateOfCompletion": "true",
"includeCertificateWithSoap": "false",
"includeDocumentFields": "false",
"includeDocuments": "false",
"includeEnvelopeVoidReason": "false",
"includeSenderAccountAsCustomField": "false",
"includeTimeZone": "true",
"loggingEnabled": "false",
"recipientEvents": [
{
"includeDocuments": "true",
"recipientEventStatusCode": "Completed"
}
],
"requireAcknowledgment": "true",
"signMessageWithX509Cert": "false",
"url": "http://localhost:8080/api/documents/docusign/available",
"useSoapInterface": "false"
},
"status": "sent"
}
我正在使用该函数来检索嵌入的签名 url,其中 uri 来自信封,clientUserId 是本例中的第一人称 1 for someone@email.com。我应该为 manageroneemail 调用它两次还是什么?
private string GetSignerUrl(string uri, string name, string email, string returnUrl, string clientUserId)
{
string recipientUrl = _baseUrl + uri + "/views/recipient";
RecipientViewRequestModel recipient1 = new RecipientViewRequestModel
{
clientUserId = clientUserId,
authenticationMethod = "email",
email = email,
returnUrl = returnUrl,
userName = name
};
// make call
string recipient1JsonSerialized = Newtonsoft.Json.JsonConvert.SerializeObject(recipient1);
HttpWebRequest request = InitializeRequest(recipientUrl, "POST", recipient1JsonSerialized);
string response = GetResponseBody(request);
string signerUrl = ParseDataFromResponse(response, "url"); // parse signing url
return signerUrl;
}
请在下面找到JSON请求使用复合模板添加两个模板,
{
"compositeTemplates": [
{
"compositeTemplateId": 1,
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": "AEmail@gmail.com",
"name": "A Name",
"recipientId": "1",
"roleName": "A",
"routingOrder": "1",
"clientUserId": "AEmail"
},
{
"email": "ManagerEmail@gmail.com",
"name": "Manager Name",
"recipientId": "2",
"roleName": "Manager",
"routingOrder": "2",
"clientUserId": "ManagerEmail"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "f9fd4d6f-834c-4632-a054-cedb3e79d123"
}
]
},
{
"compositeTemplateId": 2,
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": "AEmail@gmail.com",
"name": "A Name",
"recipientId": "1",
"roleName": "A",
"routingOrder": "1"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "56645b6f-21d2-4838-b92c-4d44df591e41"
}
]
}
],
"status": "sent"
}
鉴于我有多个模板,假设:
模板一:A和Manager需要签字 模板二:只有A需要签名
是否可以将其组合成 1 个信封并在应用程序中显示?
我目前的顺序是:
* create an envelope for the template 2
* retrieve the uri
* call `POST /accounts/{accountId}/envelopes/{envelopeId}/views/recipient`
with body specifying the return url (back to my site)
* get the embedded signing url
* create another envelope for template 1
* retrieve the uri
* call `POST /accounts/{accountId}/envelopes/{envelopeId}/views/recipient`
with body specifying the return url
(embedded signing url for the above template)
* call `POST /accounts/{accountId}/envelopes/{envelopeId}/views/recipient`
with body specifying the return url
(embedded signing url for the above because it needs different signer)
* retrieve the embedded signing url
* open the embedded signing url on the UI
这种方式的问题是,如果用户在第一份文件上花费的时间太长(超过 5 分钟),url 将过期,他们将无法签署其余文件文档。
所以,经过一些谷歌搜索,听起来我应该使用复合模板,但我找不到任何关于如何检索嵌入式签名的示例 url。
注意:我使用的是嵌入式签名,所以我需要能够检索显示签名页面的 url,并且还指定了 return url 一旦签名完成。
更新 我使用 API Explorer 生成正确的 JSON,似乎适用于 1 个模板,将尝试用于多个模板和多个用户。
更新:
我创建了一个 JSON,它 运行(两个模板现在都在一个信封里,我可以看到并签名),但只有一个用户。我怎样才能使它起作用,以便其他人也可以签名?
即:模板1:2人需要在不同的地方签到,模板2:只有1人需要签到
下面是JSON,带有一些随机变量,例如模板id
{
"compositeTemplates": [
{
"inlineTemplates": [
{
"customFields": {
"listCustomFields": [
{
"name": "OpportunityId",
"required": "True",
"show": "False",
"value": "2096"
},
{
"name": "DocuInfoId",
"required": "True",
"show": "False",
"value": "2"
}
]
},
"recipients": {
"signers": [
{
"clientUserId": "1",
"email": "someone@email.com",
"name": "Some One",
"recipientId": "1",
"roleName": "Occupant",
"tabs": {
"dateTabs": [
{
"tabLabel": "*ExpDate",
"value": "2/20/2018"
}
],
"listTabs": [
{
"listItems": [
{
"selected": "False",
"text": "True",
"value": "True"
},
{
"selected": "True",
"text": "False",
"value": "False"
}
],
"tabLabel": "ShowCOI"
},
{
"listItems": [
{
"selected": "False",
"text": "Y",
"value": "Y"
},
{
"selected": "True",
"text": "N",
"value": "N"
}
],
"tabLabel": "BillingOption"
}
],
"numberTabs": [
{
"tabLabel": "*ValueOfGoods",
"value": ",000.00"
}
],
"radioGroupTabs": [
{
"groupName": "Some Radio",
"radios": [
{
"selected": "false",
"value": "on property"
},
{
"selected": "true",
"value": "off property"
}
]
},
{
"groupName": "ServiceSchedule",
"radios": [
{
"selected": "false",
"value": "Yes"
},
{
"selected": "true",
"value": "No"
}
]
}
],
"textTabs": [
{
"tabLabel": "*SomeLabel",
"value": "SomeValue"
},
{
"tabLabel": "*SomeAddress",
"value": "SomeAddress "
},
]
}
},
{
"clientUserId": "2",
"email": "managerone@email.com",
"name": "Manager One",
"recipientId": "2",
"roleName": "Owner"
}
]
},
"sequence": "1"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "<templateId1>"
}
]
},
{
"inlineTemplates": [
{
"customFields": {
"listCustomFields": [
{
"name": "OpportunityId",
"required": "True",
"show": "False",
"value": "2096"
},
{
"name": "DocuInfoId",
"required": "True",
"show": "False",
"value": "1"
}
]
},
"recipients": {
"signers": [
{
"clientUserId": "1",
"email": "someone@email.com",
"name": "Some One",
"recipientId": "1",
"roleName": "Occupant"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "2",
"templateId": "<templateId2>"
}
]
}
],
"emailSubject": "DocuSign API - Composite Templates",
"eventNotification": {
"envelopeEvents": [
{
"envelopeEventStatusCode": "Sent"
},
{
"envelopeEventStatusCode": "Completed",
"includeDocuments": "true"
}
],
"includeCertificateOfCompletion": "true",
"includeCertificateWithSoap": "false",
"includeDocumentFields": "false",
"includeDocuments": "false",
"includeEnvelopeVoidReason": "false",
"includeSenderAccountAsCustomField": "false",
"includeTimeZone": "true",
"loggingEnabled": "false",
"recipientEvents": [
{
"includeDocuments": "true",
"recipientEventStatusCode": "Completed"
}
],
"requireAcknowledgment": "true",
"signMessageWithX509Cert": "false",
"url": "http://localhost:8080/api/documents/docusign/available",
"useSoapInterface": "false"
},
"status": "sent"
}
我正在使用该函数来检索嵌入的签名 url,其中 uri 来自信封,clientUserId 是本例中的第一人称 1 for someone@email.com。我应该为 manageroneemail 调用它两次还是什么?
private string GetSignerUrl(string uri, string name, string email, string returnUrl, string clientUserId)
{
string recipientUrl = _baseUrl + uri + "/views/recipient";
RecipientViewRequestModel recipient1 = new RecipientViewRequestModel
{
clientUserId = clientUserId,
authenticationMethod = "email",
email = email,
returnUrl = returnUrl,
userName = name
};
// make call
string recipient1JsonSerialized = Newtonsoft.Json.JsonConvert.SerializeObject(recipient1);
HttpWebRequest request = InitializeRequest(recipientUrl, "POST", recipient1JsonSerialized);
string response = GetResponseBody(request);
string signerUrl = ParseDataFromResponse(response, "url"); // parse signing url
return signerUrl;
}
请在下面找到JSON请求使用复合模板添加两个模板,
{
"compositeTemplates": [
{
"compositeTemplateId": 1,
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": "AEmail@gmail.com",
"name": "A Name",
"recipientId": "1",
"roleName": "A",
"routingOrder": "1",
"clientUserId": "AEmail"
},
{
"email": "ManagerEmail@gmail.com",
"name": "Manager Name",
"recipientId": "2",
"roleName": "Manager",
"routingOrder": "2",
"clientUserId": "ManagerEmail"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "f9fd4d6f-834c-4632-a054-cedb3e79d123"
}
]
},
{
"compositeTemplateId": 2,
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": "AEmail@gmail.com",
"name": "A Name",
"recipientId": "1",
"roleName": "A",
"routingOrder": "1"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "56645b6f-21d2-4838-b92c-4d44df591e41"
}
]
}
],
"status": "sent"
}