コード例 #1
0
        public static IEnumerable <KeyValueDTO> GetFolders(DocuSignApiConfiguration conf)
        {
            var api     = new FoldersApi(conf.Configuration);
            var folders = api.List(conf.AccountId);

            return(folders.Folders?.Where(a => a.Filter == null).Select(a => new KeyValueDTO(a.Name, a.FolderId)) ?? new List <KeyValueDTO>());
        }
コード例 #2
0
        private void SendDocuSignTestEnvelope(DocuSignManager docuSignManager, DocuSignApiConfiguration loginInfo, AuthorizationTokenDO authTokenDO)
        {
            var rolesList = new List <KeyValueDTO>()
            {
                new KeyValueDTO()
                {
                    Tags  = "recipientId:1",
                    Key   = "role name",
                    Value = ToEmail
                },
                new KeyValueDTO()
                {
                    Tags  = "recipientId:1",
                    Key   = "role email",
                    Value = ToEmail
                }
            };

            var fieldsList = new List <KeyValueDTO>()
            {
                new KeyValueDTO()
                {
                    Tags  = "recipientId:1",
                    Key   = "companyTabs",
                    Value = "test"
                },
                new KeyValueDTO()
                {
                    Tags  = "recipientId:1",
                    Key   = "textTabs",
                    Value = "test"
                },
                new KeyValueDTO()
                {
                    Tags  = "recipientId:1",
                    Key   = "noteTabs",
                    Value = "test"
                },
                new KeyValueDTO()
                {
                    Tags  = "recipientId:1",
                    Key   = "checkboxTabs",
                    Value = "Radio 1"
                },
                new KeyValueDTO()
                {
                    Tags  = "recipientId:1",
                    Key   = "listTabs",
                    Value = "1"
                }
            };

            docuSignManager.SendAnEnvelopeFromTemplate(
                loginInfo,
                rolesList,
                fieldsList,
                templateId
                );
        }
コード例 #3
0
        public string CreateConnect(DocuSignApiConfiguration conf, string name, string url)
        {
            var connectApi = new ConnectApi(conf.Configuration);
            var connect    = new ConnectConfiguration(name, url);
            var result     = connectApi.CreateConnect(conf.AccountId, connect);

            return(result.Data.connectId);
        }
コード例 #4
0
 private void AssertEnvelopeParameters(DocuSignApiConfiguration loginInfo, List <KeyValueDTO> rolesList, List <KeyValueDTO> fieldList, string curTemplateId, StandardFileDescriptionCM file)
 {
     Assert.AreEqual("*****@*****.**", rolesList[0].Value, "Incorrect value for role email field");
     Assert.AreEqual("Value", fieldList.First(x => x.Key == "DropDownListName").Value, "Incorrect value for list field");
     Assert.AreEqual("Value", fieldList.First(x => x.Key == "RadioName").Value, "Incorrect value for radio field");
     Assert.AreEqual("value", fieldList.First(x => x.Key == DocuSignConstants.DocuSignRoleName).Value, "Incorrect value for text field");
     Assert.AreEqual("true", fieldList.First(x => x.Key == "CheckBoxName").Value, "Incorrect value for checkbox field");
 }
コード例 #5
0
        public string ActivateConnect(DocuSignApiConfiguration conf, ConnectConfiguration connect)
        {
            var connectApi = new ConnectApi(conf.Configuration);

            connect.allowEnvelopePublish = "true";
            var response = connectApi.UpdateConnect(conf.AccountId, connect);

            return(response.Data.connectId);
        }
コード例 #6
0
        private List <DocuSignEnvelopeCM_v2> FillChangedEnvelopesWithData(DocuSignApiConfiguration config, IEnumerable <DocuSignEnvelopeCM_v2> changed_envelopes)
        {
            var result = new List <DocuSignEnvelopeCM_v2>();

            foreach (var envelope in changed_envelopes)
            {
                var filled_envelope = _docuSignManager.GetEnvelope(config, envelope.EnvelopeId);

                result.Add(filled_envelope);
            }

            return(result);
        }
コード例 #7
0
        public List <ConnectConfiguration> ListConnects(DocuSignApiConfiguration conf)
        {
            var connectApi  = new ConnectApi(conf.Configuration);
            var connectInfo = connectApi.ListConnects(conf.AccountId);

            if (Convert.ToInt16(connectInfo.Data.totalRecords) > 0)
            {
                return(connectInfo.Data.configurations);
            }
            else
            {
                return(new List <ConnectConfiguration>());
            }
        }
コード例 #8
0
 protected virtual void SendAnEnvelope(DocuSignApiConfiguration loginInfo,
                                       List <KeyValueDTO> rolesList, List <KeyValueDTO> fieldList, string curTemplateId)
 {
     try
     {
         DocuSignManager.SendAnEnvelopeFromTemplate(loginInfo, rolesList, fieldList, curTemplateId);
     }
     catch (Exception ex)
     {
         RaiseError($"Couldn't send an envelope. {ex}");
         return;
     }
     Success();
 }
コード例 #9
0
 protected override void SendAnEnvelope(DocuSignApiConfiguration loginInfo, List <FieldDTO> rolesList, List <FieldDTO> fieldList, string curTemplateId)
 {
     try
     {
         var      mttb  = GetControl <TextBoxBig>("mltb");
         string[] names = mttb.Value.Split(new string[] { "\n", ",", "\r" }, StringSplitOptions.RemoveEmptyEntries);
         SendPersonalEnvelope(loginInfo, rolesList, fieldList, curTemplateId, names);
     }
     catch (Exception ex)
     {
         RaiseError($"Couldn't send an envelope. {ex}");
         return;
     }
     Success();
 }
コード例 #10
0
        public string CreateOrActivateConnect(DocuSignApiConfiguration conf, string name, string url)
        {
            var connectApi = new ConnectApi(conf.Configuration);
            var connects   = ListConnects(conf);

            var existing_connect = connects.Where(a => a.name != null && a.name == name & a.urlToPublishTo != null).FirstOrDefault();

            if (existing_connect != null)
            {
                return(ActivateConnect(conf, existing_connect));
            }
            else
            {
                return(CreateConnect(conf, name, url));
            }
        }
コード例 #11
0
        public static IEnumerable <FolderItem> GetFolderItems(DocuSignApiConfiguration config, DocuSignQuery docuSignQuery)
        {
            var resultItems = new List <FolderItem>();

            FoldersApi api = new FoldersApi(config.Configuration);

            if (string.IsNullOrEmpty(docuSignQuery.Folder))
            {
                //return all envelopes from all folders
                var folders = api.List(config.AccountId).Folders.Where(a => a.Filter == null);
                if (folders != null)
                {
                    foreach (var item in folders)
                    {
                        var envelopesResponse = api.ListItems(config.AccountId, item.FolderId,
                                                              new FoldersApi.SearchOptions()
                        {
                            status     = docuSignQuery.Status,
                            searchText = docuSignQuery.SearchText
                        });
                        resultItems.AddRange(envelopesResponse.FolderItems);
                    }
                }
            }
            else
            {
                var envelopesResponse = api.ListItems(config.AccountId, docuSignQuery.Folder,
                                                      new FoldersApi.SearchOptions()
                {
                    status     = docuSignQuery.Status,
                    searchText = docuSignQuery.SearchText
                });
                resultItems.AddRange(envelopesResponse.FolderItems);
            }

            return(resultItems);
        }
        protected override void SendAnEnvelope(DocuSignApiConfiguration loginInfo,
                                               List <KeyValueDTO> rolesList, List <KeyValueDTO> fieldList, string curTemplateId)
        {
            try
            {
                var documentSelector = GetControl <CrateChooser>("document_selector");

                var fileCrate = documentSelector.GetValue(Payload);
                if (fileCrate == null)
                {
                    RaiseError($"New document file wasn't found");
                    return;
                }

                var file_manifest = fileCrate.Get <StandardFileDescriptionCM>();
                DocuSignManager.SendAnEnvelopeFromTemplate(loginInfo, rolesList, fieldList, curTemplateId, file_manifest);
            }
            catch (Exception ex)
            {
                RaiseError($"Couldn't send an envelope. {ex}");
            }

            Success();
        }
コード例 #13
0
        private void SendPersonalEnvelope(DocuSignApiConfiguration loginInfo,
                                          List <FieldDTO> rolesList, List <FieldDTO> fieldList, string curTemplateId, string[] names)
        {
            var          templatesApi = new TemplatesApi(loginInfo.Configuration);
            EnvelopesApi envelopesApi = new EnvelopesApi(loginInfo.Configuration);

            var template = templatesApi.ListTemplates(loginInfo.AccountId).EnvelopeTemplates.Where(x => x.Name.Contains("Personnel")).FirstOrDefault();



            EnvelopeDefinition envDef = new EnvelopeDefinition();

            envDef.EmailSubject = "Test message from Fr8";
            envDef.TemplateId   = template.TemplateId;


            envDef.Status = "created";

            var summ = envelopesApi.CreateEnvelope(loginInfo.AccountId, envDef);

            var recipients         = envelopesApi.ListRecipients(loginInfo.AccountId, summ.EnvelopeId);
            var recipientId        = recipients.Signers[0].RecipientId;
            var documentId         = envelopesApi.ListDocuments(loginInfo.AccountId, summ.EnvelopeId).EnvelopeDocuments[0].DocumentId;
            var tabs               = envelopesApi.ListTabs(loginInfo.AccountId, summ.EnvelopeId, recipientId);
            var templateRecepients = templatesApi.ListRecipients(loginInfo.AccountId, curTemplateId);

            tabs.SignHereTabs.FirstOrDefault().RecipientId = recipientId;
            envelopesApi.UpdateTabs(loginInfo.AccountId, summ.EnvelopeId, recipientId, tabs);
            tabs.SignHereTabs = null;


            tabs.TextTabs     = new List <Text>();
            tabs.CheckboxTabs = new List <Checkbox>();

            int i = 0;


            foreach (var person in names)
            {
                var textTab1 = JsonConvert.DeserializeObject <Text>(Tab1);
                var checkBox = JsonConvert.DeserializeObject <Checkbox>(checkBox1);
                var textTab2 = JsonConvert.DeserializeObject <Text>(Tab2);

                textTab1.YPosition = UpdateHeight(textTab1.YPosition, i);
                checkBox.YPosition = UpdateHeight(checkBox.YPosition, i);
                textTab2.YPosition = UpdateHeight(textTab2.YPosition, i);
                textTab1.Value     = person;
                textTab1.TabId     = "";
                checkBox.TabId     = "";
                textTab2.TabId     = "";

                textTab1.Name     = "Name " + i;
                textTab1.TabLabel = textTab1.Name;
                checkBox.Name     = "Present " + i;
                checkBox.TabLabel = checkBox.Name;
                textTab2.Name     = "Zombies " + i;
                textTab2.TabLabel = textTab2.Name;

                textTab1.RecipientId = recipientId;
                checkBox.RecipientId = recipientId;
                textTab2.RecipientId = recipientId;

                tabs.TextTabs.Add(textTab1);
                tabs.TextTabs.Add(textTab2);
                tabs.CheckboxTabs.Add(checkBox);

                i++;
            }

            foreach (var recepient in recipients.Signers)
            {
                var    corresponding_template_recipient = templateRecepients.Signers.Where(a => a.RoutingOrder == recepient.RoutingOrder).FirstOrDefault();
                var    related_fields = rolesList.Where(a => a.Tags.Contains("recipientId:" + corresponding_template_recipient.RecipientId));
                string new_email      = related_fields.Where(a => a.Key.Contains("role email")).FirstOrDefault().Value;
                string new_name       = related_fields.Where(a => a.Key.Contains("role name")).FirstOrDefault().Value;
                recepient.Name  = string.IsNullOrEmpty(new_name) ? recepient.Name : new_name;
                recepient.Email = string.IsNullOrEmpty(new_email) ? recepient.Email : new_email;
            }

            envelopesApi.UpdateRecipients(loginInfo.AccountId, summ.EnvelopeId, recipients);

            envelopesApi.CreateTabs(loginInfo.AccountId, summ.EnvelopeId, recipientId, tabs);
            // sending an envelope
            envelopesApi.Update(loginInfo.AccountId, summ.EnvelopeId, new Envelope()
            {
                Status = "sent"
            });
        }
コード例 #14
0
 public static int CountEnvelopes(DocuSignApiConfiguration config, DocuSignQuery docuSignQuery)
 {
     throw new NotImplementedException();
 }
コード例 #15
0
        public void DeleteConnect(DocuSignApiConfiguration conf, string connectId)
        {
            var connectApi = new ConnectApi(conf.Configuration);

            connectApi.DeleteConnect(conf.AccountId, connectId);
        }
コード例 #16
0
 public static object SearchDocuSign(DocuSignApiConfiguration config, List <FilterConditionDTO> conditions, HashSet <string> existing_envelopes, StandardPayloadDataCM search_result)
 {
     throw new NotImplementedException();
 }
コード例 #17
0
 public IEnumerable <KeyValueDTO> GetFolders(DocuSignApiConfiguration conf)
 {
     return(DocuSignFolders.GetFolders(conf));
 }
コード例 #18
0
 public IEnumerable <FolderItem> GetFolderItems(DocuSignApiConfiguration config, DocuSignQuery docuSignQuery)
 {
     return(DocuSignFolders.GetFolderItems(config, docuSignQuery));
 }