public void CreateConsoleViewTest() { 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 ConsoleViewRequest consoleViewRequest = new ConsoleViewRequest(); consoleViewRequest.EnvelopeId = TestConfig.EnvelopeId; EnvelopesApi envelopesApi = new EnvelopesApi(); 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); } }
// ***DS.snippet.0.start private string DoWork(string accessToken, string basePath, string accountId, string startingView, string dsReturnUrl, string envelopeId) { // Data for this method // startingView // accessToken // basePath // accountId // dsReturnUrl // envelopeId var config = new Configuration(new ApiClient(basePath)); config.AddDefaultHeader("Authorization", "Bearer " + accessToken); EnvelopesApi envelopesApi = new EnvelopesApi(config); ConsoleViewRequest viewRequest = MakeConsoleViewRequest(dsReturnUrl, startingView, envelopeId); // Step 1. create the NDSE view // Call the CreateSenderView API // Exceptions will be caught by the calling function ViewUrl results = envelopesApi.CreateConsoleView(accountId, viewRequest); string redirectUrl = results.Url; return(redirectUrl); }
public void CreateConsoleView_CorrectInputParameters_ReturnViewUrl() { CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary( ref _testConfig); var consoleViewRequest = new ConsoleViewRequest { EnvelopeId = _testConfig.EnvelopeId, ReturnUrl = _testConfig.ReturnUrl }; ViewUrl viewUrl = _envelopesApi.CreateConsoleView(_testConfig.AccountId, consoleViewRequest); Assert.IsNotNull(viewUrl?.Url); }
public void JwtCreateEmbeddedConsoleViewTest() { JwtRequestSignatureOnDocumentTest(); // Adding the envelopeId start sthe console with the envelope open EnvelopesApi envelopesApi = new EnvelopesApi(testConfig.ApiClient.Configuration); ConsoleViewRequest consoleViewRequest = new ConsoleViewRequest(); consoleViewRequest.EnvelopeId = testConfig.EnvelopeId; consoleViewRequest.ReturnUrl = testConfig.ReturnUrl; ViewUrl viewUrl = envelopesApi.CreateConsoleView(testConfig.AccountId, consoleViewRequest); Assert.IsNotNull(viewUrl); Assert.IsNotNull(viewUrl.Url); }
/// <summary> /// Generates a URL to be use to embedded a view of an envelope in your application /// </summary> /// <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="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> /// <param name="envelopeId">The required envelopeId</param> /// <returns>URL for the embedded console for this envelope</returns> public static string CreateEmbeddedConsoleView(string accessToken, string basePath, string accountId, string startingView, string returnUrl, string envelopeId) { var apiClient = new ApiClient(basePath); apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); ConsoleViewRequest viewRequest = MakeConsoleViewRequest(returnUrl, startingView, envelopeId); // Step 1. create the NDSE view // Call the CreateSenderView API // Exceptions will be caught by the calling function ViewUrl results = envelopesApi.CreateConsoleView(accountId, viewRequest); string redirectUrl = results.Url; return(redirectUrl); }
public void LegacyCreateEmbeddedConsoleViewTest() { LegacyRequestSignatureOnDocumentTest(); // Adding the envelopeId start sthe console with the envelope open EnvelopesApi envelopesApi = new EnvelopesApi(testConfig.ApiClient.Configuration); ConsoleViewRequest consoleViewRequest = new ConsoleViewRequest(); consoleViewRequest.EnvelopeId = testConfig.EnvelopeId; consoleViewRequest.ReturnUrl = testConfig.ReturnUrl; ViewUrl viewUrl = envelopesApi.CreateConsoleView(testConfig.AccountId, consoleViewRequest); // Start the embedded signing session. System.Diagnostics.Process.Start(viewUrl.Url); Assert.IsNotNull(viewUrl); Assert.IsNotNull(viewUrl.Url); }
public void JwtCreateEmbeddedConsoleViewTest() { JwtRequestSignatureOnDocumentTest(); // Adding the envelopeId start sthe console with the envelope open EnvelopesApi envelopesApi = new EnvelopesApi(_testConfig.ApiClient); ConsoleViewRequest consoleViewRequest = new ConsoleViewRequest(); consoleViewRequest.EnvelopeId = _testConfig.EnvelopeId; consoleViewRequest.ReturnUrl = _testConfig.ReturnUrl; ViewUrl viewUrl = envelopesApi.CreateConsoleView(_testConfig.AccountId, consoleViewRequest); // Start the embedded signing session. //System.Diagnostics.Process.Start(viewUrl.Url); //System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo("cmd", $"/c start {viewUrl.Url}")); Assert.IsNotNull(viewUrl); Assert.IsNotNull(viewUrl.Url); }
private static ConsoleViewRequest MakeConsoleViewRequest(string dsReturnUrl, string startingView, string envelopeId) { // Data for this method // dsReturnUrl // startingView // envelopeId ConsoleViewRequest viewRequest = new ConsoleViewRequest(); // Set the URL where you want the recipient to go once they are done // with the NDSE. It is usually the case that the // user will never "finish" with the NDSE. // Assume that control will not be passed back to your app. viewRequest.ReturnUrl = dsReturnUrl; if ("envelope".Equals(startingView) && envelopeId != null) { viewRequest.EnvelopeId = envelopeId; } return(viewRequest); }
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); } }
/// <summary> /// Returns a URL to the authentication view UI. Returns a URL that allows you to embed the authentication view of the DocuSign UI in your applications. /// </summary> ///<param name="accountId">The external account number (int) or account ID Guid.</param> <param name="consoleViewRequest">TBD Description</param> /// <returns>6ApiResponse of ViewUrl</returns> public ApiResponse< ViewUrl > CreateConsoleViewWithHttpInfo (string accountId, ConsoleViewRequest consoleViewRequest) { // verify the required parameter 'accountId' is set if (accountId == null) throw new ApiException(400, "Missing required parameter 'accountId' when calling CreateConsoleView"); var path_ = "/v2/accounts/{accountId}/views/console"; 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 postBody = Configuration.ApiClient.Serialize(consoleViewRequest); // http body (model) parameter // make the HTTP request IRestResponse response = (IRestResponse) Configuration.ApiClient.CallApi(path_, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, pathParams); int statusCode = (int) response.StatusCode; if (statusCode >= 400) throw new ApiException (statusCode, "Error calling CreateConsoleView: " + response.Content, response.Content); else if (statusCode == 0) throw new ApiException (statusCode, "Error calling CreateConsoleView: " + 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))); }
/// <summary> /// Returns a URL to the authentication view UI. Returns a URL that allows you to embed the authentication view of the DocuSign UI in your applications. /// </summary> ///<param name="accountId">The external account number (int) or account ID Guid.</param> <param name="consoleViewRequest">TBD Description</param> /// <returns>5ViewUrl</returns> public ViewUrl CreateConsoleView (string accountId, ConsoleViewRequest consoleViewRequest) { ApiResponse<ViewUrl> response = CreateConsoleViewWithHttpInfo(accountId, consoleViewRequest); return response.Data; }
/// <summary> /// Returns a URL to the authentication view UI. Returns a URL that allows you to embed the authentication view of the DocuSign UI in your applications. /// </summary> ///<param name="accountId">The external account number (int) or account ID Guid.</param> <param name="consoleViewRequest">TBD Description</param> /// <returns>7Task of ViewUrl</returns> public async System.Threading.Tasks.Task<ViewUrl> CreateConsoleViewAsync (string accountId, ConsoleViewRequest consoleViewRequest) { ApiResponse<ViewUrl> response = await CreateConsoleViewAsyncWithHttpInfo(accountId, consoleViewRequest); return response.Data; }