public void CreateEnvelopeFromStreamTest()
 {
     var envelope = new Envelope { Login = _account };
     byte[] byteArray = { 36, 45, 34, 67, 121, 87, 99, 32, 32, 32, 54, 54, 55, 56, 32 };
     var doc1 = new MemoryStream(byteArray);
     envelope.Status = "sent";
     var signers = new List<Signer>();
     signers.Add(new Signer { email = _account.Email, name = _account.AccountName, recipientId = "1", routingOrder = "1" });
     envelope.Recipients = new Recipients { signers = signers.ToArray() };
     Assert.IsTrue(envelope.Create(doc1, "test-self-signed.doc"));
     Assert.IsNull(envelope.RestError);
     Assert.IsTrue(envelope.GetRecipientView());
     Assert.IsNull(envelope.RestError);
     // note SenderViewUrl in this case is the Signer view (Recipient)
     Assert.IsNotNull(envelope.SenderViewUrl);
 }
Example #2
0
        //==========================================================================================
        // *** Walkthrough #8 - Embedded Signing
        //==========================================================================================
        private void EmbeddedSigning()
        {
            //*****************************************************************
            // ENTER VALUES FOR FOLLOWING VARIABLES!
            //*****************************************************************
            string AccountEmail = "***";
            string AccountPassword = "******";
            string EnvelopeId = "***";
            string RecipientEmail = "***";
            string RecipientName = "***";
            //*****************************************************************

            // user credentials 
            Account account = new Account();
            account.Email = AccountEmail;
            account.Password = AccountPassword;

            // make the login call (retrieves your baseUrl and accountId)
            bool result = account.Login();
            if (!result)
            {
                Console.WriteLine("Login API call failed for user {0}.\nError Code:  {1}\nMessage:  {2}", account.Email, account.RestError.errorCode, account.RestError.message);
                return;
            }

            // create envelope object and assign login info
            Envelope envelope = new Envelope();
            envelope.Login = account;

            // assign the envelope id that was passed in
            envelope.EnvelopeId = EnvelopeId;

            // add one signer (single recipient embedded signing currently supported in DocuSign .NET Client)
            envelope.Recipients = new Recipients()
            {
                signers = new Signer[]
                {
                    new Signer()
                    {
                        email = RecipientEmail,
                        name = RecipientName,
                        recipientId = "1"
                    }
                }
            };

            // generate the recipient view token
            result = envelope.GetRecipientView("http://www.nuget.org/packages/DocuSign.Integration.Client.dll/");

            if (!result)
            {
                if (envelope.RestError != null)
                {
                    Console.WriteLine("Error code:  {0}\nMessage:  {1}", envelope.RestError.errorCode, envelope.RestError.message);
                    return;
                }
                else
                {
                    Console.WriteLine("Error encountered retrieving signing token, please review your envelope and recipient data.");
                    return;
                }
            }
            else
            {
                // open the recipient view (SenderViewUrl field is re-used for the recipient URL)
                Process.Start(envelope.SenderViewUrl);
            }
        }