internal static SignerBuilder NewSignerFromAPISigner(Silanis.ESL.API.Role role) { Silanis.ESL.API.Signer eslSigner = role.Signers [0]; SignerBuilder builder = SignerBuilder.NewSignerWithEmail(eslSigner.Email) .WithCustomId(eslSigner.Id) .WithFirstName(eslSigner.FirstName) .WithLastName(eslSigner.LastName) .WithCompany(eslSigner.Company) .WithTitle(eslSigner.Title) .SigningOrder(role.Index); if (role.Reassign) { builder.CanChangeSigner(); } if (role.EmailMessage != null) { builder.WithEmailMessage(role.EmailMessage.Content); } if (role.Locked) { builder.Lock(); } if (eslSigner.Delivery != null && eslSigner.Delivery.Email) { builder.DeliverSignedDocumentsByEmail(); } return(builder); }
public void ConvertNullAPIToAPI() { apiRole = null; converter = new SignerConverter(apiRole); Assert.IsNull(converter.ToAPISigner()); }
public void ConvertAPIToSDK() { apiRole = CreateTypicalAPIRole(); apiSigner1 = apiRole.Signers[0]; sdkSigner1 = new SignerConverter(apiRole).ToSDKSigner(); Assert.IsNotNull(sdkSigner1); Assert.AreEqual(apiSigner1.Email, sdkSigner1.Email); Assert.AreEqual(apiSigner1.FirstName, sdkSigner1.FirstName); Assert.AreEqual(apiSigner1.LastName, sdkSigner1.LastName); Assert.AreEqual(apiSigner1.Company, sdkSigner1.Company); Assert.AreEqual(apiSigner1.Title, sdkSigner1.Title); Assert.AreEqual(apiRole.Id, sdkSigner1.Id); Assert.AreEqual(apiRole.Index, sdkSigner1.SigningOrder); Assert.AreEqual(apiRole.Reassign, sdkSigner1.CanChangeSigner); Assert.AreEqual(apiRole.EmailMessage.Content, sdkSigner1.Message); Assert.AreEqual(apiSigner1.Delivery.Email, sdkSigner1.DeliverSignedDocumentsByEmail); string attachmentName = apiRole.AttachmentRequirements[0].Name; Silanis.ESL.API.AttachmentRequirement apiAttachment = apiRole.AttachmentRequirements[0]; Silanis.ESL.SDK.AttachmentRequirement sdkAttachment = sdkSigner1.GetAttachmentRequirement(attachmentName); Assert.AreEqual(attachmentName, sdkSigner1.GetAttachmentRequirement(attachmentName).Name); Assert.AreEqual(apiAttachment.Description, sdkAttachment.Description); Assert.AreEqual(apiAttachment.Required, sdkAttachment.Required); Assert.AreEqual(apiAttachment.Status.ToString(), sdkAttachment.Status.ToString()); Assert.AreEqual(apiAttachment.Comment, sdkAttachment.SenderComment); }
public void ConvertNullAPIToAPI() { apiRole = null; converter = new SignerConverter(apiRole); Assert.IsNull(converter.ToAPISigner()); }
public void ConvertSDKSignerWithNullEntriesToAPIRole() { String roleId = System.Guid.NewGuid().ToString().Replace("-", ""); sdkSigner1 = SignerBuilder.NewSignerWithEmail("*****@*****.**") .CanChangeSigner() .DeliverSignedDocumentsByEmail() .SigningOrder(1) .WithCompany("ABC Inc.") .WithFirstName("first name") .WithLastName("last name") .WithTitle("Miss") .Build(); apiRole = new SignerConverter(sdkSigner1).ToAPIRole(roleId); Assert.IsNotNull(apiRole); Assert.AreEqual(apiRole.Signers[0].Email, sdkSigner1.Email); Assert.AreEqual(apiRole.Signers[0].FirstName, sdkSigner1.FirstName); Assert.AreEqual(apiRole.Signers[0].LastName, sdkSigner1.LastName); Assert.AreEqual(apiRole.Signers[0].Company, sdkSigner1.Company); Assert.AreEqual(apiRole.Signers[0].Title, sdkSigner1.Title); Assert.AreEqual(apiRole.Id, roleId); Assert.AreEqual(apiRole.Name, roleId); Assert.IsNull(apiRole.EmailMessage); }
public void ConvertAPIToAPI() { apiRole = CreateTypicalAPIRole(); apiSigner1 = new SignerConverter(apiRole).ToAPISigner(); Assert.IsNotNull(apiSigner1); Assert.AreEqual(apiSigner1, apiRole.Signers[0]); }
public void ConvertAPIToAPI() { apiRole = CreateTypicalAPIRole(); apiSigner1 = new SignerConverter(apiRole).ToAPISigner(); Assert.IsNotNull(apiSigner1); Assert.AreEqual(apiSigner1, apiRole.Signers[0]); }
public SignerConverter (Silanis.ESL.API.Role apiRole) { this.apiRole = apiRole; if (apiRole != null) { this.apiSigner = apiRole.Signers[0]; } }
public SignerConverter(Silanis.ESL.API.Role apiRole) { this.apiRole = apiRole; if (apiRole != null) { this.apiSigner = apiRole.Signers[0]; } }
internal Silanis.ESL.API.Package ToAPIPackage() { Silanis.ESL.API.Package package = new Silanis.ESL.API.Package(); package.Name = Name; package.Description = Description; package.Autocomplete = Autocomplete; package.Due = ExpiryDate; package.EmailMessage = EmailMessage; if (Language != null) { package.Language = Language.TwoLetterISOLanguageName; } if (Settings != null) { package.Settings = Settings.toAPIPackageSettings(); } int signerCount = 1; foreach (Signer signer in Signers.Values) { Silanis.ESL.API.Role role = new Silanis.ESL.API.Role(); role.Name = "signer" + signerCount; role.AddSigner(signer.ToAPISigner()); role.Index = signer.SigningOrder; role.Reassign = signer.CanChangeSigner; if (String.IsNullOrEmpty(signer.RoleId)) { role.Id = "role" + signerCount; } else { role.Id = signer.RoleId; } if (!String.IsNullOrEmpty(signer.Message)) { Silanis.ESL.API.BaseMessage message = new Silanis.ESL.API.BaseMessage(); message.Content = signer.Message; role.EmailMessage = message; } package.AddRole(role); signerCount++; } return(package); }
public Silanis.ESL.API.Role ToAPIRole(string id, string name) { Silanis.ESL.API.Role role = new Silanis.ESL.API.Role(); if (!sdkSigner.IsPlaceholderSigner()) { role.AddSigner(new SignerConverter(sdkSigner).ToAPISigner()); } role.Index = sdkSigner.SigningOrder; role.Reassign = sdkSigner.CanChangeSigner; role.Locked = sdkSigner.Locked; foreach (AttachmentRequirement attachmentRequirement in sdkSigner.Attachments) { role.AddAttachmentRequirement(new AttachmentRequirementConverter(attachmentRequirement).ToAPIAttachmentRequirement()); } if (!String.IsNullOrEmpty(sdkSigner.Id)) { role.Id = sdkSigner.Id; } else if (sdkSigner.IsGroupSigner()) { role.Id = sdkSigner.GroupId.Id; } else { role.Id = id; } if (!String.IsNullOrEmpty(sdkSigner.PlaceholderName)) { role.Name = sdkSigner.PlaceholderName; } else { role.Name = name; } if (!String.IsNullOrEmpty(sdkSigner.Message)) { Silanis.ESL.API.BaseMessage message = new Silanis.ESL.API.BaseMessage(); message.Content = sdkSigner.Message; role.EmailMessage = message; } return(role); }
public void ConvertSDKSignerToAPIRole() { sdkSigner1 = CreateTypicalSDKSigner(); String roleId = System.Guid.NewGuid().ToString().Replace("-", ""); apiRole = new SignerConverter(sdkSigner1).ToAPIRole(roleId); Assert.IsNotNull(apiRole); Assert.AreEqual(apiRole.Signers[0].Email, sdkSigner1.Email); Assert.AreEqual(apiRole.Signers[0].FirstName, sdkSigner1.FirstName); Assert.AreEqual(apiRole.Signers[0].LastName, sdkSigner1.LastName); Assert.AreEqual(apiRole.Signers[0].Company, sdkSigner1.Company); Assert.AreEqual(apiRole.Signers[0].Title, sdkSigner1.Title); Assert.AreEqual(apiRole.Id, sdkSigner1.Id); Assert.AreEqual(apiRole.Name, sdkSigner1.Id); Assert.AreEqual(apiRole.EmailMessage.Content, sdkSigner1.Message); string attachmentName = apiRole.AttachmentRequirements[0].Name; Assert.AreEqual(apiRole.AttachmentRequirements[0].Name, sdkSigner1.Attachments[attachmentName].Name); Assert.AreEqual(apiRole.AttachmentRequirements[0].Description, sdkSigner1.Attachments[attachmentName].Description); Assert.AreEqual(apiRole.AttachmentRequirements[0].Required, sdkSigner1.Attachments[attachmentName].Required); }
public Silanis.ESL.API.Role ToAPIRole(string roleIdName) { Silanis.ESL.API.Role role = new Silanis.ESL.API.Role(); if ( !sdkSigner.IsPlaceholderSigner() ) { role.AddSigner(new SignerConverter(sdkSigner).ToAPISigner()); } role.Index = sdkSigner.SigningOrder; role.Reassign = sdkSigner.CanChangeSigner; role.Locked = sdkSigner.Locked; foreach (AttachmentRequirement attachmentRequirement in sdkSigner.Attachments.Values) { role.AddAttachmentRequirement(new AttachmentRequirementConverter(attachmentRequirement).ToAPIAttachmentRequirement()); } if (!String.IsNullOrEmpty(sdkSigner.Id)) { role.Id = sdkSigner.Id; role.Name = sdkSigner.Id; } else if (sdkSigner.IsGroupSigner()) { role.Id = role.Name = sdkSigner.GroupId.Id; } else { role.Id = role.Name = roleIdName; } if (!String.IsNullOrEmpty(sdkSigner.Message)) { Silanis.ESL.API.BaseMessage message = new Silanis.ESL.API.BaseMessage(); message.Content = sdkSigner.Message; role.EmailMessage = message; } return role; }
private Silanis.ESL.API.Role CreateTypicalAPIRole() { Silanis.ESL.API.Role apiRole = new Silanis.ESL.API.Role(); Silanis.ESL.API.Signer apiSigner = new Silanis.ESL.API.Signer(); apiSigner.Email = "*****@*****.**"; apiSigner.FirstName = "Signer first name"; apiSigner.LastName = "Signer last name"; apiSigner.Company = "ABC Inc."; apiSigner.SignerType = "THIRD_PARTY_SIGNER"; apiSigner.Language = "fr"; apiSigner.Title = "Doctor"; Silanis.ESL.API.Delivery delivery = new Silanis.ESL.API.Delivery(); delivery.Download = true; delivery.Email = true; apiSigner.Delivery = delivery; apiSigner.Id = "1"; apiRole.AddSigner(apiSigner); apiRole.Id = "3"; apiRole.Name = "Signer name"; apiRole.Index = 0; apiRole.Reassign = true; Silanis.ESL.API.BaseMessage baseMessage = new Silanis.ESL.API.BaseMessage(); baseMessage.Content = "Base message content."; apiRole.EmailMessage = baseMessage; apiRole.Locked = true; Silanis.ESL.API.AttachmentRequirement attachmentRequirement = new Silanis.ESL.API.AttachmentRequirement(); attachmentRequirement.Name = "Driver's license"; attachmentRequirement.Description = "Please upload your scanned driver's license."; attachmentRequirement.Status = Silanis.ESL.SDK.RequirementStatus.INCOMPLETE.getApiValue(); attachmentRequirement.Required = true; attachmentRequirement.Comment = "Attachment was not uploaded"; apiRole.AddAttachmentRequirement(attachmentRequirement); return(apiRole); }
public void ConvertSDKSignerToAPIRole() { sdkSigner1 = CreateTypicalSDKSigner(); String roleId = System.Guid.NewGuid().ToString().Replace("-", ""); apiRole = new SignerConverter(sdkSigner1).ToAPIRole(roleId); Assert.IsNotNull(apiRole); Assert.AreEqual(apiRole.Signers[0].Email, sdkSigner1.Email); Assert.AreEqual(apiRole.Signers[0].FirstName, sdkSigner1.FirstName); Assert.AreEqual(apiRole.Signers[0].LastName, sdkSigner1.LastName); Assert.AreEqual(apiRole.Signers[0].Company, sdkSigner1.Company); Assert.AreEqual(apiRole.Signers[0].Title, sdkSigner1.Title); Assert.AreEqual(apiRole.Id, sdkSigner1.Id); Assert.AreEqual(apiRole.Name, sdkSigner1.Id); Assert.AreEqual(apiRole.EmailMessage.Content, sdkSigner1.Message); string attachmentName = apiRole.AttachmentRequirements[0].Name; Assert.AreEqual(apiRole.AttachmentRequirements[0].Name, sdkSigner1.GetAttachmentRequirement(attachmentName).Name); Assert.AreEqual(apiRole.AttachmentRequirements[0].Description, sdkSigner1.GetAttachmentRequirement(attachmentName).Description); Assert.AreEqual(apiRole.AttachmentRequirements[0].Required, sdkSigner1.GetAttachmentRequirement(attachmentName).Required); }
public void ConvertAPIToSDK() { apiRole = CreateTypicalAPIRole(); apiSigner1 = apiRole.Signers[0]; sdkSigner1 = new SignerConverter(apiRole).ToSDKSigner(); Assert.IsNotNull(sdkSigner1); Assert.AreEqual(apiSigner1.Email, sdkSigner1.Email); Assert.AreEqual(apiSigner1.FirstName, sdkSigner1.FirstName); Assert.AreEqual(apiSigner1.LastName, sdkSigner1.LastName); Assert.AreEqual(apiSigner1.Company, sdkSigner1.Company); Assert.AreEqual(apiSigner1.Title, sdkSigner1.Title); Assert.AreEqual(apiRole.Id, sdkSigner1.Id); Assert.AreEqual(apiRole.Index, sdkSigner1.SigningOrder); Assert.AreEqual(apiRole.Reassign, sdkSigner1.CanChangeSigner); Assert.AreEqual(apiRole.EmailMessage.Content, sdkSigner1.Message); Assert.AreEqual(apiSigner1.Delivery.Email, sdkSigner1.DeliverSignedDocumentsByEmail); string attachmentName = apiRole.AttachmentRequirements[0].Name; Silanis.ESL.API.AttachmentRequirement apiAttachment = apiRole.AttachmentRequirements[0]; Silanis.ESL.SDK.AttachmentRequirement sdkAttachment = sdkSigner1.Attachments[attachmentName]; Assert.AreEqual(attachmentName, sdkSigner1.Attachments[attachmentName].Name); Assert.AreEqual(apiAttachment.Description, sdkAttachment.Description); Assert.AreEqual(apiAttachment.Required, sdkAttachment.Required); Assert.AreEqual(apiAttachment.Status.ToString(), sdkAttachment.Status.ToString()); Assert.AreEqual(apiAttachment.Comment, sdkAttachment.SenderComment); }
public void ConvertSDKSignerWithNullEntriesToAPIRole() { String roleId = System.Guid.NewGuid().ToString().Replace("-", ""); sdkSigner1 = SignerBuilder.NewSignerWithEmail("*****@*****.**") .CanChangeSigner() .DeliverSignedDocumentsByEmail() .Lock() .SigningOrder(1) .WithCompany("ABC Inc.") .WithFirstName("first name") .WithLastName("last name") .WithTitle("Miss") .Build(); apiRole = new SignerConverter(sdkSigner1).ToAPIRole(roleId); Assert.IsNotNull(apiRole); Assert.AreEqual(apiRole.Signers[0].Email, sdkSigner1.Email); Assert.AreEqual(apiRole.Signers[0].FirstName, sdkSigner1.FirstName); Assert.AreEqual(apiRole.Signers[0].LastName, sdkSigner1.LastName); Assert.AreEqual(apiRole.Signers[0].Company, sdkSigner1.Company); Assert.AreEqual(apiRole.Signers[0].Title, sdkSigner1.Title); Assert.AreEqual(apiRole.Id, roleId); Assert.AreEqual(apiRole.Name, roleId); Assert.IsNull(apiRole.EmailMessage); }
private static bool isGroupRole(Silanis.ESL.API.Role role) { return(role.Signers.Count == 1 && role.Signers[0].Group != null); }
private static bool isPlaceHolder(Silanis.ESL.API.Role role) { return(role.Signers.Count == 0); }
private Silanis.ESL.API.Role CreateTypicalAPIRole() { Silanis.ESL.API.Role apiRole = new Silanis.ESL.API.Role(); Silanis.ESL.API.Signer apiSigner = new Silanis.ESL.API.Signer(); apiSigner.Email = "*****@*****.**"; apiSigner.FirstName = "Signer first name"; apiSigner.LastName = "Signer last name"; apiSigner.Company = "ABC Inc."; apiSigner.Title = "Doctor"; Silanis.ESL.API.Delivery delivery = new Silanis.ESL.API.Delivery(); delivery.Download = true; delivery.Email = true; apiSigner.Delivery = delivery; apiSigner.Id = "1"; apiRole.AddSigner(apiSigner); apiRole.Id = "3"; apiRole.Name = "Signer name"; apiRole.Index = 0; apiRole.Reassign = true; Silanis.ESL.API.BaseMessage baseMessage = new Silanis.ESL.API.BaseMessage(); baseMessage.Content = "Base message content."; apiRole.EmailMessage = baseMessage; apiRole.Locked = true; Silanis.ESL.API.AttachmentRequirement attachmentRequirement = new Silanis.ESL.API.AttachmentRequirement(); attachmentRequirement.Name = "Driver's license"; attachmentRequirement.Description = "Please upload your scanned driver's license."; attachmentRequirement.Status = Silanis.ESL.API.RequirementStatus.INCOMPLETE; attachmentRequirement.Required = true; attachmentRequirement.Comment = "Attachment was not uploaded"; apiRole.AddAttachmentRequirement(attachmentRequirement); return apiRole; }
internal Silanis.ESL.API.Package ToAPIPackage() { Silanis.ESL.API.Package package = new Silanis.ESL.API.Package(); package.Name = Name; package.Description = Description; package.Autocomplete = Autocomplete; package.Due = ExpiryDate; package.EmailMessage = EmailMessage; if (Language != null) { package.Language = Language.TwoLetterISOLanguageName; } if (Settings != null) { package.Settings = Settings.toAPIPackageSettings(); } if (SenderInfo != null) { package.Sender = new SenderConverter(SenderInfo).ToAPISender(); } if ( Attributes != null ) { package.Data = Attributes.Contents; } int signerCount = 1; foreach (Signer signer in Signers.Values) { Silanis.ESL.API.Role role = new Silanis.ESL.API.Role(); role.Name = "signer" + signerCount; role.AddSigner(signer.ToAPISigner()); role.Index = signer.SigningOrder; role.Reassign = signer.CanChangeSigner; if (String.IsNullOrEmpty(signer.RoleId)) { role.Id = "role" + signerCount; } else { role.Id = signer.RoleId; } if (!String.IsNullOrEmpty(signer.Message)) { Silanis.ESL.API.BaseMessage message = new Silanis.ESL.API.BaseMessage(); message.Content = signer.Message; role.EmailMessage = message; } package.AddRole(role); signerCount++; } return package; }