public void PutRecipients_CorrectAccountIdEnvelopeIdAndRecipients_ReturnRecipientsUpdateSummary()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(
                ref _testConfig);

            var signHere = new SignHere()
            {
                Name        = "SignHereTab",
                XPosition   = "75",
                YPosition   = "572",
                TabLabel    = "SignHereTab",
                PageNumber  = "1",
                DocumentId  = "1",
                RecipientId = "1"
            };

            var signHereTabs = new List <SignHere> {
                signHere
            };

            var signerTabs = new Tabs()
            {
                SignHereTabs = signHereTabs
            };

            var newSigner = new Signer()
            {
                Name                     = "Test name",
                Email                    = "*****@*****.**",
                RoutingOrder             = "1",
                Status                   = "created",
                DeliveryMethod           = "Email",
                RecipientId              = "1",
                Tabs                     = signerTabs,
                IdCheckConfigurationName = "ID Check"
            };

            var signers = new List <Signer> {
                newSigner
            };
            var recipients = new Recipients()
            {
                Signers = signers
            };

            RecipientsUpdateSummary recipientsUpdateSummary = _envelopesApi.UpdateRecipients(
                _testConfig.AccountId,
                _testConfig.EnvelopeId,
                recipients);

            Assert.IsNotNull(recipientsUpdateSummary?.RecipientUpdateResults);

            Recipients updatedListRecipients = _envelopesApi.ListRecipients(
                _testConfig.AccountId,
                _testConfig.EnvelopeId);

            Assert.IsTrue(updatedListRecipients.Signers.Exists(
                              x =>
                              x.Name == newSigner.Name && x.Email == newSigner.Email));
        }
 private void JwtGetSampleEnvelopeIds()
 {
     if (_testConfig.EnvelopeIdsList.Count <= 0)
     {
         CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref _testConfig);
     }
 }
        public void GetDocument_CorrectInputParameters_ReturnMemoryStream()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref _testConfig);

            EnvelopeDocumentsResult docsList = _envelopesApi.ListDocuments(_testConfig.AccountId, _testConfig.EnvelopeId);

            Assert.IsNotNull(docsList?.EnvelopeId);

            int docCount = docsList.EnvelopeDocuments.Count;

            for (int i = 0; i < docCount; i++)
            {
                Assert.IsNotNull(docsList?.EnvelopeDocuments[i]?.DocumentId);

                MemoryStream docStream = (MemoryStream)_envelopesApi.GetDocument(
                    _testConfig.AccountId,
                    _testConfig.EnvelopeId,
                    docsList.EnvelopeDocuments[i].DocumentId);

                Assert.IsNotNull(docStream);

                string filePath = Path.GetTempPath() + Path.GetRandomFileName() + ".pdf";
                var    fs       = new FileStream(filePath, FileMode.Create);
                docStream.Seek(0, SeekOrigin.Begin);
                docStream.CopyTo(fs);
                fs.Close();
                Assert.IsNotNull(filePath);
            }
        }
        public void ListRecipients_CorrectAccountIdAndEnvelopeId_ReturnRecipients()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref _testConfig);

            Recipients recipients = _envelopesApi.ListRecipients(_testConfig.AccountId, _testConfig.EnvelopeId);

            Assert.IsNotNull(recipients?.RecipientCount);
        }
        public void GetEnvelope_CorrectAccountIdAndEnvelopeId_ReturnEnvelope()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref _testConfig);

            Envelope envInfo = _envelopesApi.GetEnvelope(_testConfig.AccountId, _testConfig.EnvelopeId);

            Assert.IsNotNull(envInfo?.EnvelopeId);
        }
        public void GetAuditEventsTest_CorrectAccountIdAndEnvelopeId_ReturnEnvelopeAuditEventResponse()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(
                ref _testConfig);

            EnvelopeAuditEventResponse listAuditEvents = _envelopesApi.ListAuditEvents(_testConfig.AccountId, _testConfig.EnvelopeId);

            Assert.IsNotNull(listAuditEvents?.AuditEvents);
        }
        public void ListTabs_CorrectInputParameters_ReturnTabs()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(
                ref _testConfig);

            Recipients recipients = _envelopesApi.ListRecipients(_testConfig.AccountId, _testConfig.EnvelopeId);

            Tabs tabs = _envelopesApi.ListTabs(_testConfig.AccountId, _testConfig.EnvelopeId, recipients.Signers.FirstOrDefault()?.RecipientId, new EnvelopesApi.ListTabsOptions {
                includeAnchorTabLocations = "true", includeMetadata = "true"
            });

            Assert.IsNotNull(tabs?.SignHereTabs);
        }
        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 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);
        }
        public void CreateRecipientView_CorrectInputParameters_ReturnViewUrl()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(
                ref _testConfig);

            var viewOptions = new RecipientViewRequest()
            {
                ReturnUrl            = _testConfig.ReturnUrl,
                ClientUserId         = "1234",
                AuthenticationMethod = "email",
                UserName             = _testConfig.RecipientName,
                Email = _testConfig.RecipientEmail
            };

            ViewUrl recipientView = _envelopesApi.CreateRecipientView(_testConfig.AccountId, _testConfig.EnvelopeId, viewOptions);

            Assert.IsNotNull(recipientView?.Url);
        }
        public void MoveEnvelopes_CorrectInputParameters_ReturnFolderResponse()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref _testConfig);

            var envelopesApi = new EnvelopesApi(_testConfig.ApiClient);

            Envelope envelope = envelopesApi.GetEnvelope(_testConfig.AccountId, _testConfig.EnvelopeId);

            Assert.IsNull(envelope?.VoidedDateTime);
            var foldersRequest = new FoldersRequest(new List <string> {
                _testConfig.EnvelopeId
            });

            var ToFolderId = "recyclebin";

            _foldersApi.MoveEnvelopes(_testConfig.AccountId, ToFolderId, foldersRequest);

            envelope = envelopesApi.GetEnvelope(_testConfig.AccountId, _testConfig.EnvelopeId);
            Assert.IsNotNull(envelope?.VoidedDateTime);
        }
        public void PutEnvelope_CorrectAccountIdEnvelopeIdAndEnvelope_ReturnEnvelopeUpdateSummary()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(
                ref _testConfig);

            var envelope = new Envelope()
            {
                EnvelopeId   = _testConfig.EnvelopeId,
                EmailSubject = "new email subject",
                EmailBlurb   = "new email message",
                Status       = "sent"
            };

            EnvelopeUpdateSummary envelopeUpdateSummary = _envelopesApi.Update(_testConfig.AccountId, _testConfig.EnvelopeId, envelope);

            Assert.IsNotNull(envelopeUpdateSummary?.EnvelopeId);

            Envelope renewedEnvelope = _envelopesApi.GetEnvelope(_testConfig.AccountId, _testConfig.EnvelopeId);

            Assert.AreEqual(envelope.EmailSubject, renewedEnvelope.EmailSubject);
            Assert.AreEqual(envelope.EmailBlurb, renewedEnvelope.EmailBlurb);
            Assert.AreEqual(envelope.Status, renewedEnvelope.Status);
        }
示例#13
0
        public static void RequestJWTUserToken_CorrectInputParameters_ReturnsOAuthToken(ref TestConfig testConfig)
        {
            testConfig.ApiClient = new ApiClient(testConfig.Host);

            Assert.IsNotNull(testConfig?.PrivateKey);

            byte[] privateKeyStream = testConfig.PrivateKey;

            var scopes = new List <string> {
                OAuth.Scope_SIGNATURE, OAuth.Scope_IMPERSONATION
            };

            OAuth.OAuthToken tokenInfo = testConfig.ApiClient.RequestJWTUserToken(
                testConfig.IntegratorKey,
                testConfig.UserId,
                testConfig.OAuthBasePath,
                privateKeyStream,
                testConfig.ExpiresInHours,
                scopes);

            OAuth.UserInfo userInfo = testConfig.ApiClient.GetUserInfo(tokenInfo.access_token);

            Assert.IsNotNull(userInfo?.Accounts);

            foreach (OAuth.UserInfo.Account item in userInfo.Accounts)
            {
                if (item.IsDefault == "true")
                {
                    testConfig.AccountId = item.AccountId;
                    testConfig.ApiClient.SetBasePath(item.BaseUri + "/restapi");
                    break;
                }
            }

            Assert.IsNotNull(testConfig?.AccountId);
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref testConfig);
        }
        public void PostRecipientTabs_CorrectAccountIdEnvelopeIdRecipientIdAndTabs_ReturnTabs()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(
                ref _testConfig);

            var tabs        = new Tabs();
            var approveTabs = new List <Approve>();
            var approveTab  = new Approve
            {
                Status        = "created",
                AnchorYOffset = "5",
                AnchorXOffset = "10",
                TabLabel      = "new approve tab"
            };

            approveTabs.Add(approveTab);
            tabs.ApproveTabs = approveTabs;

            Recipients recipients = _envelopesApi.ListRecipients(_testConfig.AccountId, _testConfig.EnvelopeId);
            Tabs       listTabs   = _envelopesApi.CreateTabs(_testConfig.AccountId, _testConfig.EnvelopeId, recipients.Signers.FirstOrDefault()?.RecipientId, tabs);

            Assert.IsNotNull(listTabs?.ApproveTabs);
            Assert.IsTrue(listTabs.ApproveTabs.Exists(x => x.TabLabel == approveTab.TabLabel));
        }