private void JwtRequestSignatureOnDocumentTest(string status = "sent") { // the document (file) we want signed const string SignTest1File = @"../../docs/SignTest1.pdf"; // Read a file from disk to use as a document. byte[] fileBytes = File.ReadAllBytes(SignTest1File); EnvelopeDefinition envDef = new EnvelopeDefinition(); envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc"; // Add a document to the envelope Document doc = new Document(); doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes); doc.Name = "TestFile.pdf"; doc.DocumentId = "1"; envDef.Documents = new List <Document>(); envDef.Documents.Add(doc); // Add a recipient to sign the documeent Signer signer = new Signer(); signer.Email = testConfig.RecipientEmail; signer.Name = testConfig.RecipientName; signer.RecipientId = "1"; signer.ClientUserId = "1234"; // Create a |SignHere| tab somewhere on the document for the recipient to sign signer.Tabs = new Tabs(); signer.Tabs.SignHereTabs = new List <SignHere>(); SignHere signHere = new SignHere(); signHere.DocumentId = "1"; signHere.PageNumber = "1"; signHere.RecipientId = "1"; signHere.XPosition = "100"; signHere.YPosition = "100"; signHere.ScaleValue = ".5"; signer.Tabs.SignHereTabs.Add(signHere); envDef.Recipients = new Recipients(); envDef.Recipients.Signers = new List <Signer>(); envDef.Recipients.Signers.Add(signer); TemplateTabs templateTabs = new TemplateTabs(); templateTabs.DateTabs = new List <Date>(); Tabs tabs = new Tabs(); tabs.DateTabs = new List <Date>(); SignerAttachment signerAttachment = new SignerAttachment(); signerAttachment.ScaleValue = ""; // set envelope status to "sent" to immediately send the signature request envDef.Status = status; // |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests) EnvelopesApi envelopesApi = new EnvelopesApi(testConfig.ApiClient.Configuration); EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(testConfig.AccountId, envDef); Assert.IsNotNull(envelopeSummary); Assert.IsNotNull(envelopeSummary.EnvelopeId); testConfig.EnvelopeId = envelopeSummary.EnvelopeId; }
public void JwtBulkEnvelopesApiTest() { #region Envelope Creation - with BulkRecipient Flag // the document (file) we want signed const string SignTest1File = @"../../docs/SignTest1.pdf"; // Read a file from disk to use as a document. byte[] fileBytes = File.ReadAllBytes(SignTest1File); EnvelopeDefinition envDef = new EnvelopeDefinition(); envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc"; // Add a document to the envelope Document doc = new Document(); doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes); doc.Name = "TestFile.pdf"; doc.DocumentId = "1"; // doc.FileExtension = System.IO.Path.GetExtension(SignTest1File); envDef.Documents = new List <Document>(); envDef.Documents.Add(doc); // Add a recipient to sign the documeent Signer signer = new Signer(); signer.RecipientId = "1"; signer.IsBulkRecipient = "true"; // Create a |SignHere| tab somewhere on the document for the recipient to sign signer.Tabs = new Tabs(); signer.Tabs.SignHereTabs = new List <SignHere>(); SignHere signHere = new SignHere(); signHere.DocumentId = "1"; signHere.PageNumber = "1"; signHere.RecipientId = "1"; signHere.XPosition = "100"; signHere.YPosition = "100"; signHere.ScaleValue = ".5"; signer.Tabs.SignHereTabs.Add(signHere); envDef.Recipients = new Recipients(); envDef.Recipients.Signers = new List <Signer>(); envDef.Recipients.Signers.Add(signer); TemplateTabs templateTabs = new TemplateTabs(); templateTabs.DateTabs = new List <Date>(); Tabs tabs = new Tabs(); tabs.DateTabs = new List <Date>(); SignerAttachment signerAttachment = new SignerAttachment(); signerAttachment.ScaleValue = ""; // set envelope status to "sent" to immediately send the signature request envDef.Status = "created"; // |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests) EnvelopesApi envelopesApi = new EnvelopesApi(testConfig.ApiClient.Configuration); EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(testConfig.AccountId, envDef); testConfig.EnvelopeId = envelopeSummary.EnvelopeId; #endregion var response = MockBulkRecipientsSummaryResponse(); // update the status of the enve Envelope envelope = new Envelope(); envelope.Status = "sent"; envelopesApi.Update(testConfig.AccountId, testConfig.EnvelopeId, envelope); Assert.IsNotNull(response); Assert.IsNotNull(response.BulkRecipientsUri); Assert.IsNotNull(response.BulkRecipientsCount); }
/// <summary> /// Deletes the tabs associated with a recipient in a template. Deletes one or more tabs associated with a recipient in a template. /// </summary> ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="templateId">The ID of the template being accessed.</param><param name="recipientId">The ID of the recipient being accessed.</param> <param name="templateTabs">TBD Description</param> /// <returns>7Task of Tabs</returns> public async System.Threading.Tasks.Task<Tabs> DeleteTabsAsync (string accountId, string templateId, string recipientId, TemplateTabs templateTabs) { ApiResponse<Tabs> response = await DeleteTabsAsyncWithHttpInfo(accountId, templateId, recipientId, templateTabs); return response.Data; }
/// <summary> /// Deletes the tabs associated with a recipient in a template. Deletes one or more tabs associated with a recipient in a template. /// </summary> ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="templateId">The ID of the template being accessed.</param><param name="recipientId">The ID of the recipient being accessed.</param> <param name="templateTabs">TBD Description</param> /// <returns>8Task of ApiResponse (Tabs)</returns> public async System.Threading.Tasks.Task<ApiResponse<Tabs>> DeleteTabsAsyncWithHttpInfo (string accountId, string templateId, string recipientId, TemplateTabs templateTabs) { // verify the required parameter 'accountId' is set if (accountId == null) throw new ApiException(400, "Missing required parameter 'accountId' when calling DeleteTabs"); // verify the required parameter 'templateId' is set if (templateId == null) throw new ApiException(400, "Missing required parameter 'templateId' when calling DeleteTabs"); // verify the required parameter 'recipientId' is set if (recipientId == null) throw new ApiException(400, "Missing required parameter 'recipientId' when calling DeleteTabs"); var path_ = "/v2/accounts/{accountId}/templates/{templateId}/recipients/{recipientId}/tabs"; var pathParams = new Dictionary<String, String>(); var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, String>(); var fileParams = new Dictionary<String, FileParameter>(); String postBody = null; // to determine the Accept header String[] http_header_accepts = new String[] { "application/json" }; String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts); if (http_header_accept != null) headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts)); // set "format" to json by default // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json pathParams.Add("format", "json"); if (accountId != null) pathParams.Add("accountId", Configuration.ApiClient.ParameterToString(accountId)); // path parameter if (templateId != null) pathParams.Add("templateId", Configuration.ApiClient.ParameterToString(templateId)); // path parameter if (recipientId != null) pathParams.Add("recipientId", Configuration.ApiClient.ParameterToString(recipientId)); // path parameter postBody = Configuration.ApiClient.Serialize(templateTabs); // http body (model) parameter // make the HTTP request IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams); int statusCode = (int) response.StatusCode; if (statusCode >= 400) throw new ApiException (statusCode, "Error calling DeleteTabs: " + response.Content, response.Content); else if (statusCode == 0) throw new ApiException (statusCode, "Error calling DeleteTabs: " + response.ErrorMessage, response.ErrorMessage); return new ApiResponse<Tabs>(statusCode, response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (Tabs) Configuration.ApiClient.Deserialize(response, typeof(Tabs))); }
/// <summary> /// Deletes the tabs associated with a recipient in a template. Deletes one or more tabs associated with a recipient in a template. /// </summary> ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="templateId">The ID of the template being accessed.</param><param name="recipientId">The ID of the recipient being accessed.</param> <param name="templateTabs">TBD Description</param> /// <returns>5Tabs</returns> public Tabs DeleteTabs (string accountId, string templateId, string recipientId, TemplateTabs templateTabs) { ApiResponse<Tabs> response = DeleteTabsWithHttpInfo(accountId, templateId, recipientId, templateTabs); return response.Data; }