Example #1
0
        } // end createEmbeddedSigningViewTest()

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public ViewUrl createEmbeddedConsoleViewTest()
        {
            // Enter your DocuSign credentials below.  Note: You only need a DocuSign account to SEND documents,
            // signing is always free and signers do not need an account.
            string username = "******";
            string password = "******";

            // instantiate api client with appropriate environment (for production change to www.docusign.net/restapi)
            configureApiClient("https://demo.docusign.net/restapi");

            //===========================================================
            // Step 1: Login()
            //===========================================================

            // call the Login() API which sets the user's baseUrl and returns their accountId
            string accountId = loginApi(username, password);

            //===========================================================
            // Step 2: Create Embedded Console View (URL)
            //===========================================================

            ReturnUrlRequest urlRequest = new ReturnUrlRequest();

            urlRequest.ReturnUrl = "https://www.docusign.com/devcenter";

            // Adding the envelopeId start sthe console with the envelope open
            EnvelopesApi envelopesApi = new EnvelopesApi();
            ViewUrl      viewUrl      = envelopesApi.CreateConsoleView(accountId, null);

            // Start the embedded signing session.
            System.Diagnostics.Process.Start(viewUrl.Url);

            return(viewUrl);
        } // end createEmbeddedConsoleViewTest()
Example #2
0
        private Func <CreateEnvelopeRequestModel, UpdateEnvelopeResponseModel> UpdateRequestFunc()
        {
            return(request =>
            {
                var accountId = Authenticate(request.ESignAccount);
                var envelopesApi = new EnvelopesApi();
                var options = new ReturnUrlRequest {
                    ReturnUrl = string.Empty
                };

                //VerifyEnvelopeLock(envelopesApi, accountId, request);

                UpdateRecipients(request, envelopesApi, accountId);
                UpdateDocumets(request, envelopesApi, accountId);

                var envelope = envelopesApi.GetEnvelope(accountId, request.EnvelopeInfo.EnvelopeID);

                var updatedEnvelope = new Envelope();
                envelope.Notification = CreateNotification(request.EnvelopeInfo);
                envelope.EmailSubject = request.EnvelopeInfo.Theme;
                envelope.EmailBlurb = request.EnvelopeInfo.MessageBody;

                var result = envelopesApi.Update(accountId, request.EnvelopeInfo.EnvelopeID, updatedEnvelope);
                var senderView = envelopesApi.CreateSenderView(accountId, request.EnvelopeInfo.EnvelopeID, options);

                return new UpdateEnvelopeResponseModel
                {
                    Envelope = result,
                    ViewUrl = senderView
                };
            });
        }
        /// <summary>
        /// Create an envelope and then create an embedded sending view for that envelope
        /// </summary>
        /// <param name="signerEmail">Email address for the signer</param>
        /// <param name="signerName">Full name of the signer</param>
        /// <param name="ccEmail">Email address for the cc recipient</param>
        /// <param name="ccName">Name of the cc recipient</param>
        /// <param name="accessToken">Access Token for API call (OAuth)</param>
        /// <param name="basePath">BasePath for API calls (URI)</param>
        /// <param name="accountId">The DocuSign Account ID (GUID or short version) for which the APIs call would be made</param>
        /// <param name="docPdf">String of bytes representing the document (pdf)</param>
        /// <param name="docDocx">String of bytes representing the Word document (docx)</param>
        /// <param name="startingView">The sending view to show initially (either "tagging" or "recipient")</param>
        /// <param name="returnUrl">URL user will be redirected to after they sign</param>
        /// <returns>URL to embed in your application</returns>
        public static string SendEnvelopeUsingEmbeddedSending(string signerEmail, string signerName, string ccEmail, string ccName, string docDocx, string docPdf, string accessToken, string basePath, string accountId, string startingView, string returnUrl)
        {
            var apiClient = new ApiClient(basePath);

            apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
            EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);

            // Step 1. Make the envelope with "created" (draft) status
            EnvelopeDefinition env        = MakeEnvelope(signerEmail, signerName, ccEmail, ccName, docDocx, docPdf, "created");
            EnvelopeSummary    results    = envelopesApi.CreateEnvelope(accountId, env);
            string             envelopeId = results.EnvelopeId;

            // Step 2. create the sender view
            // Call the CreateSenderView API
            // Exceptions will be caught by the calling function
            ReturnUrlRequest viewRequest = new ReturnUrlRequest
            {
                ReturnUrl = returnUrl
            };
            ViewUrl result1 = envelopesApi.CreateSenderView(accountId, envelopeId, viewRequest);
            // Switch to Recipient and Documents view if requested by the user
            String redirectUrl = result1.Url;

            Console.WriteLine("startingView: " + startingView);
            if ("recipient".Equals(startingView))
            {
                redirectUrl = redirectUrl.Replace("send=1", "send=0");
            }
            return(redirectUrl);
        }
Example #4
0
        } // end createEmbeddedSigningViewTest()

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public ViewUrl createEmbeddedConsoleViewTest()
        {
            // instantiate api client with appropriate environment (for production change to www.docusign.net/restapi)
            configureApiClient(BASE_URL);

            //===========================================================
            // Step 1:JWT Login()
            //===========================================================

            // call the JWT Configure and UserInfo API which sets the user's baseUrl and returns their accountId
            string accountId = JWTAuthLogin();

            //===========================================================
            // Step 2: Create Embedded Console View (URL)
            //===========================================================

            ReturnUrlRequest urlRequest = new ReturnUrlRequest();

            urlRequest.ReturnUrl = "https://www.docusign.com/devcenter";

            // Adding the envelopeId start sthe console with the envelope open
            EnvelopesApi envelopesApi = new EnvelopesApi();
            ViewUrl      viewUrl      = envelopesApi.CreateConsoleView(accountId, null);

            // Start the embedded signing session.
            System.Diagnostics.Process.Start(viewUrl.Url);

            return(viewUrl);
        } // end createEmbeddedConsoleViewTest()
        public void CreateCorrectViewTest()
        {
            try
            {
                // Create Envelope
                CreateEnvelopeTest();
                Assert.IsNotNull(TestConfig.EnvelopeId);

                // Start the embedded sending session
                ReturnUrlRequest urlRequest = new ReturnUrlRequest();
                urlRequest.ReturnUrl = TestConfig.DefaultReturnUrl;

                // Adding the envelopeId start sthe console with the envelope open
                CorrectViewRequest correctViewRequest = new CorrectViewRequest();
                correctViewRequest.ReturnUrl = TestConfig.DefaultReturnUrl;

                EnvelopesApi envelopesApi = new EnvelopesApi();
                ViewUrl      viewUrl      = envelopesApi.CreateCorrectView(TestConfig.AccountId, TestConfig.EnvelopeId, correctViewRequest);

                // Start the embedded signing session.
                System.Diagnostics.Process.Start(viewUrl.Url);
            }
            catch (DocuSign.eSign.Client.ApiException apiEx)
            {
                Assert.IsNotNull(apiEx.ErrorCode);
                Assert.IsTrue(!string.IsNullOrWhiteSpace(apiEx.Message));
                Assert.IsTrue(false, "Failed with ErrorCode: " + apiEx.ErrorCode + ", Message: " + apiEx.Message);
            }
        }
        public void CreateSenderView_CorrectInputParameters_ReturnViewUrl()
        {
            var envelopeStatusCreated = "created";

            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref _testConfig, envelopeStatusCreated);

            var options = new ReturnUrlRequest
            {
                ReturnUrl = _testConfig.ReturnUrl
            };

            ViewUrl senderView = _envelopesApi.CreateSenderView(_testConfig.AccountId, _testConfig.EnvelopeId, options);

            Assert.IsNotNull(senderView?.Url);
        }
Example #7
0
        public ViewUrl EmbeddedConsoleView(String accountId)
        {
            ReturnUrlRequest urlRequest = new ReturnUrlRequest();

            urlRequest.ReturnUrl = "https://www.docusign.com";

            // Adding the envelopeId start sthe console with the envelope open
            EnvelopesApi envelopesApi = new EnvelopesApi();
            ViewUrl      viewUrl      = envelopesApi.CreateConsoleView(accountId, null);

            // Start the embedded signing session.
            System.Diagnostics.Process.Start(viewUrl.Url);

            return(viewUrl);
        }
        public void JwtCreateEmbeddedSendingViewTest()
        {
            JwtRequestSignatureOnDocumentTest("created");

            ReturnUrlRequest options = new ReturnUrlRequest();

            options.ReturnUrl = testConfig.ReturnUrl;

            // |EnvelopesApi| contains methods related to envelopes and envelope recipients
            EnvelopesApi envelopesApi = new EnvelopesApi(testConfig.ApiClient.Configuration);

            // generate the embedded sending URL
            ViewUrl senderView = envelopesApi.CreateSenderView(testConfig.AccountId, testConfig.EnvelopeId, options);

            Assert.IsNotNull(senderView);
            Assert.IsNotNull(senderView.Url);
        }
Example #9
0
        // ***DS.snippet.0.start
        private string DoWork(string signerEmail, string signerName, string ccEmail,
                              string ccName, string accessToken, string basePath,
                              string accountId, string startingView, string dsReturnUrl)
        {
            // Data for this method
            // signerEmail
            // signerName
            // ccEmail
            // ccName
            // startingView
            // accessToken
            // basePath
            // accountId
            // dsReturnUrl

            var config = new Configuration(new ApiClient(basePath));

            config.AddDefaultHeader("Authorization", "Bearer " + accessToken);
            EnvelopesApi envelopesApi = new EnvelopesApi(config);

            // Step 1. Make the envelope with "created" (draft) status
            // Using eg002 to create the envelope with "created" status
            RequestItemsService.Status = "created";
            controller2 = new Eg002SigningViaEmailController(Config, RequestItemsService);
            EnvelopeSummary results    = controller2.DoWork(signerEmail, signerName, ccEmail, ccName);
            String          envelopeId = results.EnvelopeId;

            // Step 2. create the sender view
            // Call the CreateSenderView API
            // Exceptions will be caught by the calling function
            ReturnUrlRequest viewRequest = new ReturnUrlRequest
            {
                ReturnUrl = dsReturnUrl
            };
            ViewUrl result1 = envelopesApi.CreateSenderView(accountId, envelopeId, viewRequest);
            // Switch to Recipient and Documents view if requested by the user
            String redirectUrl = result1.Url;

            Console.WriteLine("startingView: " + startingView);
            if ("recipient".Equals(startingView))
            {
                redirectUrl = redirectUrl.Replace("send=1", "send=0");
            }
            return(redirectUrl);
        }
Example #10
0
 private Func <BaseRequestModel, ViewUrl> RedirectFunc()
 {
     return(request =>
     {
         var accountId = Authenticate(request.ESignAccount);
         var envelopesApi = new EnvelopesApi();
         var isFileExist = IsFileExist(request);
         var options = new ReturnUrlRequest
         {
             ReturnUrl = request.ESignAccount.IsTestApi != null && request.ESignAccount.IsTestApi.Value
                 ? Constants.Url.DemoDocuSignDocumentDetailsUrl + request.EnvelopeId
                 : Constants.Url.DocuSignDocumentDetailsUrl + request.EnvelopeId
         };
         if (isFileExist)
         {
             return envelopesApi.CreateSenderView(accountId, request.EnvelopeId, options);
         }
         throw new PXException(Messages.ESignEnvelopeNotExists);
     });
 }
Example #11
0
        public ViewUrl EmbeddedSenderView(String accountId, String envelopeId)
        {
            ReturnUrlRequest options = new ReturnUrlRequest();

            options.ReturnUrl = "https://www.docusign.com";

            // instantiate an envelopesApi object
            EnvelopesApi envelopesApi = new EnvelopesApi();

            // generate the embedded sending URL
            ViewUrl senderView = envelopesApi.CreateSenderView(accountId, envelopeId, options);

            // print the JSON response
            Console.WriteLine("ViewUrl:\n{0}", JsonConvert.SerializeObject(senderView));

            // Start the embedded sending session
            System.Diagnostics.Process.Start(senderView.Url);

            return(senderView);
        }
        public void JwtCreateEmbeddedSendingViewTest()
        {
            JwtRequestSignatureOnDocumentTest("created");

            ReturnUrlRequest options = new ReturnUrlRequest();

            options.ReturnUrl = testConfig.ReturnUrl;

            // |EnvelopesApi| contains methods related to envelopes and envelope recipients
            EnvelopesApi envelopesApi = new EnvelopesApi(testConfig.ApiClient.Configuration);

            // generate the embedded sending URL
            ViewUrl senderView = envelopesApi.CreateSenderView(testConfig.AccountId, testConfig.EnvelopeId, options);

            Assert.IsNotNull(senderView);

            // Start the embedded sending session
            //System.Diagnostics.Process.Start(senderView.Url);
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo("cmd", $"/c start {senderView.Url}"));

            Assert.IsNotNull(senderView.Url);
        }
Example #13
0
        private Func <CreateEnvelopeRequestModel, CreateEnvelopeResponseModel> SendRequestFunc()
        {
            return(request =>
            {
                var envDef = CreateEnvelopeDefinition(GetDocument(request), request);

                var accountId = Authenticate(request.ESignAccount);
                var envelopesApi = new EnvelopesApi();
                var options = new ReturnUrlRequest {
                    ReturnUrl = string.Empty
                };

                var envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);
                var senderView = envelopesApi.CreateSenderView(accountId, envelopeSummary.EnvelopeId, options);

                return new CreateEnvelopeResponseModel
                {
                    EnvelopeSummary = envelopeSummary,
                    ViewUrl = senderView
                };
            });
        }
Example #14
0
        public void EmbeddedConsoleTest()
        {
            try
            {
                // create draft envelope structure
                EnvelopeDefinition envDef = Utils.CreateDraftEnvelopeDefinition();
                envDef.EmailSubject = "EmbeddedConsoleTest";

                // call login to authenticate and get default accountId
                AuthenticationApiTests loginTests = new AuthenticationApiTests();
                loginTests.LoginTest();

                // create the Draft envelope on the DocuSign Service
                EnvelopesApi    envelopesApi = new EnvelopesApi();
                EnvelopeSummary envSummary   = envelopesApi.CreateEnvelope(TestConfig.AccountId, envDef);
                Assert.IsNotNull(envSummary);
                Assert.IsNotNull(envSummary.EnvelopeId);

                // Start the embedded sending session
                ReturnUrlRequest urlRequest = new ReturnUrlRequest();
                urlRequest.ReturnUrl = TestConfig.DefaultReturnUrl;

                // Adding the envelopeId start sthe console with the envelope open
                ConsoleViewRequest consoleViewRequest = new ConsoleViewRequest();
                consoleViewRequest.EnvelopeId = envSummary.EnvelopeId;
                ViewUrl viewUrl = envelopesApi.CreateConsoleView(TestConfig.AccountId, consoleViewRequest);

                // Start the embedded signing session.
                System.Diagnostics.Process.Start(viewUrl.Url);
            }
            catch (DocuSign.eSign.Client.ApiException apiEx)
            {
                Assert.IsNotNull(apiEx.ErrorCode);
                Assert.IsTrue(!string.IsNullOrWhiteSpace(apiEx.Message));
                Assert.IsTrue(false, "Failed with ErrorCode: " + apiEx.ErrorCode + ", Message: " + apiEx.Message);
            }
        }
        public void EmbeddedConsoleTest()
        {
            try
            {
                // create draft envelope structure
                EnvelopeDefinition envDef = Utils.CreateDraftEnvelopeDefinition();
                envDef.EmailSubject = "EmbeddedConsoleTest";

                // call login to authenticate and get default accountId
                AuthenticationApiTests loginTests = new AuthenticationApiTests();
                loginTests.LoginTest();

                // create the Draft envelope on the DocuSign Service
                EnvelopesApi envelopesApi = new EnvelopesApi();
                EnvelopeSummary envSummary = envelopesApi.CreateEnvelope(TestConfig.AccountId, envDef);
                Assert.IsNotNull(envSummary);
                Assert.IsNotNull(envSummary.EnvelopeId);

                // Start the embedded sending session
                ReturnUrlRequest urlRequest = new ReturnUrlRequest();
                urlRequest.ReturnUrl = TestConfig.DefaultReturnUrl;

                // Adding the envelopeId start sthe console with the envelope open
                ConsoleViewRequest consoleViewRequest = new ConsoleViewRequest();
                consoleViewRequest.EnvelopeId = envSummary.EnvelopeId;
                ViewUrl viewUrl = envelopesApi.CreateConsoleView(TestConfig.AccountId, consoleViewRequest);

                // Start the embedded signing session.
                System.Diagnostics.Process.Start(viewUrl.Url);
            }
            catch (DocuSign.eSign.Client.ApiException apiEx)
            {
                Assert.IsNotNull(apiEx.ErrorCode);
                Assert.IsTrue(!string.IsNullOrWhiteSpace(apiEx.Message));
                Assert.IsTrue(false, "Failed with ErrorCode: " + apiEx.ErrorCode + ", Message: " + apiEx.Message);
            }
        }
Example #16
0
        public async Task <IActionResult> ResendEmailAsync(
            ReturnUrlRequest returnUrl,
            CancellationToken token)
        {
            var data = TempData.Peek(EmailTime);

            if (data != null)
            {
                var temp = DateTime.Parse(TempData.Peek(EmailTime).ToString(), CultureInfo.InvariantCulture);

                if (temp > DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(0.5)))
                {
                    return(Ok());
                }
            }

            var email = TempData.Peek(Email);

            if (email == null)
            {
                ModelState.AddModelError(string.Empty, _localizer["EmailResend"]);
                return(BadRequest(ModelState));
            }
            var user = await _userManager.FindByEmailAsync(email.ToString());

            if (user == null)
            {
                ModelState.AddModelError(string.Empty, _localizer["UserNotExists"]);
                return(BadRequest(ModelState));
            }

            TempData[EmailTime] = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
            await GenerateEmailAsync(user, returnUrl, token);

            return(Ok());
        }
Example #17
0
        /// <summary>
        /// Provides a URL to start an edit view of the Template UI
        /// </summary>
        /// <exception cref="DocuSign.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <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="returnUrlRequest"> (optional)</param>
        /// <returns>TemplateViews</returns>
        public TemplateViews ViewsPostTemplateEditView(string accountId, string templateId, ReturnUrlRequest returnUrlRequest = null)
        {
            ApiResponse <TemplateViews> localVarResponse = ViewsPostTemplateEditViewWithHttpInfo(accountId, templateId, returnUrlRequest);

            return(localVarResponse.Data);
        }
Example #18
0
        /// <summary>
        /// Provides a URL to start an edit view of the Template UI
        /// </summary>
        /// <exception cref="DocuSign.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <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="returnUrlRequest"> (optional)</param>
        /// <returns>Task of ApiResponse (TemplateViews)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <TemplateViews> > ViewsPostTemplateEditViewAsyncWithHttpInfo(string accountId, string templateId, ReturnUrlRequest returnUrlRequest = null)
        {
            // verify the required parameter 'accountId' is set
            if (accountId == null)
            {
                throw new ApiException(400, "Missing required parameter 'accountId' when calling TemplateViewsApi->ViewsPostTemplateEditView");
            }
            // verify the required parameter 'templateId' is set
            if (templateId == null)
            {
                throw new ApiException(400, "Missing required parameter 'templateId' when calling TemplateViewsApi->ViewsPostTemplateEditView");
            }

            var    localVarPath         = "/v2/accounts/{accountId}/templates/{templateId}/views/edit";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType    = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (accountId != null)
            {
                localVarPathParams.Add("accountId", Configuration.ApiClient.ParameterToString(accountId));                    // path parameter
            }
            if (templateId != null)
            {
                localVarPathParams.Add("templateId", Configuration.ApiClient.ParameterToString(templateId));                     // path parameter
            }
            if (returnUrlRequest != null && returnUrlRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(returnUrlRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = returnUrlRequest; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("ViewsPostTemplateEditView", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <TemplateViews>(localVarStatusCode,
                                                   localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                   (TemplateViews)Configuration.ApiClient.Deserialize(localVarResponse, typeof(TemplateViews))));
        }
Example #19
0
        } // end listDocumentsAndDownloadTest()

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public ViewUrl createEmbeddedSendingViewTest()
        {
            // Enter your DocuSign credentials below.  Note: You only need a DocuSign account to SEND documents,
            // signing is always free and signers do not need an account.
            string username = "******";
            string password = "******";

            // Enter recipient (signer) name and email address
            string recipientName  = "[RECIPIENT_NAME]";
            string recipientEmail = "[RECIPIENT_EMAIL]";

            // the document (file) we want signed
            const string SignTest1File = @"[PATH/TO/DOCUMENT/TEST.PDF]";

            // instantiate api client with appropriate environment (for production change to www.docusign.net/restapi)
            configureApiClient("https://demo.docusign.net/restapi");

            //===========================================================
            // Step 1: Login()
            //===========================================================

            // call the Login() API which sets the user's baseUrl and returns their accountId
            string accountId = loginApi(username, password);

            //===========================================================
            // Step 2: Create A Draft Envelope
            //===========================================================

            // 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       = recipientEmail;
            signer.Name        = recipientName;
            signer.RecipientId = "1";

            // 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";
            signer.Tabs.SignHereTabs.Add(signHere);

            envDef.Recipients         = new Recipients();
            envDef.Recipients.Signers = new List <Signer>();
            envDef.Recipients.Signers.Add(signer);

            // must set status to "created" since we cannot open Sender View on an Envelope that has already been sent, only on draft envelopes
            envDef.Status = "created";

            // |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
            EnvelopesApi    envelopesApi    = new EnvelopesApi();
            EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);

            //===========================================================
            // Step 3: Create Embedded Sending View (URL)
            //===========================================================

            ReturnUrlRequest options = new ReturnUrlRequest();

            options.ReturnUrl = "https://www.docusign.com/devcenter";

            // generate the embedded sending URL
            ViewUrl senderView = envelopesApi.CreateSenderView(accountId, envelopeSummary.EnvelopeId, options);

            // print the JSON response
            Console.WriteLine("ViewUrl:\n{0}", JsonConvert.SerializeObject(senderView));

            // Start the embedded sending session
            System.Diagnostics.Process.Start(senderView.Url);

            return(senderView);
        } // end createEmbeddedSendingViewTest()
Example #20
0
        /// <summary>
        /// Provides a URL to start an edit view of the Template UI
        /// </summary>
        /// <exception cref="DocuSign.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <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="returnUrlRequest"> (optional)</param>
        /// <returns>Task of TemplateViews</returns>
        public async System.Threading.Tasks.Task <TemplateViews> ViewsPostTemplateEditViewAsync(string accountId, string templateId, ReturnUrlRequest returnUrlRequest = null)
        {
            ApiResponse <TemplateViews> localVarResponse = await ViewsPostTemplateEditViewAsyncWithHttpInfo(accountId, templateId, returnUrlRequest);

            return(localVarResponse.Data);
        }
Example #21
0
        /// <summary>
        /// Returns a URL to the sender view UI. Returns a URL that allows you to embed the sender view of the DocuSign UI in your applications. This is a one-time use login token that allows the user to be placed into the DocuSign sending view. \n\nUpon sending completion, the user is returned to the return URL provided by the API application.\n\nImportant: iFrames should not be used for embedded operations on mobile devices due to screen space issues. For iOS devices DocuSign recommends using a WebView.
        /// </summary>
 	    ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="envelopeId">The envelopeId Guid of the envelope being accessed.</param> <param name="returnUrlRequest">TBD Description</param>
		/// <returns>5ViewUrl</returns>
        public ViewUrl CreateSenderView (string accountId, string envelopeId, ReturnUrlRequest returnUrlRequest)
        {
             ApiResponse<ViewUrl> response = CreateSenderViewWithHttpInfo(accountId, envelopeId, returnUrlRequest);
             return response.Data;
        }
Example #22
0
        /// <summary>
        /// Returns a URL to the sender view UI. Returns a URL that allows you to embed the sender view of the DocuSign UI in your applications. This is a one-time use login token that allows the user to be placed into the DocuSign sending view. \n\nUpon sending completion, the user is returned to the return URL provided by the API application.\n\nImportant: iFrames should not be used for embedded operations on mobile devices due to screen space issues. For iOS devices DocuSign recommends using a WebView.
        /// </summary>
	    ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="envelopeId">The envelopeId Guid of the envelope being accessed.</param> <param name="returnUrlRequest">TBD Description</param>
		/// <returns>8Task of ApiResponse (ViewUrl)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<ViewUrl>> CreateSenderViewAsyncWithHttpInfo (string accountId, string envelopeId, ReturnUrlRequest returnUrlRequest)
        {
            // verify the required parameter 'accountId' is set
            if (accountId == null) throw new ApiException(400, "Missing required parameter 'accountId' when calling CreateSenderView");
            // verify the required parameter 'envelopeId' is set
            if (envelopeId == null) throw new ApiException(400, "Missing required parameter 'envelopeId' when calling CreateSenderView");
            
    
            var path_ = "/v2/accounts/{accountId}/envelopes/{envelopeId}/views/sender";
    
            var pathParams = new Dictionary<String, String>();
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>(Configuration.DefaultHeader);
            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 (envelopeId != null) pathParams.Add("envelopeId", Configuration.ApiClient.ParameterToString(envelopeId)); // path parameter
            

						
			
			

            
            
            postBody = Configuration.ApiClient.Serialize(returnUrlRequest); // http body (model) parameter
            

            

            // make the HTTP request
            IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams);

            int statusCode = (int) response.StatusCode;
 
            if (statusCode >= 400)
                throw new ApiException (statusCode, "Error calling CreateSenderView: " + response.Content, response.Content);
            else if (statusCode == 0)
                throw new ApiException (statusCode, "Error calling CreateSenderView: " + response.ErrorMessage, response.ErrorMessage);

            return new ApiResponse<ViewUrl>(statusCode,
                response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (ViewUrl) Configuration.ApiClient.Deserialize(response, typeof(ViewUrl)));
            
        }
Example #23
0
        /// <summary>
        /// Returns a URL to the sender view UI. Returns a URL that allows you to embed the sender view of the DocuSign UI in your applications. This is a one-time use login token that allows the user to be placed into the DocuSign sending view. \n\nUpon sending completion, the user is returned to the return URL provided by the API application.\n\nImportant: iFrames should not be used for embedded operations on mobile devices due to screen space issues. For iOS devices DocuSign recommends using a WebView.
        /// </summary>
 	    ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="envelopeId">The envelopeId Guid of the envelope being accessed.</param> <param name="returnUrlRequest">TBD Description</param>
		/// <returns>7Task of ViewUrl</returns>
        public async System.Threading.Tasks.Task<ViewUrl> CreateSenderViewAsync (string accountId, string envelopeId, ReturnUrlRequest returnUrlRequest)
        {
             ApiResponse<ViewUrl> response = await CreateSenderViewAsyncWithHttpInfo(accountId, envelopeId, returnUrlRequest);
             return response.Data;

        }