Exemple #1
0
        internal PackageBuilder(Silanis.ESL.API.Package package)
        {
            this.id           = new PackageId(package.Id);
            this.packageName  = package.Name;
            this.autocomplete = package.Autocomplete;
            this.description  = package.Description;
            this.expiryDate   = package.Due;
            this.status       = ConvertPackageStatus(package.Status);
            this.emailMessage = package.EmailMessage;
            this.settings     = new DocumentPackageSettingsBuilder(package.Settings).build();

            foreach (Silanis.ESL.API.Role role in package.Roles)
            {
                if (role.Signers.Count == 0)
                {
                    continue;
                }

                Signer signer = SignerBuilder.NewSignerFromAPISigner(role).Build();

                WithSigner(signer);
            }

            foreach (Silanis.ESL.API.Document apiDocument in package.Documents)
            {
                Document document = DocumentBuilder.NewDocumentFromAPIDocument(apiDocument, package).Build();

                WithDocument(document);
            }
        }
Exemple #2
0
        public void LanguageDropDown()
        {
            DocumentPackageSettingsBuilder builder = DocumentPackageSettingsBuilder.NewDocumentPackageSettings();
            DocumentPackageSettings        unset   = builder.Build();

            Assert.IsFalse(unset.ShowLanguageDropDown.HasValue);
            DocumentPackageSettings with = builder.WithLanguageDropDown().Build();

            Assert.IsTrue(with.ShowLanguageDropDown.HasValue);
            Assert.IsTrue(with.ShowLanguageDropDown.Value);
            DocumentPackageSettings without = builder.WithoutLanguageDropDown().Build();

            Assert.IsTrue(without.ShowLanguageDropDown.HasValue);
            Assert.IsFalse(without.ShowLanguageDropDown.Value);
        }
Exemple #3
0
        public void EnforceCaptureSignature()
        {
            DocumentPackageSettingsBuilder builder = DocumentPackageSettingsBuilder.NewDocumentPackageSettings();
            DocumentPackageSettings        unset   = builder.Build();

            Assert.IsFalse(unset.EnforceCaptureSignature.HasValue);
            DocumentPackageSettings with = builder.WithEnforceCaptureSignature().Build();

            Assert.IsTrue(with.EnforceCaptureSignature.HasValue);
            Assert.IsTrue(with.EnforceCaptureSignature.Value);
            DocumentPackageSettings without = builder.WithoutEnforceCaptureSignature().Build();

            Assert.IsTrue(without.EnforceCaptureSignature.HasValue);
            Assert.IsFalse(without.EnforceCaptureSignature.Value);
        }
Exemple #4
0
        public void ShowOwnerInPersonDropDown()
        {
            DocumentPackageSettingsBuilder builder = DocumentPackageSettingsBuilder.NewDocumentPackageSettings();
            DocumentPackageSettings        unset   = builder.Build();

            Assert.IsFalse(unset.ShowOwnerInPersonDropDown.HasValue);
            DocumentPackageSettings with = builder.ShowOwnerInPersonDropDown().Build();

            Assert.IsTrue(with.ShowOwnerInPersonDropDown.HasValue);
            Assert.IsTrue(with.ShowOwnerInPersonDropDown.Value);
            DocumentPackageSettings without = builder.HideOwnerInPersonDropDown().Build();

            Assert.IsTrue(without.ShowOwnerInPersonDropDown.HasValue);
            Assert.IsFalse(without.ShowOwnerInPersonDropDown.Value);
        }
Exemple #5
0
        public void SecondAffidavit()
        {
            DocumentPackageSettingsBuilder builder = DocumentPackageSettingsBuilder.NewDocumentPackageSettings();
            DocumentPackageSettings        unset   = builder.Build();

            Assert.IsFalse(unset.EnableSecondAffidavit.HasValue);
            DocumentPackageSettings with = builder.EnableSecondAffidavit().Build();

            Assert.IsTrue(with.EnableSecondAffidavit.HasValue);
            Assert.IsTrue(with.EnableSecondAffidavit.Value);
            DocumentPackageSettings without = builder.DisableSecondAffidavit().Build();

            Assert.IsTrue(without.EnableSecondAffidavit.HasValue);
            Assert.IsFalse(without.EnableSecondAffidavit.Value);
        }
        public void ShowNseOverview()
        {
            DocumentPackageSettingsBuilder builder = DocumentPackageSettingsBuilder.NewDocumentPackageSettings();
            DocumentPackageSettings        unset   = builder.Build();

            Assert.IsFalse(unset.ShowNseOverview.HasValue);
            DocumentPackageSettings with = builder.WithShowNseOverview().Build();

            Assert.IsTrue(with.ShowNseOverview.HasValue);
            Assert.IsTrue(with.ShowNseOverview.Value);
            DocumentPackageSettings without = builder.WithoutShowNseOverview().Build();

            Assert.IsTrue(without.ShowNseOverview.HasValue);
            Assert.IsFalse(without.ShowNseOverview.Value);
        }
        public void LeftMenuExpand()
        {
            DocumentPackageSettingsBuilder builder = DocumentPackageSettingsBuilder.NewDocumentPackageSettings();
            DocumentPackageSettings        unset   = builder.Build();

            Assert.IsFalse(unset.ExpandLeftMenu.HasValue);
            DocumentPackageSettings with = builder.WithLeftMenuExpand().Build();

            Assert.IsTrue(with.ExpandLeftMenu.HasValue);
            Assert.IsTrue(with.ExpandLeftMenu.Value);
            DocumentPackageSettings without = builder.WithoutLeftMenuExpand().Build();

            Assert.IsTrue(without.ExpandLeftMenu.HasValue);
            Assert.IsFalse(without.ExpandLeftMenu.Value);
        }
Exemple #8
0
        public void TimeBasedExpiry()
        {
            DocumentPackageSettingsBuilder builder = DocumentPackageSettingsBuilder.NewDocumentPackageSettings();
            DocumentPackageSettings        unset   = builder.Build();

            Assert.IsFalse(unset.DefaultTimeBasedExpiry.HasValue);
            DocumentPackageSettings with = builder.WithDefaultTimeBasedExpiry().WithRemainingDays(14).Build();

            Assert.IsTrue(with.DefaultTimeBasedExpiry.HasValue);
            Assert.IsTrue(with.DefaultTimeBasedExpiry.Value);
            Assert.IsTrue(with.RemainingDays.Value == 14);
            DocumentPackageSettings without = builder.WithoutDefaultTimeBasedExpiry().Build();

            Assert.IsTrue(without.DefaultTimeBasedExpiry.HasValue);
            Assert.IsFalse(without.DefaultTimeBasedExpiry.Value);
        }
Exemple #9
0
        internal PackageBuilder(Silanis.ESL.API.Package package)
        {
            this.id           = new PackageId(package.Id);
            this.packageName  = package.Name;
            this.autocomplete = package.Autocomplete;
            this.description  = package.Description;
            this.expiryDate   = package.Due;
            this.status       = ConvertPackageStatus(package.Status);
            this.emailMessage = package.EmailMessage;
            this.settings     = new DocumentPackageSettingsBuilder(package.Settings).build();
            this.senderInfo   = new SenderConverter(package.Sender).ToSDKSenderInfo();
            this.attributes   = new DocumentPackageAttributes(package.Data);

            foreach (Silanis.ESL.API.Role role in package.Roles)
            {
                if (role.Signers.Count == 0)
                {
                    continue;
                }

                if (role.Signers[0].Group != null)
                {
                    WithSigner(SignerBuilder.NewSignerFromGroup(new GroupId(role.Signers[0].Group.Id)));
                }
                else
                {
                    WithSigner(SignerBuilder.NewSignerFromAPISigner(role).Build());
                    if (role.Type == Silanis.ESL.API.RoleType.SENDER)
                    {
                        Silanis.ESL.API.Signer senderSigner = role.Signers[0];
                        WithSenderInfo(SenderInfoBuilder.NewSenderInfo(senderSigner.Email)
                                       .WithName(senderSigner.FirstName, senderSigner.LastName)
                                       .WithCompany(senderSigner.Company)
                                       .WithTitle(senderSigner.Title));
                    }
                }
            }

            foreach (Silanis.ESL.API.Document apiDocument in package.Documents)
            {
                Document document = DocumentBuilder.NewDocumentFromAPIDocument(apiDocument, package).Build();

                WithDocument(document);
            }
        }
		internal PackageBuilder (Silanis.ESL.API.Package package)
		{
			this.id = new PackageId( package.Id );
			this.packageName = package.Name;
			this.autocomplete = package.Autocomplete;
			this.description = package.Description;
			this.expiryDate = package.Due;
			this.status = ConvertPackageStatus(package.Status);
			this.emailMessage = package.EmailMessage;
            this.settings = new DocumentPackageSettingsBuilder(package.Settings).build();
			this.senderInfo = new SenderConverter(package.Sender).ToSDKSenderInfo();
            this.attributes = new DocumentPackageAttributes(package.Data);

			foreach ( Silanis.ESL.API.Role role in package.Roles ) {
				if ( role.Signers.Count == 0 ) {
					continue;
				}

				if (role.Signers[0].Group != null)
				{
					WithSigner(SignerBuilder.NewSignerFromGroup(new GroupId(role.Signers[0].Group.Id)));
				}
				else
				{
					WithSigner(SignerBuilder.NewSignerFromAPISigner(role).Build());
					if (role.Type == Silanis.ESL.API.RoleType.SENDER)
					{
						Silanis.ESL.API.Signer senderSigner = role.Signers[0];
						WithSenderInfo( SenderInfoBuilder.NewSenderInfo(senderSigner.Email)
							.WithName(senderSigner.FirstName, senderSigner.LastName)
							.WithCompany(senderSigner.Company)
							.WithTitle(senderSigner.Title));
					}
				}
			}

			foreach ( Silanis.ESL.API.Document apiDocument in package.Documents ) {
				Document document = DocumentBuilder.NewDocumentFromAPIDocument( apiDocument, package ).Build();

				WithDocument( document );
			}
		}
Exemple #11
0
        private void assertPackageSettings(DocumentPackageSettings actualSettings, DocumentPackageSettings expectedSettings)
        {
            Assert.AreEqual(expectedSettings.EnableInPerson, actualSettings.EnableInPerson);

            Assert.AreEqual(expectedSettings.EnableDecline, actualSettings.EnableDecline);
            Assert.AreEqual(expectedSettings.DeclineReasons.Count, actualSettings.DeclineReasons.Count);
            Assert.AreEqual(expectedSettings.DeclineReasons[0], actualSettings.DeclineReasons[0]);
            Assert.AreEqual(expectedSettings.DeclineReasons[1], actualSettings.DeclineReasons[1]);
            Assert.AreEqual(expectedSettings.DeclineReasons[2], actualSettings.DeclineReasons[2]);

            Assert.AreEqual(expectedSettings.LinkHref, actualSettings.LinkHref);
            Assert.AreEqual(expectedSettings.LinkText, actualSettings.LinkText);
            Assert.AreEqual(expectedSettings.LinkTooltip, actualSettings.LinkTooltip);

            Assert.AreEqual(expectedSettings.EnableOptOut, actualSettings.EnableOptOut);
            Assert.AreEqual(expectedSettings.OptOutReasons.Count, actualSettings.OptOutReasons.Count);
            Assert.AreEqual(expectedSettings.OptOutReasons[0], actualSettings.OptOutReasons[0]);
            Assert.AreEqual(expectedSettings.OptOutReasons[1], actualSettings.OptOutReasons[1]);
            Assert.AreEqual(expectedSettings.OptOutReasons[2], actualSettings.OptOutReasons[2]);
        }
        override public void Execute()
        {
            sentLayoutSettings = CeremonyLayoutSettingsBuilder.NewCeremonyLayoutSettings()
                                 .WithBreadCrumbs()
                                 .WithGlobalConfirmButton()
                                 .WithGlobalDownloadButton()
                                 .WithGlobalNavigation()
                                 .WithGlobalSaveAsLayoutButton()
                                 .WithIFrame()
                                 .WithLogoImageLink("old logo image link")
                                 .WithLogoImageSource("old logo image source")
                                 .WithNavigator()
                                 .WithProgressBar()
                                 .WithSessionBar()
                                 .WithTitle()
                                 .Build();

            sentSettings = DocumentPackageSettingsBuilder.NewDocumentPackageSettings()
                           .WithCaptureText()
                           .WithDecline()
                           .WithDialogOnComplete()
                           .WithDocumentToolbarDownloadButton()
                           .WithHandOverLinkHref("http://www.old.ca")
                           .WithHandOverLinkText("old hand over link text")
                           .WithHandOverLinkTooltip("old hand over link tool tip")
                           .WithInPerson()
                           .WithOptOut()
                           .WithOptOutReason("old opt out reason #1")
                           .WithOptOutReason("old opt out reason #2")
                           .WithOptOutReason("old opt out reason #3")
                           .WithWatermark()
                           .WithCeremonyLayoutSettings(sentLayoutSettings)
                           .Build();

            sentPackage = PackageBuilder.NewPackageNamed("Old Package Name")
                          .DescribedAs("Old Description")
                          .WithEmailMessage("Old Email Message")
                          .ExpiresOn(DateTime.Now.AddMonths(1))
                          .WithLanguage(CultureInfo.GetCultureInfo("en"))
                          .WithAutomaticCompletion()
                          .WithSettings(sentSettings)
                          .Build();

            packageId = eslClient.CreatePackage(sentPackage);

            updatedLayoutSettings = CeremonyLayoutSettingsBuilder.NewCeremonyLayoutSettings()
                                    .WithoutBreadCrumbs()
                                    .WithoutGlobalConfirmButton()
                                    .WithoutGlobalDownloadButton()
                                    .WithoutGlobalNavigation()
                                    .WithoutGlobalSaveAsLayoutButton()
                                    .WithoutIFrame()
                                    .WithLogoImageLink("new logo image link")
                                    .WithLogoImageSource("new logo image source")
                                    .WithoutNavigator()
                                    .WithoutProgressBar()
                                    .WithoutSessionBar()
                                    .WithoutTitle()
                                    .Build();

            updatedSettings = DocumentPackageSettingsBuilder.NewDocumentPackageSettings()
                              .WithoutCaptureText()
                              .WithoutDecline()
                              .WithoutDialogOnComplete()
                              .WithoutDocumentToolbarDownloadButton()
                              .WithHandOverLinkHref("http://www.new.ca")
                              .WithHandOverLinkText("new hand over link text")
                              .WithHandOverLinkTooltip("new hand over link tool tip")
                              .WithoutInPerson()
                              .WithoutOptOut()
                              .WithOptOutReason("new opt out reason #1")
                              .WithOptOutReason("new opt out reason #2")
                              .WithOptOutReason("new opt out reason #3")
                              .WithoutWatermark()
                              .WithCeremonyLayoutSettings(updatedLayoutSettings)
                              .Build();

            updatedPackage = PackageBuilder.NewPackageNamed("New Package Name")
                             .WithEmailMessage("New Email Message")
                             .ExpiresOn(DateTime.Now.AddMonths(2))
                             .WithLanguage(CultureInfo.GetCultureInfo("fr"))
                             .WithoutAutomaticCompletion()
                             .WithSettings(updatedSettings)
                             .Build();

            eslClient.UpdatePackage(packageId, updatedPackage);

            retrievedPackage        = eslClient.GetPackage(packageId);
            retrievedSettings       = retrievedPackage.Settings;
            retrievedLayoutSettings = retrievedSettings.CeremonyLayoutSettings;
        }
Exemple #13
0
        override public void Execute()
        {
            layoutSettingsToCreate = CeremonyLayoutSettingsBuilder.NewCeremonyLayoutSettings()
                                     .WithBreadCrumbs()
                                     .WithGlobalConfirmButton()
                                     .WithGlobalDownloadButton()
                                     .WithGlobalNavigation()
                                     .WithGlobalSaveAsLayoutButton()
                                     .WithLogoImageLink(OLD_LOGO_IMAGE_LINK)
                                     .WithLogoImageSource(OLD_LOGO_IMAGE_SOURCE)
                                     .WithNavigator()
                                     .WithProgressBar()
                                     .WithSessionBar()
                                     .WithTitle()
                                     .Build();

            settingsToCreate = DocumentPackageSettingsBuilder.NewDocumentPackageSettings()
                               .WithCaptureText()
                               .WithDecline()
                               .WithDeclineReason(OLD_DECLINE_REASON_1)
                               .WithDeclineReason(OLD_DECLINE_REASON_2)
                               .WithDeclineReason(OLD_DECLINE_REASON_3)
                               .WithDialogOnComplete()
                               .WithDocumentToolbarDownloadButton()
                               .WithHandOverLinkHref(OLD_HAND_OVER_LINK_HREF)
                               .WithHandOverLinkText(OLD_HAND_OVER_LINK_TEXT)
                               .WithHandOverLinkTooltip(OLD_HAND_OVER_LINK_TOOL_TIP)
                               .WithInPerson()
                               .WithOptOut()
                               .WithOptOutReason(OLD_OPT_OUT_REASON_1)
                               .WithOptOutReason(OLD_OPT_OUT_REASON_2)
                               .WithOptOutReason(OLD_OPT_OUT_REASON_3)
                               .WithWatermark()
                               .WithCeremonyLayoutSettings(layoutSettingsToCreate)
                               .Build();

            packageToCreate = PackageBuilder.NewPackageNamed(OLD_PACKAGE_NAME)
                              .DescribedAs(OLD_DESCRIPTION)
                              .WithEmailMessage(OLD_EMAIL_MESSAGE)
                              .ExpiresOn(OLD_EXPIRY_DATE)
                              .WithLanguage(OLD_LANGUAGE)
                              .WithVisibility(OLD_VISIBILITY)
                              .WithNotarized(OLD_NOTARIZED)
                              .WithAutomaticCompletion()
                              .WithSettings(settingsToCreate)
                              .Build();

            packageId = ossClient.CreatePackage(packageToCreate);

            createdPackage        = ossClient.GetPackage(packageId);
            createdSettings       = createdPackage.Settings;
            createdLayoutSettings = createdSettings.CeremonyLayoutSettings;

            layoutSettingsToUpdate = CeremonyLayoutSettingsBuilder.NewCeremonyLayoutSettings()
                                     .WithoutBreadCrumbs()
                                     .WithoutGlobalConfirmButton()
                                     .WithoutGlobalDownloadButton()
                                     .WithoutGlobalNavigation()
                                     .WithoutGlobalSaveAsLayoutButton()
                                     .WithLogoImageLink(NEW_LOGO_IMAGE_LINK)
                                     .WithLogoImageSource(NEW_LOGO_IMAGE_SOURCE)
                                     .WithoutNavigator()
                                     .WithoutProgressBar()
                                     .WithoutSessionBar()
                                     .WithoutTitle()
                                     .Build();

            settingsToUpdate = DocumentPackageSettingsBuilder.NewDocumentPackageSettings()
                               .WithoutCaptureText()
                               .WithDecline()
                               .WithDeclineReason(NEW_DECLINE_REASON_1)
                               .WithDeclineReason(NEW_DECLINE_REASON_2)
                               .WithDeclineReason(NEW_DECLINE_REASON_3)
                               .WithoutDialogOnComplete()
                               .WithoutDocumentToolbarDownloadButton()
                               .WithHandOverLinkHref(NEW_HAND_OVER_LINK_HREF)
                               .WithHandOverLinkText(NEW_HAND_OVER_LINK_TEXT)
                               .WithHandOverLinkTooltip(NEW_HAND_OVER_LINK_TOOL_TIP)
                               .WithoutInPerson()
                               .WithoutOptOut()
                               .WithOptOutReason(NEW_OPT_OUT_REASON_1)
                               .WithOptOutReason(NEW_OPT_OUT_REASON_2)
                               .WithOptOutReason(NEW_OPT_OUT_REASON_3)
                               .WithoutWatermark()
                               .WithCeremonyLayoutSettings(layoutSettingsToUpdate)
                               .Build();

            packageToUpdate = PackageBuilder.NewPackageNamed(NEW_PACKAGE_NAME)
                              .WithEmailMessage(NEW_EMAIL_MESSAGE)
                              .ExpiresOn(NEW_EXPIRY_DATE)
                              .WithLanguage(NEW_LANGUAGE)
                              .WithVisibility(NEW_VISIBILITY)
                              .WithNotarized(NEW_NOTARIZED)
                              .WithoutAutomaticCompletion()
                              .WithSettings(settingsToUpdate)
                              .Build();

            ossClient.UpdatePackage(packageId, packageToUpdate);

            updatedPackage        = ossClient.GetPackage(packageId);
            updatedSettings       = updatedPackage.Settings;
            updatedLayoutSettings = updatedSettings.CeremonyLayoutSettings;
        }
Exemple #14
0
 public PackageBuilder WithSettings(DocumentPackageSettings settings)
 {
     this.settings = settings;
     return(this);
 }
 public PackageBuilder WithSettings (DocumentPackageSettings settings)
 {
     this.settings = settings;
     return this;
 }