public ActionResult <string> DocusignGBME9Request(GBME9Request getData) { var emailTemplate = new EmailTemplate("Signature Request", "Hello please read the document and provide your signature in respective fields."); var docuSignTemplate = new DocuSignTemplate(getData.TemplateId, new List <string> { "Signer" }); var docuSignCredentials = new DocuSignCredentials(Configuration.GetSection("ClientEndPoints").GetSection("AccountUserName").Value, Configuration.GetSection("ClientEndPoints").GetSection("AccountPassword").Value, Configuration.GetSection("ClientEndPoints").GetSection("IntegratedKey").Value); var documentGenerator = new GenerateDocumentGBME9(docuSignCredentials, emailTemplate, docuSignTemplate); var returnedURL = documentGenerator.GenerateDocument(getData); return(new JsonResult(returnedURL)); }
public GenerateDocumentGBME9(DocuSignCredentials credentials, EmailTemplate emailTemplate, DocuSignTemplate docuSignTemplate) { this.DocuSignCredentials = credentials; this.EmailTemplate = emailTemplate; this.DocuSignTemplate = docuSignTemplate; }
public static DocuSignEnvelopeCM_v2 ParseXMLintoCM(DocuSignEnvelopeInformation curDocuSignEnvelopeInfo) { var result = new DocuSignEnvelopeCM_v2(); result.EnvelopeId = curDocuSignEnvelopeInfo.EnvelopeStatus.EnvelopeID; result.Status = Enum.GetName(typeof(EnvelopeStatusCode), curDocuSignEnvelopeInfo.EnvelopeStatus.Status); result.StatusChangedDateTime = DateTime.UtcNow; result.Subject = curDocuSignEnvelopeInfo.EnvelopeStatus.Subject; result.ExternalAccountId = curDocuSignEnvelopeInfo.EnvelopeStatus.Email; result.SentDate = curDocuSignEnvelopeInfo.EnvelopeStatus.Sent; result.CreateDate = curDocuSignEnvelopeInfo.EnvelopeStatus.Created; //Recipients foreach (var recipient in curDocuSignEnvelopeInfo.EnvelopeStatus.RecipientStatuses) { var docusignRecipient = new DocuSignRecipientStatus() { Type = Enum.GetName(typeof(RecipientTypeCode), recipient.Type), Email = recipient.Email, Name = recipient.UserName, RecipientId = recipient.RecipientId, RoutingOrderId = recipient.RoutingOrder.ToString(), Status = Enum.GetName(typeof(RecipientStatusCode), recipient.Status) }; //Tabs if (recipient.TabStatuses != null) { foreach (var dstab in recipient.TabStatuses.Where(a => a.CustomTabType != CustomTabType.Radio && a.CustomTabType != CustomTabType.List)) { DocuSignTabStatus tab = ParseTab(dstab); docusignRecipient.Tabs.Add(tab); } ParseTabsWithItems(recipient, docusignRecipient); } result.Recipients.Add(docusignRecipient); } foreach (var dstemplate in curDocuSignEnvelopeInfo.EnvelopeStatus.DocumentStatuses) { var template = new DocuSignTemplate(); template.DocumentId = dstemplate.ID; //sadly Connect gives us only a template name template.TemplateId = ""; template.Name = dstemplate.TemplateName; result.Templates.Add(template); } // Connect doesn't provide CourentRoutingOrder. let's assume that it's a highest routingOrderId from recipients who completed/signed var completedRecipients = curDocuSignEnvelopeInfo.EnvelopeStatus.RecipientStatuses.Where(a => a.Status == RecipientStatusCode.Completed || a.Status == RecipientStatusCode.Signed); if (completedRecipients.Count() > 0) { result.CurrentRoutingOrderId = completedRecipients.OrderByDescending(a => a.RoutingOrder).First().RoutingOrder.ToString(); } else { result.CurrentRoutingOrderId = curDocuSignEnvelopeInfo.EnvelopeStatus.RecipientStatuses.First().RoutingOrder.ToString(); } return(result); }
public static DocuSignEnvelopeCM_v2 ParseAPIresponsesIntoCM(out DocuSignEnvelopeCM_v2 envelope, TemplateInformation templates, Recipients recipients) { envelope = new DocuSignEnvelopeCM_v2(); envelope.CurrentRoutingOrderId = recipients.CurrentRoutingOrder; if (templates.Templates != null) { foreach (var ds_template in templates.Templates) { DocuSignTemplate template = new DocuSignTemplate(); template.DocumentId = ds_template.DocumentId; template.Name = ds_template.Name; template.TemplateId = ds_template.TemplateId; envelope.Templates.Add(template); } } //Recipients if (recipients.Signers != null) { foreach (var dsrecipient in recipients.Signers) { DocuSignRecipientStatus recipient = new DocuSignRecipientStatus(); recipient.Email = dsrecipient.Email; recipient.Name = dsrecipient.Name; recipient.RecipientId = dsrecipient.RecipientId; recipient.RoutingOrderId = dsrecipient.RoutingOrder; recipient.Status = dsrecipient.Status; recipient.Type = "Signer"; envelope.Recipients.Add(recipient); //Tabs if (dsrecipient.Tabs != null) { var tabsDTO = DocuSignTab.ExtractTabs(JObject.Parse(dsrecipient.Tabs.ToJson()), ""); foreach (var tabDTO in tabsDTO) { DocuSignTabStatus tab = new DocuSignTabStatus(); tab.DocumentId = tabDTO.DocumentId.ToString(); tab.Name = tabDTO.Name; tab.TabType = tabDTO.Type; tab.Value = tabDTO.Value; tab.TabLabel = tabDTO.TabLabel; if (tabDTO is DocuSignMultipleOptionsTabDTO) { var multiTabDTO = (DocuSignMultipleOptionsTabDTO)tabDTO; foreach (var childDTO in multiTabDTO.Items) { var childTab = new DocuSignTabStatus(); childTab.Selected = childDTO.Selected.ToString(); childTab.Value = childDTO.Value; childTab.TabLabel = childDTO.Text; tab.Items.Add(childTab); } } recipient.Tabs.Add(tab); } } } } return(envelope); }
public TemplateDO(DocuSignTemplate docusignTemplate) { this._docusignTemplate = docusignTemplate; }