EchoSign: Extra signature box appears while sending out to multiple signers - echosign

I'm trying to create an url widget using below code to allow the document be signed by multiple signers. But when I upload the document, an extra signature box appears at the beginning, then the remaining signature boxes appear for each email address I mention in the WidgetCreationInfo.CounterSigners property. I need to remove the extra signature box from the document.
var senderInfo = new com.echosign.secure22.SenderInfo();
senderInfo.email = "abx#xyz.com";
senderInfo.password = "******";
var widgetInfo = new com.echosign.secure22.WidgetCreationInfo();
widgetInfo.name = "test widget";
widgetInfo.fileInfos = new EchoSign.com.echosign.secure22.FileInfo[1];
widgetInfo.fileInfos[0] = new EchoSign.com.echosign.secure22.FileInfo();
widgetInfo.fileInfos[0].file = System.IO.File.ReadAllBytes(fileName);
widgetInfo.fileInfos[0].fileName = System.IO.Path.GetFileName(fileName);
widgetInfo.callbackInfo = new com.echosign.secure22.CallbackInfo();
widgetInfo.callbackInfo.signedDocumentUrl = redirectUrl;
widgetInfo.signatureFlow = EchoSign.com.echosign.secure22.SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED;
widgetInfo.counterSigners = new com.echosign.secure22.RecipientInfo[2];
widgetInfo.counterSigners[0] = new com.echosign.secure22.RecipientInfo();
widgetInfo.counterSigners[0].email = "abc#gmail.com";
widgetInfo.counterSigners[0].role = com.echosign.secure22.RecipientRole.SIGNER;
widgetInfo.counterSigners[0].roleSpecified = true;
widgetInfo.counterSigners[1] = new com.echosign.secure22.RecipientInfo();
widgetInfo.counterSigners[1].email = "xyz#yahoo.com";
widgetInfo.counterSigners[1].role = com.echosign.secure22.RecipientRole.SIGNER;
widgetInfo.counterSigners[1].roleSpecified = true;
var result = ES22.createEmbeddedWidget(apiKey, senderInfo, widgetInfo);
Can anyone please help?

The first signature block is for the widget signer. The rest of the recipients you have added are counter signers and would need to sign once the first signer of the widget signs. If you simply need a document to be signed by multiple signers, you can create a normal agreement instead of a widget. If yow want to host the signing page, you can use eSign services API to retrieve the signing URL of the signers in the agreement. Let me know if this helps.

Related

PKCE flow Error code: 500 code challenge required

I'm trying to get the PKCE example to work, but I keep hitting
Error code: 500
Error: invalid_request : code challenge required
Here's a sample url, it does include a code_challenge param generated with the example code.
https://login.xero.com/identity/connect/authorize
?client_id=XXX
&response_type=code
&scope=openid%20profile%20email%20offline_access%20files%20accounting.transactions%20accounting.contacts&redirect_uri=https%3A%2F%2Flocalhost%3A5001%2F
&code_challenge=tj6n3SLd6FZ8g6jjSJYvfC--4r2PHGnpbSGTwIreNqQ
&code_challenge_method=S256
The registered app is a PKCE flow, kind of out of options what it could be.
Here's the code I use, the only changes are the last 2 lines where I launch the browser a I'm connecting from a desktop app. Tried pasting the generated url into the browser directly but that also didn't work.
XeroConfiguration xconfig = new XeroConfiguration();
xconfig.ClientId = "XXX";
xconfig.CallbackUri = new Uri("https://localhost:5001"); //default for standard webapi template
xconfig.Scope = "openid profile email offline_access files accounting.transactions accounting.contacts";
//xconfig.State = "YOUR_STATE"
var client = new XeroClient(xconfig);
// generate a random codeVerifier
var validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~";
Random random = new Random();
int charsLength = random.Next(43, 128);
char[] randomChars = new char[charsLength];
for (int i = 0; i < charsLength; i++) {
randomChars[i] = validChars[random.Next(0, validChars.Length)];
}
string codeVerifier = new String(randomChars);
var uri = client.BuildLoginUriPkce(codeVerifier);
Clipboard.SetText(uri);
System.Diagnostics.Process.Start("explorer.exe", $"\"{uri}\"");

Docusign duplicated Signature tags on all pages

I am using Docusign to add a signature my PDF documents in c#.
I have some html file, I add to end of html div with text "SignHere" that Docusign will recognize the zone for signature, but the problem that after converting html to pdf and send Docusign, I see that "SignHere" option in all pages, not the last one.
What I am wrong wrong here?
My code, after converting html to pdf file:
if (System.IO.File.Exists(PdfPath))
{
byte[] fileBytes = System.IO.File.ReadAllBytes(PdfPath);
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = envDefEmailSubject;
envDef.EventNotification = new EventNotification();
envDef.EventNotification.Url = envDefEventNotificationUrl;
envDef.EventNotification.LoggingEnabled = "true";
envDef.EventNotification.IncludeDocuments = "true";
envDef.EventNotification.RequireAcknowledgment = "true";
envDef.EventNotification.IncludeCertificateWithSoap = "false";
envDef.EventNotification.RequireAcknowledgment = "true";
envDef.EventNotification.UseSoapInterface = "false";
envDef.EventNotification.EnvelopeEvents = new List<EnvelopeEvent>();
EnvelopeEvent envelopeEventSent = new EnvelopeEvent();
envelopeEventSent.EnvelopeEventStatusCode = "sent";
envDef.EventNotification.EnvelopeEvents.Add(envelopeEventSent);
EnvelopeEvent envelopeEventDelivered = new EnvelopeEvent();
envelopeEventDelivered.EnvelopeEventStatusCode = "delivered";
envDef.EventNotification.EnvelopeEvents.Add(envelopeEventDelivered);
EnvelopeEvent envelopeEventSentCompleted = new EnvelopeEvent();
envelopeEventSentCompleted.EnvelopeEventStatusCode = "completed";
envDef.EventNotification.EnvelopeEvents.Add(envelopeEventSentCompleted);
Document doc = new Document();
doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes);
doc.Name = docName;
doc.DocumentId = docDocumentId;
envDef.Documents = new List<Document>();
envDef.Documents.Add(doc);
Signer signer = new Signer();
signer.Email = Email;
signer.Name = signerName + LeadName;
signer.RecipientId = signerRecipientId;
signer.Tabs = new Tabs();
//Custom Field For LeadId and PdfName
envDef.CustomFields = new CustomFields();
envDef.CustomFields.TextCustomFields = new List<TextCustomField>();
TextCustomField textCustomFieldLeadId = new TextCustomField();
textCustomFieldLeadId.Name = "LeadId";
textCustomFieldLeadId.Value = LeadId;
textCustomFieldLeadId.Required = "false";
textCustomFieldLeadId.Name = "false";
envDef.CustomFields.TextCustomFields.Add(textCustomFieldLeadId);
TextCustomField textCustomFieldSignedPdfName = new TextCustomField();
textCustomFieldSignedPdfName.Name = "SignedPdfName";
textCustomFieldSignedPdfName.Value = SignedPdfName;
textCustomFieldSignedPdfName.Required = "false";
textCustomFieldSignedPdfName.Name = "false";
envDef.CustomFields.TextCustomFields.Add(textCustomFieldSignedPdfName);
if (SignHereExist)
{
signer.Tabs.SignHereTabs = new List<SignHere>();
SignHere signHere = new SignHere();
signHere.RecipientId = signHereRecipientId;
signHere.AnchorXOffset = signHereAnchorXOffset;
signHere.AnchorYOffset = signHereAnchorYOffset;
signHere.AnchorIgnoreIfNotPresent = signHereAnchorIgnoreIfNotPresent;
signHere.AnchorUnits = "inches";
signHere.AnchorString = signHereAnchorString;
signer.Tabs.SignHereTabs.Add(signHere);
envDef.Recipients = new Recipients();
envDef.Recipients.Signers = new List<Signer>();
envDef.Recipients.Signers.Add(signer);
envDef.Status = "sent";
ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
DocuSign.eSign.Client.Configuration cfi = new DocuSign.eSign.Client.Configuration(apiClient);
string authHeader = "{\"Username\":\"" + x+ "\", \"Password\":\"" + x+ "\", \"IntegratorKey\":\"" + x+ "\"}";
cfi.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
EnvelopesApi envelopesApi = new EnvelopesApi(cfi);
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountID, envDef);
}
You are using Docusign Auto-Place (Anchor Tagging) in your request.
signHere.AnchorString = signHereAnchorString;
This will trigger a scan on the text in the document. If the scan finds the text specified in the variable signHereAnchorString anywhere in the document, it automatically places the "SignHere" option next to the text. That is the reason you are seeing "SignHere" option on all pages
You have couple of options if you want to place the Tag only on the last page
Option 1 - Using Anchor Tags: (See documentation here)
Modify your document to contain a unique string where you want to place the Signature tag. In this case, you could add the text "SignHereLastPage" in white font color (so that it isn't visible in the document) to where you want to place the Signature tag on the Document. Use "SignHereLastPage" as the anchor string.
You will just need to change one line in your code
signHere.AnchorString = "SignHereLastPage";
Option 2 - Fixed (or Absolute) Positioning (See documentation here)
You can use Absolute position of Tags and specify where you want to place the signature Tag. See Api recipe here
signer.Tabs.SignHereTabs = new List<SignHere>();
SignHere signHere = new SignHere();
signHere.DocumentId =docDocumentId;
signHere.PageNumber = "1"; // Specify the last Page number here.
signHere.RecipientId = signHereRecipientId;
signHere.XPosition = "100"; //You can adjust this based on your document
signHere.YPosition = "100"; //You can adjust this based on your document
signer.Tabs.SignHereTabs.Add(signHere);

Undefined merge field in google apps script

I have a Google Apps Script for a Google Spreadsheet based on a Google Form that clients fill out online. The script is triggered by OnFormSubmit and generates a pdf based on a Google Doc template and sends the pdf to me by email using MailApp.sendEmail.
This script has been working fine until recently. The script runs successfully but the pdf output is incorrect. It seems like fields that are left blank are now being ignored in the script and so my pdf output shows the value for the next non-blank field. Ugh!
Anybody know what's going on here?
Below is an example of my script:
var docTemplate = "1FZL4rVe0LLpvMtIsq_3-pwv5POllIsyYThjfemkbkfg";
var docName = "Travel Details";
function onFormSubmit(e) {
var last = e.values[1];
var first = e.values[2];
var order = e.values[3];
var date = e.values[4];
var gender = e.values[5];
var email = "example#gmail.com";
var copyId = DocsList.getFileById(docTemplate)
.makeCopy(docName+' for '+last + ', ' + first)
.getId();
var copyDoc = DocumentApp.openById(copyId);
var copyBody = copyDoc.getActiveSection();
copyBody.replaceText('keyLast', last);
copyBody.replaceText('keyFirst', first);
copyBody.replaceText('keyOrder', order);
copyBody.replaceText('keyDate', date);
copyBody.replaceText('keyGender', gender);
copyDoc.saveAndClose();
var pdf = DocsList.getFileById(copyId).getAs("application/pdf");
MailApp.sendEmail(email, subject, "", {htmlBody: office_message, attachments: pdf,
noReply:true});
DocsList.getFileById(copyId).setTrashed(true);
}
Example of the problem: If client leaves date field blank on the form, the gender value in the resulting pdf is put where the date value should be and the value for gender on the pdf shows "undefined".
Any ideas out there?
You should validate the values of all your variables.
if (last === undefined) {
last = 'No Data!'; //re-assign a different value
};
So, you are changing the value of the variable last if it somehow got set to undefined. That way, hopefully the pdf would still show the field.
If there is some bug that just showed up recently, you should report it as a bug. If everything was working fine, and now it's broken, Google may have changed something.
There might be something wrong with your code. I don't know. Have you looked under the "View" menu and the "Execution Transcript" to see if there are any errors? You should also use Logger.log statements: Logger.log('The value of last is: ' + last); to print output to the log. Then you can check what is actually going on.
I am no great coder but I use this script all the time to send pdf's I have never received an undefined if a field was missing. Typically if something is missing, the keygender is replaced with a blank spot and there is no error. In a spreadsheet, typically this means the columns were changed. It used to be timestamp(0), last(1), first(2), order(3), date(4), gender(5) and now their in a different order.
Try the below code it works
//commons errors -
//Triggers are not set
//spaces after Form questions
//e.values dont work when fields are not mandatory and left blank
//e.namedValues dont work for sending emails use e.values[#]
//place holder keys in template dont match
//spelling errors
//Note expect undefined error when de-bugging as values are not defined until form completed and submitted - run first with a small test form as per below
// Get Template
//from Google Docs and name it
var docTemplate = " "; // *** replace with new templae ID if new Template created***
var docName = "Test Script"; //replace with document name
// When Form Gets submitted
function onFormSubmit(e) {
//Get information from the form and set as variables
//var variablename = "static entry or form value"
//Note: var Variablename = e.namedValues["X"]; is taking the value from the spreadsheet by column name so update if spreadsheet or form questions change
//Additions to the form will be added to the end of the spreadsheet regardless of their position in the form
var Timestamp = e.namedValues["Timestamp"];
var full_name = e.namedValues["Name"];
var position = e.namedValues["Position"]
var contact_email = e.namedValues["Contact Email"];
var phone_number = e.namedValues["Telephone Number"];
// Get document template, copy it as a new doc with Name and email, and save the id
var copyId = DocsList.getFileById(docTemplate)
.makeCopy(full_name+' '+docName+' for ' +contact_email+' '+Timestamp)//Update or remove Variablename to create full doc Name
.getId();
// Open the temporary document
var copyDoc = DocumentApp.openById(copyId);
// Get the documents body section
var copyBody = copyDoc.getActiveSection();
// Replace place holder keys <<namedValues>> in template
//copyBody.replaceText('<<X>>', Variablename); Variables from above
//***Update if template is changed***
copyBody.replaceText('<<Timestamp>>', Timestamp);
copyBody.replaceText('<<Name>>', full_name);
copyBody.replaceText('<<Position>>', position);
copyBody.replaceText('<<Contact Email>>', contact_email);
copyBody.replaceText('<<Telephone Number>>', phone_number);
// Save and close the temporary document
copyDoc.saveAndClose();
// Convert temporary document to PDF by using the getAs blob conversion
var pdf = DocsList.getFileById(copyId).getAs("application/pdf");
{
// Add the data fields to the message
var s = SpreadsheetApp.getActiveSheet();
var columns = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var message = " ";
// Only include form fields that are not blank
for ( var keys in columns ) {
var key = columns[keys];
if ( e.namedValues[key] && (e.namedValues[key] != "") ) {
message += key+ ' : '+ e.namedValues[key] + "<br>";
}
}}
// Attach PDF and send the email
//***Change the "To" email address when to form goes live***
var to = "youremail#gmail.com";
var senders_name = e.values[1]
var contact_email = e.values[3]
var subject = "Test";
var htmlbody = "text goes here"+
"<br> <br>"+message+
"<br> <br>Submitted By:"+
"<br> <br>"+full_name+
"<br>"+position+
"<br>"+contact_email+
"<br>"+phone_number+
"<br> <br>Generated by Hansmoleman for Compu-Global-Hyper-Mega-Net";
MailApp.sendEmail({
name: senders_name,
to: to,
cc: contact_email,
replyTo: contact_email,
subject: subject,
htmlBody: htmlbody,
attachments: pdf,
});
}

Adobe Echo Sign Sending PDF file

I am working on Adobe Echo sign,I have downloaded the sample code from their website, I am using this sample code for sendingdocument, it has some code missing in sendDocument method so I have changed it. It's giving SoapHeader Exception,with nothing in InnerException,
{"apiActionId=XHZI4WF4BV693YS"}
below is my code of sending document
public static void sendDocument(string apiKey, string fileName, string recipient)
{
ES = new EchoSignDocumentService16();
FileStream file = File.OpenRead(fileName);
secure.echosign.com.FileInfo[] fileInfos = new secure.echosign.com.FileInfo[1];
fileInfos[0] = new secure.echosign.com.FileInfo(fileName, null, file);
SenderInfo senderInfo = null;
string[] recipients = new string[1];
recipients[0] = recipient;
DocumentCreationInfo documentInfo = new DocumentCreationInfo(
recipients,
"Test from SOAP: " + fileName,
"This is neat.",
fileInfos,
SignatureType.ESIGN,
SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
);
DocumentKey[] documentKeys;
senderInfo = new SenderInfo(recipient, "password", "APIKEY");
documentKeys = ES.sendDocument(apiKey, senderInfo, documentInfo);
Console.WriteLine("Document key is: " + documentKeys[0].documentKey);
}
its giving exception on this line
documentKeys = ES.sendDocument(apiKey, senderInfo, documentInfo);
Can anyone suggest some sample code of Adobe Echo Sign?
On the account page of your login there is an API log you can check. If you check the log entry for your request you may find more information there.
I can't see anything immediately wrong with your code however the EchoSign API guide says that the 'tos' field is deprecated and that the recipients field should be used instead. Helpfully this means you can't use the paramaterised constructor. Try creating your document creation info as such (this is C# but if you need Java it should be straightforward to figure out):
RecipientInfo[] recipientInfo = new RecipientInfo[1];
recipientInfo[0] = new RecipientInfo
{
email = "recipient",
role = RecipientRole.SIGNER,
roleSpecified = true
};
DocumentCreationInfo documentCreationInfo = new DocumentCreationInfo
{
recipients = recipientInfo,
name = "Test from SOAP: " + fileName,
message = "This is neat.",
fileInfos = fileInfos,
signatureType = SignatureType.ESIGN,
signatureFlow = SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
};
Note that when using the recipientInfo array it seems that the roleSpecified field must be set to true. This little field tripped me up for ages and I was receiving errors similar to yours.

WCF Client access with Message Contracts

I have a web service , i add some extra class which have message contract and after that it changed the way we access some of the methods( and i have not added message contract to these classes these are data contracts ), earlier i.e before we could create one object for request and response (like see the Before part) we are creating a single object for OrderStatusResponse Class. But if you see now the After(we have to create separate objects for request and response).
is this a side effect of enabling "Always generate message contract?"
Before
SmartConnect.Service1Client Client =
new SmartConnectClient.SmartConnect.Service1Client();
SmartConnect.OrderStatusResponse Status =
new SmartConnectClient.SmartConnect.OrderStatusResponse();
Status.UserID = "1234";
Status.Password = "abcd";
Status.SoftwareKey = "abc";
Status.OrderNumber = "1234";
Status = Client.GetOrderStatus(Status);
lbl_OS.Text = Status.Status.ToString();
lbl_RM.Text = Status.ReturnMessage.ToString();
After
SmartConnectRepublic.SmartConnectClient SmartClient =
new WCF_Client.SmartConnectRepublic.SmartConnectClient();
//SmartConnectRepublic.OrderStatusResponse Status =
new WCF_Client.SmartConnectRepublic.OrderStatusResponse();
WCF_Client.SmartConnectRepublic.GetOrderStatusRequest request =
new WCF_Client.SmartConnectRepublic.GetOrderStatusRequest();
request.status = new WCF_Client.SmartConnectRepublic.OrderStatusResponse();
request.status.OrderNumber = "1055055";
request.status.UserID = "1234";
request.status.Password = "dfsdfsd";
request.status.SoftwareKey = "sdfsdfsdfs";
WCF_Client.SmartConnectRepublic.GetOrderStatusResponse response =
new WCF_Client.SmartConnectRepublic.GetOrderStatusResponse();
response = SmartClient.GetOrderStatus(request);
lbl_Status.Text = response.GetOrderStatusResult.Status;
lbl_RC.Text = response.GetOrderStatusResult.ReturnCode.ToString();
lbl_RM.Text = response.GetOrderStatusResult.ReturnCode.ToString();
Yes, I suspect it is a difference with using message contracts. You seem to have figured it out, though.