Example #1
0
        internal Silanis.ESL.API.Package ToAPIPackage()
        {
            if (sdkPackage == null)
            {
                return(apiPackage);
            }

            Silanis.ESL.API.Package package = new Silanis.ESL.API.Package();

            package.Name         = sdkPackage.Name;
            package.Due          = sdkPackage.ExpiryDate;
            package.Autocomplete = sdkPackage.Autocomplete;

            if (sdkPackage.Description != null)
            {
                package.Description = sdkPackage.Description;
            }

            if (sdkPackage.EmailMessage != null)
            {
                package.EmailMessage = sdkPackage.EmailMessage;
            }

            if (sdkPackage.Language != null)
            {
                package.Language = sdkPackage.Language.TwoLetterISOLanguageName;
            }

            if (sdkPackage.Settings != null)
            {
                package.Settings = sdkPackage.Settings.toAPIPackageSettings();
            }

            if (sdkPackage.SenderInfo != null)
            {
                package.Sender = new SenderConverter(sdkPackage.SenderInfo).ToAPISender();
            }

            if (sdkPackage.Attributes != null)
            {
                package.Data = sdkPackage.Attributes.Contents;
            }

            int signerCount = 1;

            foreach (Signer signer in sdkPackage.Signers.Values)
            {
                Silanis.ESL.API.Role role = new SignerConverter(signer).ToAPIRole("role" + signerCount);
                package.AddRole(role);
                signerCount++;
            }
            foreach (Signer signer in sdkPackage.Placeholders.Values)
            {
                Silanis.ESL.API.Role role = new SignerConverter(signer).ToAPIRole("role" + signerCount);
                package.AddRole(role);
                signerCount++;
            }

            return(package);
        }
		public void ConvertNullSDKToAPI()
		{
			sdkSigner1 = null;
			converter = new SignerConverter(sdkSigner1);

			Assert.IsNull(converter.ToAPISigner());
		}
		public void ConvertNullAPIToAPI()
		{
			apiRole = null;
			converter = new SignerConverter(apiRole);

			Assert.IsNull(converter.ToAPISigner());
		}
		internal Silanis.ESL.API.Package ToAPIPackage()
		{
			if (sdkPackage == null)
			{
				return apiPackage;
			}

			Silanis.ESL.API.Package package = new Silanis.ESL.API.Package();

			package.Name = sdkPackage.Name;
			package.Due = sdkPackage.ExpiryDate;
			package.Autocomplete = sdkPackage.Autocomplete;

			if (sdkPackage.Description != null)
			{
				package.Description = sdkPackage.Description;
			}

			if (sdkPackage.EmailMessage != null)
			{
				package.EmailMessage = sdkPackage.EmailMessage;
			}

			if (sdkPackage.Language != null)
			{
				package.Language = sdkPackage.Language.TwoLetterISOLanguageName;
			}

			if (sdkPackage.Settings != null)
			{
				package.Settings = sdkPackage.Settings.toAPIPackageSettings();
			}

			if (sdkPackage.SenderInfo != null)
			{
				package.Sender = new SenderConverter(sdkPackage.SenderInfo).ToAPISender();
			}

			if (sdkPackage.Attributes != null)
			{
				package.Data = sdkPackage.Attributes.Contents;
			}

			int signerCount = 1;
			foreach (Signer signer in sdkPackage.Signers.Values)
			{
				Silanis.ESL.API.Role role = new SignerConverter(signer).ToAPIRole("role" + signerCount);
				package.AddRole(role);
				signerCount++;
			}
			foreach (Signer signer in sdkPackage.Placeholders.Values)
			{
				Silanis.ESL.API.Role role = new SignerConverter(signer).ToAPIRole("role" + signerCount);
				package.AddRole(role);
				signerCount++;
			}

			return package;
		}
		/// <summary>
		/// Sender rejects signer's attachment requirement with a comment.
		/// </summary>
		/// <param name="packageId">Package identifier.</param>
		/// <param name="signer">Signer.</param>
		/// <param name="attachmentId">Attachment identifier.</param>
		/// <param name="senderComment">Sender comment.</param>
        public void RejectAttachment(PackageId packageId, Signer signer, String attachmentId, String senderComment)
        {
            signer.Attachments[attachmentId].SenderComment = senderComment;
            signer.Attachments[attachmentId].Status = RequirementStatus.REJECTED;
            Role apiRole = new SignerConverter(signer).ToAPIRole(System.Guid.NewGuid().ToString());
            
            apiClient.RejectAttachment(packageId.Id, apiRole);
        }
Example #6
0
        /// <summary>
        /// Sender rejects signer's attachment requirement with a comment.
        /// </summary>
        /// <param name="packageId">Package identifier.</param>
        /// <param name="signer">Signer.</param>
        /// <param name="attachmentId">Attachment identifier.</param>
        /// <param name="senderComment">Sender comment.</param>
        public void RejectAttachment(PackageId packageId, Signer signer, String attachmentId, String senderComment)
        {
            signer.Attachments[attachmentId].SenderComment = senderComment;
            signer.Attachments[attachmentId].Status        = RequirementStatus.REJECTED;
            Role apiRole = new SignerConverter(signer).ToAPIRole(System.Guid.NewGuid().ToString());

            apiClient.RejectAttachment(packageId.Id, apiRole);
        }
		/// <summary>
		/// Sender accepts signer's attachment requirement.
		/// </summary>
		/// <param name="packageId">Package identifier.</param>
		/// <param name="signer">Signer.</param>
		/// <param name="attachmentId">Attachment identifier.</param>
		public void AcceptAttachment(PackageId packageId, Signer signer, String attachmentId)
        {
            signer.Attachments[attachmentId].SenderComment = "";
            signer.Attachments[attachmentId].Status = Silanis.ESL.SDK.RequirementStatus.COMPLETE;
            
            Role apiRole = new SignerConverter(signer).ToAPIRole(System.Guid.NewGuid().ToString());
            
            apiClient.AcceptAttachment(packageId.Id, apiRole);
        }
Example #8
0
        /// <summary>
        /// Sender accepts signer's attachment requirement.
        /// </summary>
        /// <param name="packageId">Package identifier.</param>
        /// <param name="signer">Signer.</param>
        /// <param name="attachmentId">Attachment identifier.</param>
        public void AcceptAttachment(PackageId packageId, Signer signer, String attachmentId)
        {
            signer.Attachments[attachmentId].SenderComment = "";
            signer.Attachments[attachmentId].Status        = Silanis.ESL.SDK.RequirementStatus.COMPLETE;

            Role apiRole = new SignerConverter(signer).ToAPIRole(System.Guid.NewGuid().ToString());

            apiClient.AcceptAttachment(packageId.Id, apiRole);
        }
        internal Silanis.ESL.API.Package ToAPIPackage()
        {
            if (sdkPackage == null)
            {
                return(apiPackage);
            }

            Silanis.ESL.API.Package package = new Silanis.ESL.API.Package();

            package.Name         = sdkPackage.Name;
            package.Due          = sdkPackage.ExpiryDate;
            package.Autocomplete = sdkPackage.Autocomplete;

            if (sdkPackage.Id != null)
            {
                package.Id = sdkPackage.Id.ToString();
            }

            if (sdkPackage.Status != null)
            {
                package.Status = sdkPackage.Status;
            }

            if (sdkPackage.Description != null)
            {
                package.Description = sdkPackage.Description;
            }

            if (sdkPackage.EmailMessage != null)
            {
                package.EmailMessage = sdkPackage.EmailMessage;
            }

            if (sdkPackage.Language != null)
            {
                if (sdkPackage.Language.IsNeutralCulture)
                {
                    package.Language = sdkPackage.Language.TwoLetterISOLanguageName;
                }
                else
                {
                    string LanguageCountry = (new RegionInfo(sdkPackage.Language.LCID)).TwoLetterISORegionName;
                    package.Language = sdkPackage.Language.TwoLetterISOLanguageName + "-" + LanguageCountry;
                }
            }

            if (sdkPackage.Settings != null)
            {
                package.Settings = sdkPackage.Settings.toAPIPackageSettings();
            }

            if (sdkPackage.SenderInfo != null)
            {
                package.Sender = new SenderConverter(sdkPackage.SenderInfo).ToAPISender();
            }

            if (sdkPackage.Attributes != null)
            {
                package.Data = sdkPackage.Attributes.Contents;
            }

            if (sdkPackage.Notarized != null)
            {
                package.Notarized = sdkPackage.Notarized;
            }

            if (sdkPackage.Trashed != null)
            {
                package.Trashed = sdkPackage.Trashed;
            }

            if (sdkPackage.Visibility != null)
            {
                package.Visibility = sdkPackage.Visibility;
            }

            int signerCount = 1;

            foreach (Signer signer in sdkPackage.Signers)
            {
                Silanis.ESL.API.Role role = new SignerConverter(signer).ToAPIRole("signer" + signerCount);
                package.AddRole(role);
                signerCount++;
            }
            foreach (Signer signer in sdkPackage.Placeholders)
            {
                Silanis.ESL.API.Role role = new SignerConverter(signer).ToAPIRole(signer.Id, signer.PlaceholderName);
                role.Index = signer.SigningOrder;
                package.AddRole(role);
                signerCount++;
            }

            return(package);
        }