protected override void Execute(CodeActivityContext context) { var aPIKey = APIKey.Get(context); Fixer.SetApiKey(aPIKey); var inputAmount = InputAmount.Get(context); var inputCurrency = InputCurrency.Get(context); var outputCurrency = OutputCurrency.Get(context); double outputAmount = Fixer.Convert(inputCurrency, outputCurrency, inputAmount); OutputAmount.Set(context, outputAmount); }
protected override void Execute(CodeActivityContext context) { var aPIKey = APIKey.Get(context); Fixer.SetApiKey(aPIKey); var inputCurrency = InputCurrency.Get(context); var outputCurrency = OutputCurrency.Get(context); var rate = Fixer.Rate(inputCurrency, outputCurrency); double dblrate = rate.Convert(1); Rate.Set(context, dblrate); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } //app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); try { // One-time call to SetApiKey Fixer.SetApiKey("9d0b675f405dcb7d074f6028b02966d8"); } catch { //TODO } }
public CertifyConnectedSystemManager( ConnectedSystem connectedSystem, State state, TimeSpan maxFileAge, ILoggerFactory loggerFactory) : base(connectedSystem, state, maxFileAge, loggerFactory.CreateLogger <CertifyConnectedSystemManager>()) { _certifyClient = new CertifyClient(connectedSystem.Credentials.PublicText, connectedSystem.Credentials.PrivateText, new CertifyClientOptions { Timeout = TimeSpan.FromMinutes(2) }); // FixerSharp for exchange rate conversion, if configured if (connectedSystem.Configuration.ContainsKey(FixerApiKey)) { var fixerApiKey = connectedSystem.Configuration[FixerApiKey]; Fixer.SetApiKey(fixerApiKey); } }
public void Configuration(IAppBuilder app) { try { // get fixer key string key = DataAccessObject.GetFixerIOKey(); if (!string.IsNullOrEmpty(key)) { Fixer.SetApiKey(key); } } catch (Exception ex) { ErrorManager.LogError("Startup.cs", "", "Configuration", ex); } finally { ConfigureAuth(app); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Fixer.SetApiKey(Configuration.GetSection("CurrencyConverterApiKey").Value); services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddScoped <ICurrencyService, CurrencyService>(); services.AddScoped <ICurrencyLoggingService, CurrencyLoggingService>(); services.AddScoped <ICurrencyRepository, CurrencyRepository>(); services.AddScoped <ICurrencyLoggingRepository, CurrencyLoggingRepository>(); services.AddScoped <IUnitOfWork, UnitOfWork>( sp => { var context = sp.GetRequiredService <CurrencyConverterDbContext>(); return(new UnitOfWork(context)); }); services.AddDbContext <CurrencyConverterDbContext>(options => { options.UseLazyLoadingProxies(false) .UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), sqlServerOptionsAction: sqlOptions => { sqlOptions.MigrationsAssembly(typeof(CurrencyConverterDbContext).GetTypeInfo().Assembly.GetName().Name); //Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency sqlOptions.EnableRetryOnFailure(maxRetryCount: 5, maxRetryDelay: TimeSpan.FromSeconds(10), errorNumbersToAdd: null); }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
public void FirstTimeInitiate() { try { // Key used for exchange/valuta API Fixer.SetApiKey("f2aac993c3e6c4e71a022f012cf5cd74"); } catch (System.IO.IOException e) { MessageBox.Show($"Error Fixershar key / access to the internet:{e}"); } // used for language combobox, for showing the pictures / information langageList.Add(new Languages { ID = 1, Photo = @"C:\Users\hakan\OneDrive\Billeder/englishFlag.ico", Name = "English" }); langageList.Add(new Languages { ID = 2, Photo = @"C:\Users\hakan\OneDrive\Billeder/danishFlag.ico", Name = "Danish" }); comboBoxLang.ItemsSource = langageList; current = 1; InitiateDatabase(); }
private void ConfigureFixer() { Fixer.SetApiKey("0386b579beba8865938548fe44841a8d"); }
public void Invalid_Api_Key_ThrowsException() { Fixer.SetApiKey(null); Fixer.Convert(Symbols.USD, Symbols.EUR, 100); }
public void TestInitialize() => Fixer.SetApiKey("API_KEY_HERE");
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMapper mapper) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } Fixer.SetApiKey("391ea2067e573b4fd36e33b16e9f7ae8"); using (var serviceScope = app.ApplicationServices.CreateScope()) { using (var context = serviceScope.ServiceProvider.GetRequiredService <BankCloudDbContext>()) { context.Database.EnsureCreated(); if (!context.Roles.Any()) { context.Roles.Add(new BankUserRole { Name = "Admin", NormalizedName = "ADMIN" }); context.Roles.Add(new BankUserRole { Name = "User", NormalizedName = "USER" }); context.Roles.Add(new BankUserRole { Name = "Agent", NormalizedName = "AGENT" }); } if (!context.Currencies.Any()) { context.Currencies.Add(new Currency { IsoCode = "USD", Name = "American Dollar", Type = Data.Entities.Enums.CurrencyType.International, ТrustLevel = 9 }); context.Currencies.Add(new Currency { IsoCode = "EUR", Name = "Euro", Type = Data.Entities.Enums.CurrencyType.International, ТrustLevel = 9 }); context.Currencies.Add(new Currency { IsoCode = "BGN", Name = "Bulgarian Lev", Type = Data.Entities.Enums.CurrencyType.National, ТrustLevel = 9 }); context.Currencies.Add(new Currency { IsoCode = "GBP", Name = "Great Britain Pound", Type = Data.Entities.Enums.CurrencyType.International, ТrustLevel = 8 }); context.Currencies.Add(new Currency { IsoCode = "JPY", Name = "Japanese Yen", Type = Data.Entities.Enums.CurrencyType.International, ТrustLevel = 9 }); } context.SaveChanges(); } } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public void TestInitialize() => Fixer.SetApiKey("5baa807e12a40deea093368643e96187");
public MainWindow() { Fixer.SetApiKey("ff3340ef6706308913308472e0fc7382"); double current1 = Fixer.Convert(Symbols.USD, Symbols.KZT, 1); double current2 = Fixer.Convert(Symbols.EUR, Symbols.KZT, 1); double current3 = Fixer.Convert(Symbols.KWD, Symbols.KZT, 1); double current4 = Fixer.Convert(Symbols.AUD, Symbols.KZT, 1); double current5 = Fixer.Convert(Symbols.ALL, Symbols.KZT, 1); double current6 = Fixer.Convert(Symbols.JPY, Symbols.KZT, 1); double current7 = Fixer.Convert(Symbols.KPW, Symbols.KZT, 1); double current8 = Fixer.Convert(Symbols.JOD, Symbols.KZT, 1); double current9 = Fixer.Convert(Symbols.RUB, Symbols.KZT, 1); double current10 = Fixer.Convert(Symbols.PKR, Symbols.KZT, 1); //List<CurrentInKzt> currents = new List<CurrentInKzt>() //{ // new CurrentInKzt() // { // Name="USD", // QuantityOfKzt = Fixer.Convert(Symbols.USD, Symbols.KZT, 1) // }, // new CurrentInKzt() // { // Name="EUR", // QuantityOfKzt = Fixer.Convert(Symbols.EUR, Symbols.KZT, 1) // }, // new CurrentInKzt() // { // Name="KWD", // QuantityOfKzt = Fixer.Convert(Symbols.KWD, Symbols.KZT, 1) // }, // new CurrentInKzt() // { // Name="AUD", // QuantityOfKzt = Fixer.Convert(Symbols.AUD, Symbols.KZT, 1) // }, // new CurrentInKzt() // { // Name="ALL", // QuantityOfKzt = Fixer.Convert(Symbols.ALL, Symbols.KZT, 1) // }, // new CurrentInKzt() // { // Name="JPY", // QuantityOfKzt = Fixer.Convert(Symbols.JPY, Symbols.KZT, 1) // }, // new CurrentInKzt() // { // Name="KPW", // QuantityOfKzt = Fixer.Convert(Symbols.KPW, Symbols.KZT, 1) // }, // new CurrentInKzt() // { // Name="JOD", // QuantityOfKzt = Fixer.Convert(Symbols.JOD, Symbols.KZT, 1) // }, // new CurrentInKzt() // { // Name="RUB", // QuantityOfKzt = Fixer.Convert(Symbols.RUB, Symbols.KZT, 1) // }, // new CurrentInKzt() // { // Name="PKR", // QuantityOfKzt = Fixer.Convert(Symbols.PKR, Symbols.KZT, 1) // } //}; InitializeComponent(); }