Пример #1
0
        /// <summary>
        /// Creates new factory instance.
        /// </summary>
        /// <param name="configFilePath">path to the config directory</param>
        public Factory(string configFilePath)
        {
            ConfigParser config = new ConfigParser(new ConfigurationBuilder()
                                                   .AddJsonFile(configFilePath)
                                                   .Build());
            IAccounts accounts = new AccountsImpl(
                config.HoldAccounts(),
                config.FxAccounts(),
                config.CustomerAccounts());

            BankAccountAuthorizer authorizer = BankAccountAuthorizer.NewBuilder(config.BankId())
                                               .WithSecretKeystore(config.SecretKeyStore())
                                               .WithTrustedKeystore(config.TrustedKeyStore())
                                               .UseKey(config.EncryptionKeyId())
                                               .UseMethod((SealedMessage.MethodOneofCase)Enum.Parse(typeof(SealedMessage.MethodOneofCase), ToTitleCase(config.EncryptionMethod())))
                                               // expiration is set to 1 day by default
                                               .Build();

            this.accounting     = new AccountingImpl(accounts);
            this.accountLinking = new AccountLinkingImpl(
                authorizer,
                config.AccessTokenAuthorizations());
        }