У меня есть приложение Winforms vb.net, которое отправляет PDF-файлы в docusign для подписания. Вот моя проблема.Вкладки Docusign отсутствуют только при использовании нескольких документов
Сценарий № 1: PDF # 1 отправлен в одиночку и все вкладки показывают, как и ожидалось
Сценарий № 2: PDF # 2 отправлен в одиночку и все вкладки показывают, как и ожидалось
Сценарий № 3: pdf # 1 & pdf # 2 отправлено вместе, 4 из 6 вкладок отсутствуют в pdf # 1. Недопустимые вкладки: Initial, DateSigned и Date. Подпись & FullName показать, как ожидалось, для pdf # 1. Все вкладки также отображаются правильно для pdf # 2.
Я использую довольно уникальные AnchorStrings для недостающих вкладок. Но Signature & FullName AnchorStrings одинаковы для обоих документов.
Я также идентифицирую DocumentId, RecipientId и PageNumber, как требуется для Справочника по API.
Я прихожу к выводу, что нам придется отправлять отпечаток каждого документа.
'Public Sub SendForSignature(ByRef Docs As List(Of DocToSign), DocSigner As Signer)
Try
If Not UserHasLogin(User.Id) Then
Throw New Exception("You do not have DocuSign credentials saved. Save your credentials in your User Settings to use DocuSign.")
End If
If Docs.Count = 0 Then
Exit Try
End If
If String.IsNullOrWhiteSpace(DocSigner.Name) Then
Throw New Exception("No recipient name found.")
End If
If String.IsNullOrWhiteSpace(DocSigner.Email) Then
Throw New Exception("No recipient email address found.")
End If
If String.IsNullOrWhiteSpace(DocSigner.RecipientId) Then
DocSigner.RecipientId = "1"
End If
If String.IsNullOrWhiteSpace(DocSigner.RoutingOrder) Then
DocSigner.RoutingOrder = "1"
End If
'Create Envelope
Dim envDef As New EnvelopeDefinition() With {
.EmailSubject = $"Signature Requested from {User.FirstName}",
.EmailBlurb = "Please sign the document. Thank you!"}
envDef.Documents = New List(Of Document)()
envDef.CustomFields = New CustomFields()
envDef.Recipients = New Recipients()
'Used for Documentid
Dim i As Integer = 1
For Each pdf As DocToSign In Docs
If Not File.Exists(pdf.Path) Then
Throw New Exception($"PDF file was not found at '{pdf.Path}'.")
End If
If Not Path.GetExtension(pdf.Path).ToLower.EndsWith("pdf") Then
Throw New Exception("File path did not end with pdf, invalid file format.")
End If
Dim filebytes As Byte() = File.ReadAllBytes(pdf.Path)
Dim lcf As New List(Of ListCustomField)
lcf.Add(New ListCustomField With {.Name = "ReferenceGUID", .Value = pdf.ReferenceGUID, .Required = "true", .Show = "false"})
lcf.Add(New ListCustomField With {.Name = "UserId", .Value = User.Id.ToString, .Required = "true", .Show = "false"})
envDef.CustomFields.ListCustomFields = lcf
'Add a document to the envelope
Dim doc As New Document()
doc.DocumentBase64 = Convert.ToBase64String(filebytes)
doc.Name = Path.GetFileName(pdf.Path)
doc.DocumentId = i.ToString()
doc.DocumentFields = New List(Of NameValue)
doc.DocumentFields.Add(New NameValue With {.Name = "ReferenceGUID", .Value = pdf.ReferenceGUID})
doc.ApplyAnchorTabs = "true"
envDef.Documents.Add(doc)
'Move Tabs per Document
Select Case pdf.DocumentTypeId
Case 2 'Client Lease
'Change for Master Leases
If pdf.IsSubLease Then
Else
SetupClientLease(DocSigner, i.ToString)
End If
Case 18 'Client NTV
SetupClientNTV(DocSigner, i.ToString)
Case 7 'Addendum
SetupClientAddendum(DocSigner, i.ToString)
Case 6 'SOP
SetupClientSOP(DocSigner, i.ToString)
Case 41 'Master Rental Agreement
Dim ECHSigner As New Signer With {.Name = User.FullName, .Email = User.EmailAddress, .RecipientId = "2", .RoutingOrder = "1"}
DocSigner.RoutingOrder = "2"
envDef.Recipients.Signers.Add(ECHSigner)
SetupMasterRentalAgreement(DocSigner, ECHSigner, i.ToString)
End Select
'Set next doc id
i += 1
Next
'Add a recipient to sign the documeent
envDef.Recipients.Signers = New List(Of Signer)()
envDef.Recipients.Signers.Add(DocSigner)
'Set envelope status to "sent" to immediately send the signature request
envDef.Status = "sent"
'Use the EnvelopesApi to send the signature request!
Dim envelopesApi As New EnvelopesApi()
Dim envelopeSummary As EnvelopeSummary = envelopesApi.CreateEnvelope(accountid, envDef)
Catch ex As Exception
Throw New Exception(ex.Message, ex.InnerException)
End Try
End Sub
Private Sub SetupClientNTV(ByRef signer As Signer, DocId As String)
Try
' Create a |SignHere| tab somewhere on the document for the recipient to sign
signer.Tabs = New Tabs()
signer.Tabs.SignHereTabs = New List(Of SignHere)
signer.Tabs.InitialHereTabs = New List(Of InitialHere)
signer.Tabs.DateTabs = New List(Of [Date])
signer.Tabs.FullNameTabs = New List(Of FullName)
signer.Tabs.DateSignedTabs = New List(Of DateSigned)
'Signature Tab
Dim signHere As New SignHere() With {
.AnchorString = "Guest Signature",
.AnchorXOffset = "2",
.AnchorYOffset = "-12",
.DocumentId = DocId,
.RecipientId = "1",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Full Name Tab
Dim fullName As New FullName With {
.AnchorString = "Guest Printed Name",
.AnchorXOffset = "0",
.AnchorYOffset = "-12",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Date Signed Tabs
Dim dateSigned As New DateSigned() With {
.AnchorString = "Date Signed",
.AnchorXOffset = "0",
.AnchorYOffset = "-12",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Date Tabs
Dim ntvdate As New [Date] With {
.AnchorString = "Initial ONLY ONE",
.AnchorXOffset = "292",
.AnchorYOffset = "26",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1",
.ConditionalParentLabel = "initial1",
.ConditionalParentValue = "on",
.Width = 100}
'Initial Tabs
Dim initial1 As New InitialHere With {
.AnchorString = "Initial ONLY ONE",
.AnchorXOffset = "2",
.AnchorYOffset = "41",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1",
.Optional = "true",
.TabLabel = "initial1",
.ScaleValue = "0.75"} 'Scale value is size - 1.0 is full size, 0.5 is 50% size
Dim initial2 As New InitialHere With {
.AnchorString = "Initial ONLY ONE",
.AnchorXOffset = "2",
.AnchorYOffset = "82",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1",
.Optional = "true",
.TabLabel = "initail2",
.ScaleValue = "0.75"}
signer.Tabs.SignHereTabs.Add(signHere)
signer.Tabs.DateTabs.Add(ntvdate)
signer.Tabs.FullNameTabs.Add(fullName)
signer.Tabs.DateSignedTabs.Add(dateSigned)
signer.Tabs.InitialHereTabs.Add(initial1)
signer.Tabs.InitialHereTabs.Add(initial2)
Catch ex As Exception
Throw New Exception(ex.Message, ex.InnerException)
End Try
End Sub
Private Sub SetupClientSOP(ByRef signer As Signer, DocId As String)
Try
' Create a |SignHere| tab somewhere on the document for the recipient to sign
signer.Tabs = New Tabs()
signer.Tabs.SignHereTabs = New List(Of SignHere)
signer.Tabs.TextTabs = New List(Of Text)
signer.Tabs.FullNameTabs = New List(Of FullName)
signer.Tabs.DateSignedTabs = New List(Of DateSigned)
signer.Tabs.RadioGroupTabs = New List(Of RadioGroup)
Dim rg As New RadioGroup With {
.DocumentId = DocId,
.GroupName = "radios",
.RecipientId = "1",
.Radios = New List(Of Radio)}
'Signature Tab
Dim signHere As New SignHere() With {
.AnchorString = "Guest Signature",
.AnchorXOffset = "3",
.AnchorYOffset = "-11",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Radio Tabs
Dim radio1 As New Radio With {
.AnchorString = "Credit Card on File",
.AnchorXOffset = "-27",
.AnchorYOffset = "-3",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.Required = "true",
.Selected = "true",
.PageNumber = "1"}
Dim radio2 As New Radio With {
.AnchorString = "Auto Debit my",
.AnchorXOffset = "-27",
.AnchorYOffset = "-3",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.Required = "true",
.Selected = "false",
.PageNumber = "1"}
Dim radio3 As New Radio With {
.AnchorString = "Postal Mail (",
.AnchorXOffset = "-27",
.AnchorYOffset = "-3",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.Required = "true",
.Selected = "false",
.PageNumber = "1"}
Dim radio4 As New Radio With {
.AnchorString = "Wire Transfer",
.AnchorXOffset = "-27",
.AnchorYOffset = "-3",
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.Required = "true",
.Selected = "false",
.PageNumber = "1"}
'Text Tabs (For email address - Using EmailAddress is not optional)
Dim emailHere As New Text With {
.AnchorString = "Email address where invoices should be sent:",
.AnchorXOffset = "160",
.AnchorYOffset = "-3",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.Required = "false",
.PageNumber = "1",
.Width = 225}
'Full Name Tab
Dim fullName As New FullName With {
.AnchorString = "Guest Printed Name",
.AnchorXOffset = "0",
.AnchorYOffset = "-11",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.AnchorIgnoreIfNotPresent = "true",
.PageNumber = "1"}
'Date Tab
Dim dateHere As New DateSigned() With {
.AnchorString = "Date:",
.AnchorXOffset = "20",
.AnchorYOffset = "-3",
.DocumentId = DocId,
.AnchorMatchWholeWord = "true",
.AnchorCaseSensitive = "true",
.PageNumber = "1"}
rg.Radios.Add(radio1)
rg.Radios.Add(radio2)
rg.Radios.Add(radio3)
rg.Radios.Add(radio4)
signer.Tabs.SignHereTabs.Add(signHere)
signer.Tabs.RadioGroupTabs.Add(rg)
signer.Tabs.TextTabs.Add(emailHere)
signer.Tabs.FullNameTabs.Add(fullName)
signer.Tabs.DateSignedTabs.Add(dateHere)
Catch ex As Exception
Throw New Exception(ex.Message, ex.InnerException)
End Try
End Sub`
Запрос Body
'{
"documents": [
{
"documentId": "1",
"name": "2teevgqk2dm.pdf",
"documentFields": [
{
"name": "ReferenceGUID",
"value": "2582db83-cf6e-4611-9daf-321f40a7440a"
}
],
"documentBase64": "[Base64 data omitted]",
"applyAnchorTabs": "true"
},
{
"documentId": "2",
"name": "dwwkrtmjwk3.pdf",
"documentFields": [
{
"name": "ReferenceGUID",
"value": "2582db83-cf6e-4611-9daf-321f40a7440a"
}
],
"documentBase64": "[Base64 data omitted]",
"applyAnchorTabs": "true"
}
],
"recipients": {
"signers": [
{
"tabs": {
"signHereTabs": [
{
"documentId": "2",
"pageNumber": "1",
"anchorString": "Guest Signature",
"anchorXOffset": "3",
"anchorYOffset": "-11",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true"
}
],
"fullNameTabs": [
{
"documentId": "2",
"pageNumber": "1",
"anchorString": "Guest Printed Name",
"anchorXOffset": "0",
"anchorYOffset": "-11",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true"
}
],
"dateSignedTabs": [
{
"documentId": "2",
"pageNumber": "1",
"anchorString": "Date:",
"anchorXOffset": "20",
"anchorYOffset": "-3",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true"
}
],
"textTabs": [
{
"width": 225,
"required": "false",
"documentId": "2",
"pageNumber": "1",
"anchorString": "Email address where invoices should be sent:",
"anchorXOffset": "160",
"anchorYOffset": "-3",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true"
}
],
"radioGroupTabs": [
{
"documentId": "2",
"recipientId": "1",
"groupName": "radios",
"radios": [
{
"pageNumber": "1",
"anchorString": "Credit Card on File",
"anchorXOffset": "-27",
"anchorYOffset": "-3",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true",
"selected": "true",
"required": "true"
},
{
"pageNumber": "1",
"anchorString": "Auto Debit my",
"anchorXOffset": "-27",
"anchorYOffset": "-3",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true",
"selected": "false",
"required": "true"
},
{
"pageNumber": "1",
"anchorString": "Postal Mail (",
"anchorXOffset": "-27",
"anchorYOffset": "-3",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true",
"selected": "false",
"required": "true"
},
{
"pageNumber": "1",
"anchorString": "Wire Transfer",
"anchorXOffset": "-27",
"anchorYOffset": "-3",
"anchorIgnoreIfNotPresent": "true",
"anchorCaseSensitive": "true",
"anchorMatchWholeWord": "true",
"selected": "false",
"required": "true"
}
]
}
]
},
"name": "Joe Blow",
"email": "[email protected]",
"recipientId": "1",
"routingOrder": "1"
}
]
},
"customFields": {
"listCustomFields": [
{
"name": "ReferenceGUID",
"show": "false",
"required": "true",
"value": "2582db83-cf6e-4611-9daf-321f40a7440a"
},
{
"name": "UserId",
"show": "false",
"required": "true",
"value": "14"
}
]
},
"status": "sent",
"emailSubject": "Signature Requested",
"emailBlurb": "Please sign the document. Thank you!"
}'
Не могли бы вы предоставить кому-то свой Тег и API. –
Praveen Я использую пакет NuGet версии 2.0.6, который ссылается на dll, а не на Rest или Soap API. Поэтому я не вижу способа получить вас Тело запроса. – Chris
Можете ли вы поделиться своим кодом VB.NET. –