Ejemplo n.º 1
0
        static void sendSignatureRequest(HelloSign.Client client)
        {
            Console.WriteLine("4 - endTemplateSignatureRequest******************************************************* BEGIN");

            //var account = client.GetAccount();
            //Console.WriteLine("My Account ID is: " + account.AccountId);
            try
            {
                var request = new SignatureRequest();
                request.Title   = "C# sending a signature request";
                request.Subject = "C# send signature Request";
                request.Message = "Please sign this NDA and then we can discuss more. Let me know if you have questions";
                request.AddSigner("*****@*****.**", "Jack");
                request.AddSigner("*****@*****.**", "Jill");
                request.TestMode = true;
                request.AddFile("C:\\Users\\IEUser\\Downloads\\NDA10.pdf");
                var response = client.SendSignatureRequest(request);
                Console.WriteLine(response.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + " " + ex.StackTrace);
            }


            Console.WriteLine("3 - Send signature_request*************************************************************** END");
        }
Ejemplo n.º 2
0
 static void sendTemplateSignatureRequest(HelloSign.Client client)
 {
     try
     {
         Console.WriteLine("4 - TemplateSignatureRequest******************************************************* BEGIN");
         //Two roles - Consultant and Canidate
         var requestTemplate = new HelloSign.TemplateSignatureRequest();
         requestTemplate.AddTemplate("54cb9e7b076df6e9a78fc2c523aae4d78a25284d");
         requestTemplate.RequesterEmailAddress = "*****@*****.**";
         requestTemplate.TestMode = true;
         requestTemplate.Signers.Add(new Signer("*****@*****.**", "*****@*****.**", role: "canidate"));
         requestTemplate.Signers.Add(new Signer("*****@*****.**", "*****@*****.**", role: "consultant"));
         requestTemplate.AddCustomField("firstname", "TEST");
         var response = client.SendSignatureRequest(requestTemplate);
         Console.WriteLine(response);
         Console.WriteLine("4 - TemplateSignatureRequest******************************************************* END");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace + " " + ex.Message);
     }
 }
Ejemplo n.º 3
0
        /*
         * data = {
         *  'client_id': '21f3f5352a6a1419b8875db11dca5dd8',
         *  'template_id': 'cc93d9348fd415f1c54f632e75519d3296e7acb9',
         *  'subject': 'ticket214090',
         *  'message': 'ticket214090',
         *  'signers[Client][name]': 'George',
         *  'signers[Client][email_address]':'*****@*****.**',
         *  'custom_fields': '[{'name':'newline', 'value':'$20,000', 'editor':'Client', 'required':true}]',
         *  'test_mode': '1'
         * }
         *
         *
         *
         */
        static void sendPureRequest(HelloSign.Client client, string apikey, string function, string hs_login, string hs_password)
        {
            if (function == "getAccount")
            {
                try
                {
                    var restClient = new RestClient();



                    string buildTheRequest = "https://" + apikey + ":@api.hellosign.com";
                    restClient.BaseUrl       = new Uri(buildTheRequest);
                    restClient.Authenticator = new HttpBasicAuthenticator(hs_login, hs_password);

                    var request = new RestRequest();
                    request.Resource = "/v3/account";
                    IRestResponse response = restClient.Execute(request);

                    Console.WriteLine(response.Content);

                    if (response.ErrorException != null)
                    {
                        const string message            = "Error retrieving response.  Check inner details for more info.";
                        var          helloSignException = new ApplicationException(message, response.ErrorException);
                        throw helloSignException;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message, ex.InnerException.Message);
                }
            }
            else if (function == "sendSignatureRequest")
            {
                try
                {
                    var restClient = new RestClient();



                    string buildTheRequest = "https://" + apikey + ":@api.hellosign.com";
                    restClient.BaseUrl       = new Uri(buildTheRequest);
                    restClient.Authenticator = new HttpBasicAuthenticator(hs_login, hs_password);

                    var request = new RestRequest();
                    request.Resource = "v3/signature_request/send_with_template";
                    request.Method   = Method.POST;
                    request.AddParameter("template_id", "422eb83ea77961cee63298a6bb9a1e867bf5ba8d");
                    request.AddParameter("title", "test");
                    request.AddParameter("message", "testing");
                    request.AddParameter("signers[Client][name]", "George");
                    request.AddParameter("signers[Client][email_address]", "*****@*****.**");
                    request.AddParameter("test_mode", 1);



                    IRestResponse response = restClient.Execute(request);

                    Console.WriteLine(response.Content);

                    if (response.ErrorException != null)
                    {
                        const string message            = "Error retrieving response.  Check inner details for more info.";
                        var          helloSignException = new ApplicationException(message, response.ErrorException);
                        throw helloSignException;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message, ex.InnerException.Message);
                }
            }
            else if (function == "sendSignatureRequestCustomFieldsTemplate")
            {
                try
                {
                    var restClient = new RestClient();


                    // -F 'custom_fields=[{"name":"newline", "value":"$20,000", "editor":"Client", "required":true}]' \
                    //// -F 'custom_fields=[{'name':'newline', 'value':'$20,000', 'editor':'Client', 'required':true}]' \
                    string buildTheRequest = "https://" + apikey + ":@api.hellosign.com";
                    restClient.BaseUrl       = new Uri(buildTheRequest);
                    restClient.Authenticator = new HttpBasicAuthenticator(hs_login, hs_password);

                    var request = new RestRequest();
                    request.Resource = "v3/signature_request/send_with_template";
                    request.Method   = Method.POST;
                    request.AddParameter("template_id", "cc93d9348fd415f1c54f632e75519d3296e7acb9");
                    request.AddParameter("title", "test");
                    request.AddParameter("message", "testing");
                    request.AddParameter("signers[Client][name]", "George");
                    request.AddParameter("signers[Client][email_address]", "*****@*****.**");
                    request.AddParameter("custom_fields", "[{\"name\":\"newline\", \"value\":\"$20,000\", \"editor\":\"Client\", \"required\":true}]");
                    request.AddParameter("test_mode", 1);



                    IRestResponse response = restClient.Execute(request);

                    Console.WriteLine(response.Content);

                    if (response.ErrorException != null)
                    {
                        const string message            = "Error retrieving response.  Check inner details for more info.";
                        var          helloSignException = new ApplicationException(message, response.ErrorException);
                        throw helloSignException;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message, ex.InnerException.Message);
                }
            }



            /*
             * try
             * {
             *  var restClient = new RestClient();
             *  string buildTheRequest = "https://" + apikey + ":@api.hellosign.com/v3/signature_request/create_embedded_with_template";
             *  restClient.BaseUrl = new Uri(buildTheRequest);
             *  //restClient.Authenticator = new SimpleAuthenticator()
             *  restClient.Authenticator = new HttpBasicAuthenticator("*****@*****.**", "Virginia!");
             *  Console.WriteLine(buildTheRequest);
             *
             *  var request = new RestRequest();
             *  request.AddParameter("client_id", "21f3f5352a6a1419b8875db11dca5dd8", ParameterType.RequestBody);
             *  //request.AddParameter("template_id", "cc93d9348fd415f1c54f632e75519d3296e7acb9", ParameterType.RequestBody);
             *  request.AddParameter("template_id", "422eb83ea77961cee63298a6bb9a1e867bf5ba8d", ParameterType.RequestBody);
             *  request.AddParameter("subject", "ticket", ParameterType.RequestBody);
             *  request.AddParameter("message", "ticket", ParameterType.RequestBody);
             *  request.AddParameter("signers[Client][name]", "George", ParameterType.RequestBody);
             *  request.AddParameter("signers[Client][email_address]", "*****@*****.**", ParameterType.RequestBody);
             *  //request.AddParameter("'custom_fields", "[{'name':'newline', 'value':'$20,000', 'editor':'Client', 'required':true}]", ParameterType.RequestBody);
             *  request.AddParameter("test_mode", "1", ParameterType.RequestBody);
             *
             *
             *  // buildTheRequest = 'https://' + apikey + ':@api.hellosign.com/v3/signature_request/create_embedded_with_template'
             *  IRestResponse response = restClient.Execute(request);
             *
             *  Console.WriteLine(response.Content);
             *
             *
             *  if (response.ErrorException != null)
             *  {
             *      const string message = "Error retrieving response.  Check inner details for more info.";
             *      var helloSignException = new ApplicationException(message, response.ErrorException);
             *      throw helloSignException;
             *  }
             * }
             * catch (Exception ex)
             * {
             *  Console.WriteLine(ex.Message);
             * }
             *
             */
        }
Ejemplo n.º 4
0
 static void methodName(HelloSign.Client client)
 {
 }