public static void CheckHomePath() { EnvironmentConfiguration.SetEnvironmentVariables(); if (IsFixHome()) { using var frm = new FormFixHome(); frm.ShowIfUserWant(); } }
internal Connection(RabbitMQ.Client.IConnection connection, IEnumerable <ConsumerBase> consumers, IOutboundChannel outboundChannel, EnvironmentConfiguration configuration) { _connection = connection; _consumers = consumers; _outboundChannel = outboundChannel; Configuration = configuration; }
public static IApplicationBuilder AddRequestLogging(this IApplicationBuilder app, EnvironmentConfiguration environmentConfiguration) { if (environmentConfiguration.UseVerboseLogging) { return(app.UseMiddleware <VerboseLoggingMiddleware>()); } return(app); }
public bool Initialize(StorageConfiguration configuration) { if (configuration.StorageProvider.LMDBProvider == null) { throw new ConfigurationException("LMDBPersistenceProvider configuration not found."); } _configuration = configuration; _configuration.StorageProvider.LMDBProvider.MaxCollections += 1; //for internalmetadacollection if (string.IsNullOrEmpty(configuration.StorageProvider.DatabaseId)) { throw new ArgumentException("Database name can not be empty or null."); } if (string.IsNullOrEmpty(configuration.StorageProvider.DatabasePath)) { throw new ArgumentException("Database path can not be empty or null."); } if (!Directory.Exists(configuration.StorageProvider.DatabasePath)) { Directory.CreateDirectory(configuration.StorageProvider.DatabasePath); } if (_environment == null || !_environment.IsOpened) { if (LoggerManager.Instance.StorageLogger != null && LoggerManager.Instance.StorageLogger.IsInfoEnabled) { LoggerManager.Instance.StorageLogger.Info("LMDB.Initialize", "Initializing LMDB Lightning Environment. " + GetFileInfo()); } EnvironmentConfiguration envConf = new EnvironmentConfiguration(); envConf.AutoReduceMapSizeIn32BitProcess = true; envConf.MapSize = _configuration.StorageProvider.MaxFileSize; envConf.MaxDatabases = _configuration.StorageProvider.LMDBProvider.MaxCollections; envConf.MaxReaders = _configuration.StorageProvider.LMDBProvider.MaxReaders; _environment = new LightningEnvironment(configuration.StorageProvider.DatabasePath + configuration.StorageProvider.DatabaseId + LMDBConfiguration.EXTENSION, envConf); //RegisterConverterFromBytes(new StringArrayConverter()); //RegisterCoverterToBytes(new StringArrayConverter()); EnvironmentOpenFlags convertedFlags; if (!Enum.TryParse(_configuration.StorageProvider.LMDBProvider.EnvironmentOpenFlags.ToString(), out convertedFlags)) { throw new Exception("LMDB.Initialize. Environment Flags conversion failure." + GetFileInfo()); } _environment.Open(convertedFlags); } GetPreviouslyStoredFileSize(); //Major Bug Fix - transaction already commited exception. StoreFileSize(); InitializePerviouslyStoredCollections(); StoreCollectionInfo(null); return(true); }
private static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // Definindo a data de ínicio da consulta DateTime initialDate = new DateTime(2015, 10, 05, 00, 00, 0); // Definindo a data de término da consulta DateTime finalDate = DateTime.Now; // Definindo o número máximo de resultados por página int maxPageResults = 100; // Definindo o número da página int pageNumber = 1; try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); // Realizando a consulta TransactionSearchResult result = TransactionSearchService.SearchByDate( credentials, initialDate, finalDate, pageNumber, maxPageResults); if (result.Transactions.Count <= 0) { Console.WriteLine("Nenhuma transação"); } foreach (TransactionSummary transaction in result.Transactions) { Console.WriteLine("Começando listagem de transações - \n"); Console.WriteLine(transaction.ToString()); Console.WriteLine(" - Terminando listagem de transações "); } Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } }
protected void Page_Load(object sender, EventArgs e) { // envia email para gestores avisando sobre nova entrega EnviarEmail(); //dados da solicitação string chkvalorstr = Request.QueryString["v1"]; decimal chkvalor = Convert.ToDecimal(chkvalorstr); Session["OSId"] = Request.QueryString["v2"]; bool isSandbox = true; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // Instantiate a new payment request PaymentRequest payment = new PaymentRequest(); // Sets the currency payment.Currency = Currency.Brl; // Add an item for this payment request payment.Items.Add(new Item("0001", "Servico de Motoboy", 1, chkvalor)); // Sets a reference code for this payment request, it is useful to identify this payment in future notifications. payment.Reference = "Cli_" + Session["UserID"].ToString(); payment.AddParameter("shippingAddressRequired", "false"); // Sets the url used by PagSeguro for redirect user after ends checkout process payment.RedirectUri = new Uri("http://logvai01.azurewebsites.net/RedirectRetorno.aspx"); // Add and remove groups and payment methods List <string> accept = new List <string>(); accept.Add(ListPaymentMethodNames.DebitoItau); payment.AcceptPaymentMethodConfig(ListPaymentMethodGroups.CreditCard, accept); try { //faz requisição de check-out e aguarda retorno com link para pagamento AccountCredentials credentials = new AccountCredentials("*****@*****.**", "C1BF7C4BE89A481A8C215B3275F41973"); Uri paymentRedirectUri = payment.Register(credentials); string urlpagam = paymentRedirectUri.ToString(); //encaminha usuário para pagina de pagamento (ambiente pagseguro) Response.Write("<script>self.parent.location.href='" + urlpagam + "';</script>"); } catch (PagSeguroServiceException exception) { Response.Write("<script>alert('Tente Novamente! Motivo: " + exception.Message + "');</script>"); } }
internal ReliableOutboundChannel(IModel model, EnvironmentConfiguration configuration, IDateTimeProvider dateTimeProvider, NotConfirmedMessageHandler notConfirmedMessageHandler) : base(model, configuration, dateTimeProvider) { _notConfirmedMessageHandler = notConfirmedMessageHandler; model.ConfirmSelect(); // TODO: not here! it issues a RPC call. Model.BasicAcks += OnModelBasicAcks; Model.BasicNacks += OnModelBasicNacks; }
public PessoaAssinatura ConsultaAssintura(string reference) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); var myTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); DateTime initialDate = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow.AddMonths(-12), myTimeZone); DateTime finalDate = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, myTimeZone); int maxPageResults = 10; int pageNumber = 1; AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); try { PreApprovalSearchResult result = PreApprovalSearchService.SearchByReference( credentials, reference, initialDate, finalDate, pageNumber, maxPageResults ); var pessoa = new PessoaAssinatura(); var resultAtive = result.PreApprovals.Where(m => m.Status == "ACTIVE").FirstOrDefault(); if (resultAtive != null) { pessoa.Codigo = 0; pessoa.CodigoPessoa = 0; pessoa.CodigoAssinatura = resultAtive.Code; pessoa.Status = resultAtive.Status; pessoa.DataAssinatura = resultAtive.Date; return(pessoa); } else { var resultNoAtive = result.PreApprovals.OrderByDescending(d => d.Date).FirstOrDefault(); pessoa.Codigo = 0; pessoa.CodigoPessoa = 0; pessoa.CodigoAssinatura = resultNoAtive.Code; pessoa.Status = resultNoAtive.Status; pessoa.DataAssinatura = resultNoAtive.Date; return(pessoa); } } catch (Exception) { return(null); } }
public void EnvironmentCreatedFromConfig() { var mapExpected = 1024*1024*20; var maxDatabaseExpected = 2; var maxReadersExpected = 3; var config = new EnvironmentConfiguration {MapSize = mapExpected, MaxDatabases = maxDatabaseExpected, MaxReaders = maxReadersExpected}; _env = new LightningEnvironment(_path, config); Assert.Equal(_env.MapSize, mapExpected); Assert.Equal(_env.MaxDatabases, maxDatabaseExpected); Assert.Equal(_env.MaxReaders, maxReadersExpected); }
public static IWebDriver GetWebDriverInstance() { if (driver == null) { driver = WebDriverFactory.initWebDriverInstance(EnvironmentConfiguration.GetBrowserTypeFromConfig()).InitWebriverInstance(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(Convert.ToInt32(EnvironmentConfiguration.GetProjectConfig(CommonConstants.TIMEOUT_SECONDS))); driver.Manage().Timeouts().PageLoad = TimeSpan.FromMinutes(5); driver.Manage().Window.Maximize(); } return(driver); }
public static IApplicationBuilder AddExceptionHandling( this IApplicationBuilder app, EnvironmentConfiguration environmentConfiguration) { if (environmentConfiguration.UseVerboseExceptions) { return(app.UseDeveloperExceptionPage()); } return(app.UseExceptionHandler(ErrorRouteConstants.ErrorRoute)); }
internal static void RunPowerShell(string command, string?argument, string workingDir, bool runInBackground) { const string filename = "powershell.exe"; var arguments = (runInBackground ? "" : "-NoExit") + " -ExecutionPolicy Unrestricted -Command \"" + command + " " + argument + "\""; EnvironmentConfiguration.SetEnvironmentVariables(); IExecutable executable = new Executable(filename, workingDir); executable.Start(arguments, createWindow: !runInBackground); }
public AgentPreStartModule(IServiceProvider provider, EnvironmentConfiguration environmentConfiguration) { if (environmentConfiguration.HttpEnabled) { _seq = provider.GetRequiredService <SeqArgs>(); _provider = provider; _serverConfiguration = provider.GetRequiredService <ServerEnvironmentTestConfiguration>(); _testConfiguration = provider.GetRequiredService <TestConfiguration>(); _holder = provider.GetRequiredService <ConfigurationInstanceHolder>(); } }
public static ConfigFileSettings CreateGlobal(ConfigFileSettings lowerPriority, bool allowCache = true) { string configPath = Path.Combine(EnvironmentConfiguration.GetHomeDir(), ".config", "git", "config"); if (!File.Exists(configPath)) { configPath = Path.Combine(EnvironmentConfiguration.GetHomeDir(), ".gitconfig"); } return(new ConfigFileSettings(lowerPriority, ConfigFileSettingsCache.Create(configPath, false, allowCache))); }
public QPSecurityChecker(IUnitOfWork uow, IHttpContextAccessor httpContextAccessor, IWebAppQpHelper webAppQpHelper, IOptions <EnvironmentConfiguration> options, ILogger <QPSecurityChecker> logger) { _httpContext = httpContextAccessor.HttpContext; _webAppQpHelper = webAppQpHelper; _configuration = options.Value; _logger = logger; _uow = uow; }
public bool EmissorBoleto(PessoaTomador pessoaTomador) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); BoletoCheckout checkout = new BoletoCheckout(); checkout.PaymentMode = PaymentMode.DEFAULT; checkout.ReceiverEmail = "*****@*****.**"; checkout.Currency = Currency.Brl; checkout.Items.Add(new Item("0001", "Contabilidade Online", 1, 69.90m)); checkout.Reference = pessoaTomador.Documento; checkout.Shipping = new Shipping(); checkout.Shipping.ShippingType = ShippingType.Sedex; checkout.Shipping.Cost = 0.00m; checkout.Shipping.Address = new Address( "BRA", "SP", "Sao Paulo", "Jardim Paulistano", "01452002", "Av. Brig. Faria Lima", "1384", "5o andar" ); checkout.Sender = new Sender( pessoaTomador.Nome, pessoaTomador.Email, new Phone("11", pessoaTomador.Telefone) ); checkout.Sender.Hash = pessoaTomador.CodigoHash; SenderDocument senderCPF = new SenderDocument(Documents.GetDocumentByType("CPF"), "27952666878"); checkout.Sender.Documents.Add(senderCPF); checkout.NotificationURL = "http://www.lojamodelo.com.br"; try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); Transaction result = TransactionService.CreateCheckout(credentials, checkout); return(true); } catch (PagSeguroServiceException exception) { return(false); } }
static void Main(string[] args) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); // TODO: Substitute the code below with a valid preApproval reference for your transaction String reference = "REF1234"; DateTime initialDate = new DateTime(2015, 10, 01, 00, 00, 0); DateTime finalDate = DateTime.Now; //DateTime finalDate = new DateTime(2015, 10, 15, 11, 35, 15); int maxPageResults = 10; int pageNumber = 1; try { AccountCredentials credentials = PagSeguroConfiguration.GetAccountCredentials(isSandbox); PreApprovalSearchResult result = PreApprovalSearchService.SearchByReference( credentials, reference, initialDate, finalDate, pageNumber, maxPageResults ); if (result.PreApprovals.Count <= 0) { Console.WriteLine("Nenhuma assinatura"); } foreach (PreApprovalSummary preApproval in result.PreApprovals) { Console.WriteLine("Começando listagem de assinaturas - \n"); Console.WriteLine(preApproval.ToString()); Console.WriteLine(" - Terminando listagem de assinaturas "); } Console.ReadKey(); } catch (PagSeguroServiceException exception) { Console.WriteLine(exception.Message + "\n"); foreach (ServiceError element in exception.Errors) { Console.WriteLine(element + "\n"); } Console.ReadKey(); } }
public LmdbIndex(string path) { var config = new EnvironmentConfiguration { MaxDatabases = DefaultMaxDatabases, MaxReaders = DefaultMaxReaders, MapSize = DefaultMapSize }; _env = new LightningEnvironment(path, config); _env.Open(); CreateDatabaseIfNotExists(_env); }
public override void FixtureSetup() { DefaultTestRunParameters.Get(); DefaultTestRunParameters.Set(nameof(Constants.RS_LocalExecution), "true"); DefaultTestRunParameters.Set(nameof(Constants.RS_LocalExecutionAsService), "true"); DefaultTestRunParameters.Set(nameof(Constants.RS_AppType), "web"); DefaultTestRunParameters.Set(nameof(Constants.RS_PlatformVersion), "8.1"); DefaultTestRunParameters.Set(nameof(Constants.RS_PlatformName), "Android"); DefaultTestRunParameters.Set("DeviceGroup", "Android;Phone;8_1;<yourDeviceId>;chrome"); base.FixtureSetup(); TestEnvironmentParameters = new EnvironmentConfiguration().Get(); }
protected LightningDataStore(string path) { var config = new EnvironmentConfiguration { MaxDatabases = DefaultMaxDatabases, MaxReaders = DefaultMaxReaders, MapSize = DefaultMapSize }; Env = new LightningEnvironment(path, config); Env.Open(); CreateIfNotExists(Env); }
private static void WriteDevice(EnvironmentConfiguration environment, LiveDevice device) { FileInfo file = GetDeviceFile(environment); if (!file.Directory.Exists) { file.Directory.Create(); } using (FileStream stream = file.Open(FileMode.CreateNew, FileAccess.Write, FileShare.None)) { Serialize(stream, device); } }
public void MaxDatabasesWorksThroughConfigIssue62() { var config = new EnvironmentConfiguration { MaxDatabases = 2 }; _env = new LightningEnvironment(_path, config); _env.Open(); using (var tx = _env.BeginTransaction()) { tx.OpenDatabase("db1", new DatabaseConfiguration {Flags = DatabaseOpenFlags.Create}); tx.OpenDatabase("db2", new DatabaseConfiguration {Flags = DatabaseOpenFlags.Create}); tx.Commit(); } Assert.Equal(_env.MaxDatabases, 2); }
public RabbitConsumePersistenceService( EnvironmentConfiguration environmentConfiguration, IRabbitMqConnectionFactory rabbitMqConnectionFactory, IRabbitMqConfiguration rabbitMqConfiguration, IEventJsonSerializer eventJsonSerializer, IDispatchToEventSubscribers dispatchToEventSubscribers) { _environmentConfiguration = environmentConfiguration; _rabbitMqConnectionFactory = rabbitMqConnectionFactory; _rabbitMqConfiguration = rabbitMqConfiguration; _eventJsonSerializer = eventJsonSerializer; _dispatchToEventSubscribers = dispatchToEventSubscribers; }
static void SearchByCodeExample() { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); AccountCredentials credentials = PagSeguroConfiguration.GetAccountCredentials(isSandbox); string transactionCode = "59A13D84-52DA-4AB8-B365-1E7D893052B0"; Transaction transaction = TransactionSearchService.SearchByCode(credentials, transactionCode); }
public UserConfigUpdater(ConfigurationInstanceHolder configurationHolder, EnvironmentConfiguration applicationEnvironment) { _configurationHolder = configurationHolder; _fileName = Path.Combine(applicationEnvironment.ContentBasePath ?? Directory.GetCurrentDirectory(), "config.user"); if (File.Exists(_fileName)) { var fileInfo = new FileInfo(_fileName); if (fileInfo.Directory is { })
public string Recorrente(decimal valor, string cnpj, string email, string nome) { bool isSandbox = false; EnvironmentConfiguration.ChangeEnvironment(isSandbox); PreApprovalRequest preApproval = new PreApprovalRequest(); preApproval.Currency = Currency.Brl; preApproval.Reference = cnpj; preApproval.Sender = new Sender( nome, email.ToString(), new Phone("00", "00000000") ); var now = DateTime.Now; preApproval.PreApproval = new PreApproval(); preApproval.PreApproval.Charge = Charge.Auto; preApproval.PreApproval.Name = "CONTFY - CONTABILIDADE ONLINE"; preApproval.PreApproval.AmountPerPayment = valor; preApproval.PreApproval.MaxAmountPerPeriod = valor; preApproval.PreApproval.MaxPaymentsPerPeriod = 5; preApproval.PreApproval.Details = string.Format("Todo dia {0} será cobrado o valor de {1} referente a CONTABILIDADE ONLINE.", now.Day, preApproval.PreApproval.AmountPerPayment.ToString("C2")); preApproval.PreApproval.Period = Period.Monthly; preApproval.PreApproval.DayOfMonth = now.Day; preApproval.PreApproval.InitialDate = now; preApproval.PreApproval.FinalDate = now.AddYears(5); preApproval.PreApproval.MaxTotalAmount = 10000.00m; preApproval.RedirectUri = new Uri("https://gerenciadorfcadministrativoweb20180319080544.azurewebsites.net/Home/PosPagIndex?email=" + email + "&status=ativo"); SenderDocument senderCPF = new SenderDocument(Documents.GetDocumentByType("CPF"), "27952666878"); preApproval.Sender.Documents.Add(senderCPF); try { AccountCredentials credentials = PagSeguroConfiguration.Credentials(isSandbox); Uri preApprovalRedirectUri = preApproval.Register(credentials); GravaTransacao("1", "", valor, preApprovalRedirectUri.ToString(), "", 0, 0, cnpj); return(preApprovalRedirectUri.ToString()); } catch (PagSeguroServiceException exception) { return(exception.InnerException.ToString()); } }
public void EnvironmentCreatedFromConfig() { var mapExpected = 1024 * 1024 * 20; var maxDatabaseExpected = 2; var maxReadersExpected = 3; var config = new EnvironmentConfiguration { MapSize = mapExpected, MaxDatabases = maxDatabaseExpected, MaxReaders = maxReadersExpected }; _env = new LightningEnvironment(_path, config); Assert.Equal(_env.MapSize, mapExpected); Assert.Equal(_env.MaxDatabases, maxDatabaseExpected); Assert.Equal(_env.MaxReaders, maxReadersExpected); }
public void GetEnvironmentConfiguration() { _fakeDbConfig = Isolate.Fake.Instance <IDatabaseConfig>(); var fakeConn = Isolate.Fake.Instance <IDbConnection>(); Isolate.WhenCalled(() => _fakeDbConfig.GetConnection()).WillReturn(fakeConn); var fakeConfig = Isolate.Fake.Instance <Configuration>(); Isolate.WhenCalled(() => fakeConfig.BuildSessionFactory()).ReturnRecursiveFake(); _envConfig = new EnvironmentConfiguration(TestEnv, fakeConfig, _fakeDbConfig); Isolate.WhenCalled(() => _envConfig.BuildSchema(fakeConn)).WithExactArguments().IgnoreCall(); }
private static LiveDevice ReadExistingDevice(EnvironmentConfiguration environment) { //Retrieve the file info FileInfo file = GetDeviceFile(environment); if (!file.Exists) { return(null); } using (FileStream stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)) { return(Deserialize <LiveDevice>("Loading Device Credentials from Disk", stream)); } }
public static IServiceCollection AddDeploymentMvc(this IServiceCollection services, EnvironmentConfiguration environmentConfiguration, IKeyValueConfiguration configuration, ILogger logger, IApplicationAssemblyResolver applicationAssemblyResolver) { ViewAssemblyLoader.LoadViewAssemblies(logger); var filteredAssemblies = applicationAssemblyResolver.GetAssemblies(); IMvcBuilder mvcBuilder = services.AddMvc( options => { options.InputFormatters.Insert(0, new XWwwFormUrlEncodedFormatter()); options.Filters.Add <ModelValidatorFilterAttribute>(); }) .AddNewtonsoftJson( options => { options.SerializerSettings.Converters.Add(new DateConverter()); options.SerializerSettings.Formatting = Formatting.Indented; }); foreach (Assembly filteredAssembly in filteredAssemblies) { logger.Debug("Adding assembly {Assembly} to MVC application parts", filteredAssembly.FullName); mvcBuilder.AddApplicationPart(filteredAssembly); } var viewAssemblies = AssemblyLoadContext.Default.Assemblies .Where(assembly => !assembly.IsDynamic && (assembly.GetName().Name?.Contains("View") ?? false)) .ToArray(); foreach (var item in viewAssemblies) { mvcBuilder.AddApplicationPart(item); } if (environmentConfiguration.ToHostEnvironment().IsDevelopment() || configuration.ValueOrDefault(StartupConstants.RuntimeCompilationEnabled)) { mvcBuilder.AddRazorRuntimeCompilation(); } mvcBuilder .AddControllersAsServices(); services.AddAntiforgery(); return(services); }
public PermissionsHelper() { logger = new LoggerConfiguration() .WriteTo.Console() .CreateLogger(); string apiEndPoint = Environment.GetEnvironmentVariable("usersApiEndPoint"); string apiKey = Environment.GetEnvironmentVariable("usersApiKey"); environmentConfiguration = new EnvironmentConfiguration() { ApiKey = apiKey, UsersBaseUrl = apiEndPoint, }; }
public void EnvironmentConfiguration_WhenLoaded_ShouldHaveValues() { // Setup var mockedConfigRoot = new Mock <IConfigurationRoot>(); mockedConfigRoot .Setup(cr => cr["key"]) .Returns("someVal"); // Execute var actual = new EnvironmentConfiguration(mockedConfigRoot.Object); // Verify //actual.Key.Should().Be("someVal"); }
public void CreateTest() { var configuration = new EnvironmentConfiguration(); }
public override EnvironmentConfiguration LoadFromEnvironment(IHostingEnvironment env) { var e = new EnvironmentConfiguration(); return e; }