Beispiel #1
0
        private void BuildConnectionString(string connectionStringWithProvider)
        {
            var connectionSettings = DbSettingsService.ParseConnectionSettings(connectionStringWithProvider);
            var inputValuesWrapper = DbSettingsService.MapToValuesWrapper(connectionSettings);

            var dbSettingsForm = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(_context.ExtensionManager,
                                                                                     ExtensionCatalog.DbSettings, inputValuesWrapper.CollectIncomeValues());

            dbSettingsForm.WorkCallback = (step, list) =>
            {
                var valuesWrapper = new DbSettingsFormValuesWrapper(list);
                connectionSettings = DbSettingsService.ExtractConnectionSettings(valuesWrapper);

                var dbSettingsService = new DbSettingsService(_context.UnityContainer);
                dbSettingsService.CheckConnectionSettings(connectionSettings);

                connectionStringWithProvider =
                    DbSettingsService.ToConnectionStringWithProvider(connectionSettings);

                return(new Dictionary <string, object>());
            };

            if (DialogResult.OK == dbSettingsForm.ShowDialog(_form))
            {
                var step2 =
                    new RegistrationFormValuesWrapper.Step2
                {
                    Control5ConnectionString = connectionStringWithProvider
                };

                _form.ApplyValues(step2.CollectIncomeValues());
            }
        }
        public Form GetForm(ContractContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var signatures = context.Contract.Signatures.Select(s =>
            {
                var formattingService = context.UnityContainer.Resolve <IFormattingService>();

                var identifierValue = formattingService.FormatIdentifier(s.AcceptorIdentifier);
                var acceptTimeValue = null == s.AcceptTime
                        ? string.Empty
                        : formattingService.FormatDateTime(s.AcceptTime.Value);
                return(new ListItemContent(new ResultRecord(identifierValue, acceptTimeValue))
                {
                    ImageKey = "Ant"
                });
            })
                             .ToList();

            var valuesWrapper = new ContractDetailsFormValuesWrapper
            {
                Control1Name             = context.Contract.Name,
                Control2Text             = context.Contract.Text,
                Control3HasLimitedAccess = !context.Contract.IsPublic,
                Control4Details          = signatures
            };

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager,
                                                                           ExtensionCatalog.ContractDetails, valuesWrapper.CollectIncomeValues());

            form.ServiceCommand += (sender, args) =>
            {
                if (!"Copy".Equals(args.Command))
                {
                    return;
                }

                var resultRecord = args.Argument as ResultRecord;

                if (null != resultRecord)
                {
                    string text = string.Format(CultureInfo.InvariantCulture, "{0} {1}", resultRecord.Name,
                                                resultRecord.Value);
                    Clipboard.SetText(text, TextDataFormat.UnicodeText);
                }
            };

            return(form);
        }
Beispiel #3
0
        public Form GetForm(SessionContext context, long?identifier)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var incomeValuesWrapper = new SendMessageFormValuesWrapper();

            if (null != identifier)
            {
                var formattingService = context.UnityContainer.Resolve <IFormattingService>();
                incomeValuesWrapper.Control1Identifier = formattingService.FormatIdentifier(identifier.Value);
            }

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager, ExtensionCatalog.SendMessage,
                                                                           incomeValuesWrapper.CollectIncomeValues());

            form.ServiceCommand += (sender, args) =>
            {
                if (!SendMessageFormValuesWrapper.Control1IdentifierCommandFindPassport
                    .Equals(args.Command))
                {
                    return;
                }

                IdentifierDisplayHelper.ShowFindCertificateForm(form, context, (string)args.Argument);
            };

            form.WorkCallback = (step, list) =>
            {
                if (0 != step)
                {
                    throw new InvalidOperationException("0 != step");
                }

                var valuesWrapper = new SendMessageFormValuesWrapper(list);

                var messageService = context.UnityContainer.Resolve <IMessageService>();
                messageService.SendMessage(long.Parse(valuesWrapper.Control1Identifier), valuesWrapper.Control2Subject,
                                           valuesWrapper.Control3Message, false);

                return(new Dictionary <string, object>());
            };

            return(form);
        }
Beispiel #4
0
        public Form GetForm(SessionContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager,
                                                                           ExtensionCatalog.AddIdentifier);

            form.ServiceCommand += (sender, args) =>
            {
                if (!AddIdentifierFormValuesWrapper.Control1WmidCommandFindPassport.Equals(args.Command))
                {
                    return;
                }

                var identifierValue = (string)args.Argument;
                IdentifierDisplayHelper.ShowFindCertificateForm(form, context, identifierValue);
            };

            form.WorkCallback = (step, list) =>
            {
                var valuesWrapper = new AddIdentifierFormValuesWrapper(list);

                var identifier = long.Parse(valuesWrapper.Control1Wmid);
                var alias      = valuesWrapper.Control2Alias;

                var identifierService = context.UnityContainer.Resolve <IIdentifierService>();

                if (identifierService.IsIdentifierExists(identifier))
                {
                    throw new DuplicateIdentifierException(
                              string.Format(CultureInfo.InvariantCulture,
                                            Resources.AddIdentifierFormProvider_GetForm_WMID__0__already_registered_in_the_program,
                                            valuesWrapper.Control1Wmid));
                }

                identifierService.AddSecondaryIdentifier(new IdentifierSummary(identifier, alias));
                context.Session.CurrentIdentifier = identifier;

                return(new Dictionary <string, object>());
            };

            return(form);
        }
Beispiel #5
0
        public Form GetForm(EntranceContext context)
        {
            _context = context ?? throw new ArgumentNullException(nameof(context));

            var certificates = new KeySettingsService(context.UnityContainer).SelectCertificates();

            var step1IncomeValuesWrapper = new RegistrationFormValuesWrapper.Step1
            {
                Control5Certificate = certificates.Select(c => new ListItemContent(c)
                {
                    ImageKey = "Pfx"
                }).ToList()
            };

            _form =
                SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager, ExtensionCatalog.Registration,
                                                                    step1IncomeValuesWrapper.CollectIncomeValues());

            _form.ServiceCommand += (sender, args) =>
            {
                if (args.Command.Equals("BuildConnectionString", StringComparison.OrdinalIgnoreCase))
                {
                    BuildConnectionString((string)args.Argument);
                }
            };

            _form.WorkCallback = (step, list) =>
            {
                switch (step)
                {
                case 0:
                {
                    return(Step1(new RegistrationFormValuesWrapper.Step1(list)).CollectIncomeValues());
                }

                case 1:
                    Step2(new RegistrationFormValuesWrapper.Step2(list));
                    return(new Dictionary <string, object>());

                default:
                    throw new InvalidOperationException("step == " + step);
                }
            };

            return(_form);
        }
Beispiel #6
0
        public Form GetForm(SessionContext context)
        {
            var submitForm = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager,
                                                                                 ExtensionCatalog.CreateContract);

            submitForm.VerificationCallback = (step, list) =>
            {
                var valuesWrapper = new CreateContractFormValuesWrapper(list);

                try
                {
                    if (valuesWrapper.Control3LimitedAccess)
                    {
                        ParseIdentifiers(valuesWrapper.Control4AccessList);
                    }
                }
                catch (FormatException)
                {
                    MessageBox.Show(submitForm, Resources.CreateContractFormProvider_GetForm_List_of_identifiers_is_in_the_wrong_format, Resources.CreateContractFormProvider_GetForm_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                return(true);
            };

            submitForm.WorkCallback = (step, list) =>
            {
                var valuesWrapper = new CreateContractFormValuesWrapper(list);

                List <long> identifiers = new List <long>();

                if (valuesWrapper.Control3LimitedAccess)
                {
                    identifiers = ParseIdentifiers(valuesWrapper.Control4AccessList);
                }

                var contractService = context.UnityContainer.Resolve <IContractService>();

                contractService.CreateContract(valuesWrapper.Control1Name, valuesWrapper.Control2Text, identifiers);

                return(new Dictionary <string, object>());
            };

            return(submitForm);
        }
        public Form GetForm(SessionContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var dbSettingsService = new DbSettingsService(context.UnityContainer);

            var connectionSettings = context.Session.AuthenticationService.GetConnectionSettings();

            DbSettingsFormValuesWrapper incomeValuesWrapper = null;

            if (null != connectionSettings)
            {
                incomeValuesWrapper = DbSettingsService.MapToValuesWrapper(connectionSettings);
            }

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager, ExtensionCatalog.DbSettings,
                                                                           incomeValuesWrapper?.CollectIncomeValues());

            form.Closed += (sender, args) =>
            {
                if (DialogResult.OK == form.DialogResult)
                {
                    EventBroker.OnDatabaseChanged();
                }
            };

            form.WorkCallback = (step, list) =>
            {
                var valuesWrapper = new DbSettingsFormValuesWrapper(list);
                connectionSettings = DbSettingsService.ExtractConnectionSettings(valuesWrapper);

                dbSettingsService.CheckConnectionSettings(connectionSettings);

                context.Session.AuthenticationService.SetConnectionSettings(connectionSettings);

                return(new Dictionary <string, object>());
            };

            return(form);
        }
        public Form GetForm(SessionContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager, ExtensionCatalog.AddPurse);

            form.ServiceCommand += (sender, args) =>
            {
                if (!AddPurseFormValuesWrapper.Control1PurseNumberCommandFindIdentifier.Equals(args.Command))
                {
                    return;
                }

                IdentifierDisplayHelper.ShowFindIdentifierForm(form, context, (string)args.Argument);
            };

            form.WorkCallback = (step, list) =>
            {
                var valuesWrapper = new AddPurseFormValuesWrapper(list);

                var purseService = context.UnityContainer.Resolve <IPurseService>();
                purseService.AddPurse(valuesWrapper.Control1PurseNumber, valuesWrapper.Control2Alias);

                return(new Dictionary <string, object>());
            };

            form.FinalAction = objects =>
            {
                EventBroker.OnPurseChanged(new DataChangedEventArgs {
                    FreshDataRequired = false
                });
                return(true);
            };

            return(form);
        }
        private Form GetForm(object entity)
        {
            var items = new List <ListItemContent>();

            foreach (var propertyInfo in entity.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
            {
                var value = propertyInfo.GetValue(entity, null);

                if (!(value is IFormattable) && !(value is string))
                {
                    continue;
                }

                var name      = Translator.Instance.Translate("Details", propertyInfo.Name);
                var valueText = DisplayContentHelper.GetText(propertyInfo, value);

                items.Add(new ListItemContent(new ResultRecord(name, valueText ?? string.Empty)));
            }

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(_context.ExtensionManager, ExtensionCatalog.Details,
                                                                           new Dictionary <string, object>
            {
                { "Details", items }
            });

            form.ServiceCommand += (sender, args) =>
            {
                if (!"Copy".Equals(args.Command))
                {
                    return;
                }

                Clipboard.SetText(((ResultRecord)args.Argument).Value, TextDataFormat.UnicodeText);
            };

            return(form);
        }
        public Form GetForm(SessionContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var configurationService  = context.UnityContainer.Resolve <IConfigurationService>();
            var installationReference = configurationService.InstallationReference;

            var template =
                TemplateLoader.LoadTemplate <SubmitFormTemplate <WMColumnTemplate> >(context.ExtensionManager,
                                                                                     ExtensionCatalog.SendMessageToDeveloper);

            var templateWrapper = new SendMessageToDeveloperFormTemplateWrapper(template);

            templateWrapper.Control2InstallationReference.DefaultValue = installationReference;

            var submitForm = SubmitFormDisplayHelper.BuildSubmitForm(context.ExtensionManager, template);

            submitForm.WorkCallback = (step, list) =>
            {
                var valuesWrapper = new SendMessageToDeveloperFormValuesWrapper(list);

                var supportService = context.UnityContainer.Resolve <ISupportService>();

                var sender =
                    $"{valuesWrapper.Control1YourName} #{installationReference} WMID#{context.Session.AuthenticationService.MasterIdentifier}";

                supportService.SendMessage("None", sender, valuesWrapper.Control3Message);

                return(new Dictionary <string, object>());
            };

            return(submitForm);
        }
Beispiel #11
0
        public Form GetForm(SessionContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var incomeValuesWrapper = new ProxySettingsFormValuesWrapper();

            var proxySettings = context.Session.AuthenticationService.GeProxySettings();

            string password = null;

            if (null != proxySettings)
            {
                var address = proxySettings.Host;
                var port    = proxySettings.Port;

                if (SharedProxyAddress.Equals(address, StringComparison.OrdinalIgnoreCase) && SharedProxyPort == port &&
                    null == proxySettings.Credential)
                {
                    incomeValuesWrapper.Control1Mode = ProxySettingsFormValuesWrapper.Control1ModeValueShared;
                }
                else
                {
                    incomeValuesWrapper.Control1Mode = ProxySettingsFormValuesWrapper.Control1ModeValueCustom;

                    incomeValuesWrapper.Control2Address = address;
                    incomeValuesWrapper.Control3Port    = port;

                    if (null != proxySettings.Credential)
                    {
                        incomeValuesWrapper.Control4AuthenticationRequired = true;

                        incomeValuesWrapper.Control5Username = proxySettings.Credential.Username;
                        incomeValuesWrapper.Control6Password = PasswordMask;

                        password = proxySettings.Credential.Password;
                    }
                }
            }
            else
            {
                incomeValuesWrapper.Control1Mode = ProxySettingsFormValuesWrapper.Control1ModeValueNone;
            }

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager,
                                                                           ExtensionCatalog.ProxySettings, incomeValuesWrapper.CollectIncomeValues());

            form.WorkCallback = (step, list) =>
            {
                var valuesWrapper = new ProxySettingsFormValuesWrapper(list);

                switch (valuesWrapper.Control1Mode)
                {
                case ProxySettingsFormValuesWrapper.Control1ModeValueNone:
                    context.Session.AuthenticationService.SetProxySettings(null);
                    break;

                case ProxySettingsFormValuesWrapper.Control1ModeValueShared:
                    context.Session.AuthenticationService.SetProxySettings(new ProxySettings(SharedProxyAddress,
                                                                                             SharedProxyPort));
                    break;

                case ProxySettingsFormValuesWrapper.Control1ModeValueCustom:

                    proxySettings = new ProxySettings(valuesWrapper.Control2Address, valuesWrapper.Control3Port);

                    if (valuesWrapper.Control4AuthenticationRequired)
                    {
                        var newPassword =
                            PasswordMask.Equals(valuesWrapper.Control6Password, StringComparison.Ordinal)
                                    ? password
                                    : valuesWrapper.Control6Password;

                        proxySettings.Credential = new ProxyCredential(valuesWrapper.Control5Username, newPassword);
                    }

                    context.Session.AuthenticationService.SetProxySettings(proxySettings);

                    break;
                }

                return(new Dictionary <string, object>());
            };

            return(form);
        }
        private Form GetForm(SessionContext context, string purseNumber)
        {
            var incomeValuesWrapper = new FindIdentifierFormValuesWrapper.Step1();

            if (!string.IsNullOrEmpty(purseNumber))
            {
                incomeValuesWrapper.Control1Purse = purseNumber;
            }

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager,
                                                                           ExtensionCatalog.FindIdentifier, incomeValuesWrapper.CollectIncomeValues());

            form.ServiceCommand += (sender, args) =>
            {
                if (!FindIdentifierFormValuesWrapper.Step2.Control1WmIdCommandFindPassport.Equals(args.Command))
                {
                    return;
                }

                var identifierValue = (string)args.Argument;
                IdentifierDisplayHelper.ShowFindCertificateForm(form, context, identifierValue);
            };

            form.WorkCallback = (step, list) =>
            {
                switch (step)
                {
                case 0:

                    var step1Wrapper = new FindIdentifierFormValuesWrapper.Step1(list);

                    var identifierService = context.UnityContainer.Resolve <IIdentifierService>();

                    var identifier = identifierService.FindIdentifier(step1Wrapper.Control1Purse);

                    if (null == identifier)
                    {
                        throw new PurseNotFoundException(string.Format(CultureInfo.InvariantCulture,
                                                                       Resources.FindIdentifierFormProvider_GetForm_Purse__0__not_found_,
                                                                       step1Wrapper.Control1Purse));
                    }

                    var formattingService = context.UnityContainer.Resolve <IFormattingService>();

                    var step2Wrapper = new FindIdentifierFormValuesWrapper.Step2(list)
                    {
                        Control1WmId = formattingService.FormatIdentifier(identifier.Value)
                    };
                    return(step2Wrapper.CollectIncomeValues());

                case 1:
                    return(new Dictionary <string, object>());

                default:
                    throw new InvalidOperationException("step == " + step);
                }
            };

            if (!string.IsNullOrEmpty(purseNumber))
            {
                form.Load += (sender, args) =>
                {
                    form.Submit();
                }
            }
            ;

            return(form);
        }
    }
        public Form GetForm(SessionContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var extensionConfiguration = context.ExtensionManager.TryObtainExtensionConfiguration(ExtensionCatalog.KeySettings);

            if (null == extensionConfiguration)
            {
                throw new InvalidOperationException("null == extensionConfiguration");
            }

            if (string.IsNullOrEmpty(extensionConfiguration.ConfigurationString))
            {
                throw new BadTemplateException("ConfigurationString is null or empty!");
            }

            string templateFileName;
            var    authenticationMethod = context.Session.AuthenticationService.AuthenticationMethod;

            Dictionary <string, object> initValues = null;

            switch (authenticationMethod)
            {
            case AuthenticationMethod.KeeperClassic:
                templateFileName = ClassicKeySettingsFormTemplateName;
                break;

            case AuthenticationMethod.KeeperLight:
            {
                templateFileName = LightKeySettingsFormTemplateName;
                var certificates  = new KeySettingsService(context.UnityContainer).SelectCertificates();
                var valuesWrapper = new LightKeySettingsFormValuesWrapper
                {
                    Control1Certificate = certificates
                                          .Where(c => c.Identifier == context.Session.AuthenticationService.MasterIdentifier)
                                          .Select(c => new ListItemContent(c)
                        {
                            ImageKey = "Pfx"
                        })
                                          .ToList()
                };

                initValues = valuesWrapper.CollectIncomeValues();
            }
            break;

            default:
                throw new InvalidOperationException("authenticationMethod == " + authenticationMethod);
            }

            var pathTemplate = Path.Combine(extensionConfiguration.BaseDirectory,
                                            extensionConfiguration.ConfigurationString);

            var templatePath = string.Format(CultureInfo.InvariantCulture, pathTemplate, templateFileName);

            var from = SubmitFormDisplayHelper.LoadSubmitFormByTemplatePath(context.ExtensionManager, templatePath, initValues);

            from.WorkCallback = (step, list) =>
            {
                if (0 != step)
                {
                    throw new InvalidOperationException("0 != step");
                }

                switch (authenticationMethod)
                {
                case AuthenticationMethod.KeeperClassic:
                {
                    var valuesWrapper = new ClassicKeySettingsFormValuesWrapper(list);

                    var entranceService = context.UnityContainer.Resolve <IEntranceService>();
                    var keeperKey       =
                        entranceService.DecryptKeeperKey(
                            File.ReadAllBytes(valuesWrapper.Control1PathToKeysBackupFile),
                            context.Session.AuthenticationService.MasterIdentifier,
                            valuesWrapper.Control2PasswordToBackupFile);

                    context.Session.AuthenticationService.SetKeeperKey(keeperKey);
                }
                break;

                case AuthenticationMethod.KeeperLight:
                {
                    var valuesWrapper    = new LightKeySettingsFormValuesWrapper(list);
                    var lightCertificate = (ILightCertificate)valuesWrapper.Control1Certificate;

                    context.Session.AuthenticationService.SetCertificate(lightCertificate.Thumbprint);
                }
                break;

                default:
                    throw new InvalidOperationException("authenticationMethod == " + authenticationMethod);
                }

                return(new Dictionary <string, object>());
            };

            return(from);
        }
        private Form GetForm(SessionContext context, string identifierValue, bool offline)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var incomeValuesWrapper = new FindCertificateFormValuesWrapper();

            if (!string.IsNullOrEmpty(identifierValue))
            {
                incomeValuesWrapper.Control1Identifier = identifierValue;
            }

            incomeValuesWrapper.Control5OfflineSearch = offline;

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager,
                                                                           ExtensionCatalog.FindCertificate,
                                                                           incomeValuesWrapper.CollectIncomeValues());

            form.FinalAction = values =>
            {
                var certificate = (ICertificate)values["Certificate"];

                var certificateFormProvider =
                    context.ExtensionManager.TryGetCertificateFormProvider(ExtensionCatalog.Certificate);

                if (null == certificateFormProvider)
                {
                    return(true);
                }

                var certificateForm = certificateFormProvider.GetForm(new CertificateContext(context, certificate));

                bool closed = false;

                certificateForm.FormClosed += (sender, args) =>
                {
                    if (closed)
                    {
                        return;
                    }

                    closed = true;

                    if (DialogResult.OK != certificateForm.DialogResult)
                    {
                        form.Close();
                    }
                };

                certificateForm.Show(form);

                return(false);
            };

            form.WorkCallback = (step, list) =>
            {
                var valuesWrapper     = new FindCertificateFormValuesWrapper(list);
                var identifierService = context.UnityContainer.Resolve <IIdentifierService>();

                var certificate = identifierService.FindCertificate(long.Parse(valuesWrapper.Control1Identifier),
                                                                    valuesWrapper.Control2GetBlAndTl, valuesWrapper.Control4CheckComplaintsAndComments,
                                                                    valuesWrapper.Control3GetBlAndTlForAttachedWmids, !valuesWrapper.Control5OfflineSearch);

                return(new Dictionary <string, object>
                {
                    { "Certificate", certificate }
                });
            };

            if (!string.IsNullOrEmpty(identifierValue))
            {
                form.Load += (sender, args) =>
                {
                    form.Submit();
                }
            }
            ;

            return(form);
        }
    }
Beispiel #15
0
        public Form GetForm(PurseContext context)
        {
            if (null == context)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var incomeValuesWrapper = new SetMerchantKeyFormValuesWrapper();

            if (context.Account.HasMerchantKey)
            {
                incomeValuesWrapper.Control1HasSecretKey = true;
                incomeValuesWrapper.Control2SecretKey    = KeyMask;
            }

            if (context.Account.HasSecretKeyX20)
            {
                incomeValuesWrapper.Control3HasSecretKeyX20 = true;
                incomeValuesWrapper.Control4SecretKeyX20    = KeyMask;
            }

            var form = SubmitFormDisplayHelper.LoadSubmitFormByExtensionId(context.ExtensionManager,
                                                                           ExtensionCatalog.SetMerchantKey, incomeValuesWrapper.CollectIncomeValues());

            form.WorkCallback = (step, list) =>
            {
                var valuesWrapper = new SetMerchantKeyFormValuesWrapper(list);

                var purseService = context.UnityContainer.Resolve <IPurseService>();

                if (valuesWrapper.Control1HasSecretKey)
                {
                    if (!KeyMask.Equals(valuesWrapper.Control2SecretKey, StringComparison.Ordinal))
                    {
                        purseService.SetMerchantKey(context.Account.Number, valuesWrapper.Control2SecretKey);
                    }
                }
                else
                {
                    purseService.ClearMerchantKey(context.Account.Number);
                }

                if (valuesWrapper.Control3HasSecretKeyX20)
                {
                    if (!KeyMask.Equals(valuesWrapper.Control4SecretKeyX20, StringComparison.Ordinal))
                    {
                        purseService.SetSecretKeyX20(context.Account.Number, valuesWrapper.Control4SecretKeyX20);
                    }
                }
                else
                {
                    purseService.ClearSecretKeyX20(context.Account.Number);
                }

                return(new Dictionary <string, object>());
            };

            form.FinalAction = objects =>
            {
                EventBroker.OnPurseChanged(new DataChangedEventArgs {
                    FreshDataRequired = false
                });
                return(true);
            };

            return(form);
        }