public void ConvertSDKToAPI() { sdkPackageSettings1 = CreateTypicalSDKDocumentPackageSettings(); apiPackageSettings1 = new DocumentPackageSettingsConverter(sdkPackageSettings1).toAPIPackageSettings(); Assert.IsNotNull(apiPackageSettings1); Assert.AreEqual(apiPackageSettings1.Ceremony.InPerson, sdkPackageSettings1.EnableInPerson); Assert.AreEqual(apiPackageSettings1.Ceremony.Ada, sdkPackageSettings1.Ada); Assert.AreEqual(apiPackageSettings1.Ceremony.DeclineButton, sdkPackageSettings1.EnableDecline); Assert.AreEqual(apiPackageSettings1.Ceremony.OptOutButton, sdkPackageSettings1.EnableOptOut); Assert.AreEqual(apiPackageSettings1.Ceremony.DeclineReasons[0], sdkPackageSettings1.DeclineReasons[0]); Assert.AreEqual(apiPackageSettings1.Ceremony.DeclineReasons[1], sdkPackageSettings1.DeclineReasons[1]); Assert.AreEqual(apiPackageSettings1.Ceremony.DeclineReasons[2], sdkPackageSettings1.DeclineReasons[2]); Assert.AreEqual(apiPackageSettings1.Ceremony.DisableDeclineOther, sdkPackageSettings1.DisableDeclineOther); Assert.AreEqual(apiPackageSettings1.Ceremony.OptOutReasons[0], sdkPackageSettings1.OptOutReasons[0]); Assert.AreEqual(apiPackageSettings1.Ceremony.OptOutReasons[1], sdkPackageSettings1.OptOutReasons[1]); Assert.AreEqual(apiPackageSettings1.Ceremony.OptOutReasons[2], sdkPackageSettings1.OptOutReasons[2]); Assert.AreEqual(apiPackageSettings1.Ceremony.DisableOptOutOther, sdkPackageSettings1.DisableOptOutOther); Assert.AreEqual(apiPackageSettings1.Ceremony.HandOver.Href, sdkPackageSettings1.LinkHref); Assert.AreEqual(apiPackageSettings1.Ceremony.HandOver.Text, sdkPackageSettings1.LinkText); Assert.AreEqual(apiPackageSettings1.Ceremony.HandOver.Title, sdkPackageSettings1.LinkTooltip); Assert.AreEqual(apiPackageSettings1.Ceremony.HideCaptureText, sdkPackageSettings1.HideCaptureText); Assert.AreEqual(apiPackageSettings1.Ceremony.HideWatermark, sdkPackageSettings1.HideWatermark); Assert.AreEqual(apiPackageSettings1.Ceremony.MaxAuthFailsAllowed, sdkPackageSettings1.MaxAuthAttempts); Assert.AreEqual(apiPackageSettings1.Ceremony.Layout.Header.GlobalActions.Download, sdkPackageSettings1.CeremonyLayoutSettings.ShowGlobalDownloadButton); Assert.AreEqual(apiPackageSettings1.Ceremony.Layout.Header.GlobalActions.Confirm, sdkPackageSettings1.CeremonyLayoutSettings.ShowGlobalConfirmButton); Assert.AreEqual(apiPackageSettings1.Ceremony.Layout.Header.GlobalActions.SaveAsLayout, sdkPackageSettings1.CeremonyLayoutSettings.ShowGlobalSaveAsLayoutButton); Assert.AreEqual(apiPackageSettings1.Ceremony.HideLanguageDropdown, !sdkPackageSettings1.ShowLanguageDropDown); Assert.AreEqual(apiPackageSettings1.Ceremony.HidePackageOwnerInPerson, !sdkPackageSettings1.ShowOwnerInPersonDropDown); Assert.AreEqual(apiPackageSettings1.Ceremony.DisableFirstInPersonAffidavit, !sdkPackageSettings1.EnableFirstAffidavit); Assert.AreEqual(apiPackageSettings1.Ceremony.DisableSecondInPersonAffidavit, !sdkPackageSettings1.EnableSecondAffidavit); }
public void ConvertAPIToAPI() { apiPackageSettings1 = CreateTypicalAPIPackageSettings(); converter = new DocumentPackageSettingsConverter(apiPackageSettings1); apiPackageSettings2 = converter.toAPIPackageSettings(); Assert.IsNotNull(apiPackageSettings2); Assert.AreEqual(apiPackageSettings2, apiPackageSettings1); }
public PackageSettings toAPIPackageSettings() { if ( apiSettings != null ) return apiSettings; PackageSettings result = new PackageSettings(); return result; }
internal DocumentPackageSettingsBuilder( PackageSettings apiPackageSettings ) { enableInPerson = apiPackageSettings.Ceremony.InPerson; enableOptOut = apiPackageSettings.Ceremony.OptOutButton; enableDecline = apiPackageSettings.Ceremony.DeclineButton; hideWatermark = apiPackageSettings.Ceremony.HideWatermark; hideCaptureText = apiPackageSettings.Ceremony.HideCaptureText; enableFirstAffidavit = !apiPackageSettings.Ceremony.DisableFirstInPersonAffidavit; enableSecondAffidavit = !apiPackageSettings.Ceremony.DisableSecondInPersonAffidavit; showOwnerInPersonDropDown = !apiPackageSettings.Ceremony.HidePackageOwnerInPerson; showLanguageDropDown = !apiPackageSettings.Ceremony.HideLanguageDropdown; foreach (string reason in apiPackageSettings.Ceremony.OptOutReasons) { optOutReasons.Add(reason); } maxAuthAttempts = apiPackageSettings.Ceremony.MaxAuthFailsAllowed; if (apiPackageSettings.Ceremony.DocumentToolbarOptions != null) { showDocumentToolbarDownloadButton = apiPackageSettings.Ceremony.DocumentToolbarOptions.DownloadButton; } if (apiPackageSettings.Ceremony.Events != null && apiPackageSettings.Ceremony.Events.Complete != null) { showDialogOnComplete = apiPackageSettings.Ceremony.Events.Complete.Dialog; } if (apiPackageSettings.Ceremony.HandOver != null) { linkHref = apiPackageSettings.Ceremony.HandOver.Href; linkText = apiPackageSettings.Ceremony.HandOver.Text; linkTooltip = apiPackageSettings.Ceremony.HandOver.Title; } }
public void ConvertNullAPIToAPI() { apiPackageSettings1 = null; converter = new DocumentPackageSettingsConverter(apiPackageSettings1); Assert.IsNull(converter.toAPIPackageSettings()); }
private Silanis.ESL.API.PackageSettings CreateTypicalAPIPackageSettings() { Silanis.ESL.API.CeremonySettings apiCeremonySettings = new Silanis.ESL.API.CeremonySettings(); apiCeremonySettings.InPerson = false; apiCeremonySettings.Ada = true; apiCeremonySettings.DeclineButton = true; apiCeremonySettings.OptOutButton = true; apiCeremonySettings.AddDeclineReason("Decline reason one"); apiCeremonySettings.AddDeclineReason("Decline reason two"); apiCeremonySettings.AddDeclineReason("Decline reason three"); apiCeremonySettings.AddOptOutReason("Opt out reason one"); apiCeremonySettings.AddOptOutReason("Opt out reason two"); apiCeremonySettings.AddOptOutReason("Opt out reason three"); Silanis.ESL.API.Link link = new Silanis.ESL.API.Link(); link.Href = "http://www.google.ca"; link.Text = "click here"; apiCeremonySettings.HandOver = link; apiCeremonySettings.HideCaptureText = true; apiCeremonySettings.HideWatermark = true; apiCeremonySettings.MaxAuthFailsAllowed = 3; apiCeremonySettings.DisableFirstInPersonAffidavit = true; apiCeremonySettings.DisableSecondInPersonAffidavit = true; apiCeremonySettings.HideLanguageDropdown = true; apiCeremonySettings.HidePackageOwnerInPerson = true; Style style = new Style(); style.BackgroundColor = "white"; style.Color = "blue"; LayoutStyle layoutStyle = new LayoutStyle(); layoutStyle.Dialog = style; apiCeremonySettings.Style = layoutStyle; LayoutOptions layoutOptions = new LayoutOptions(); layoutOptions.Iframe = false; apiCeremonySettings.Layout = layoutOptions; HeaderOptions headerOptions = new HeaderOptions(); headerOptions.Breadcrumbs = true; headerOptions.Feedback = true; GlobalActionsOptions globalActionsOptions = new GlobalActionsOptions(); globalActionsOptions.Confirm = true; globalActionsOptions.Download = true; globalActionsOptions.SaveAsLayout = true; headerOptions.GlobalActions = globalActionsOptions; layoutOptions.Header = headerOptions; Silanis.ESL.API.PackageSettings apiPackageSettings = new Silanis.ESL.API.PackageSettings(); apiPackageSettings.Ceremony = apiCeremonySettings; return(apiPackageSettings); }
public DocumentPackageSettingsConverter(PackageSettings settings) { apiSettings = settings; }
internal PackageSettings toAPIPackageSettings() { CeremonySettings ceremonySettings = new CeremonySettings(); if ( enableInPerson != null ) ceremonySettings.InPerson = enableInPerson.Value; if ( enableOptOut != null ) ceremonySettings.OptOutButton = enableOptOut.Value; if ( enableDecline != null ) ceremonySettings.DeclineButton = enableDecline.Value; if ( hideWatermark != null ) ceremonySettings.HideWatermark = hideWatermark.Value; if ( hideCaptureText != null ) ceremonySettings.HideCaptureText = hideCaptureText.Value; foreach ( string reason in optOutReasons ) ceremonySettings.OptOutReasons.Add( reason ); if ( maxAuthAttempts != null ) ceremonySettings.MaxAuthFailsAllowed = maxAuthAttempts.Value; if ( linkHref != null ) { Link link = new Link(); link.Href = linkHref; link.Text = ( linkText == null ? linkHref : linkText ); link.Title = ( linkTooltip == null ? linkHref : linkTooltip ); ceremonySettings.HandOver = link; } if ( showDialogOnComplete != null ) { CeremonyEvents ceremonyEvents = new CeremonyEvents(); CeremonyEventComplete ceremonyEventComplete = new CeremonyEventComplete(); if ( showDialogOnComplete != null ) ceremonyEventComplete.Dialog = showDialogOnComplete.Value; ceremonyEvents.Complete = ceremonyEventComplete; ceremonySettings.Events = ceremonyEvents; } if ( showDownloadButton != null ) { DocumentToolbarOptions documentToolbarOptions = new DocumentToolbarOptions(); if ( showDownloadButton != null ) documentToolbarOptions.DownloadButton = showDownloadButton.Value; ceremonySettings.DocumentToolbarOptions = documentToolbarOptions; } if ( ceremonyLayoutSettings != null ) { ceremonySettings.Layout = ceremonyLayoutSettings.toAPILayoutOptions(); } PackageSettings result = new PackageSettings(); result.Ceremony = ceremonySettings; return result; }