Exemple #1
0
 public ApiPosController(
     ILoggerFactory loggerFactory,
     ApplicationDbContext db,
     IExchangeBroker broker,
     IPaymentService paymentService)
 {
     _logger         = loggerFactory.CreateLogger(nameof(ApiPosController));
     _db             = db;
     _broker         = broker;
     _paymentService = paymentService;
 }
        public PaymentService(ILoggerFactory loggerFactory,
                              IConfiguration configuration,
                              ApplicationDbContext db,
                              IRateCache rateCache,
                              IMemoryCache cache,
                              IExchangeBroker broker,
                              IHttpContextAccessor context,
                              GraftService graft)
        {
            _settings = configuration
                        .GetSection("PaymentService")
                        .Get <PaymentsConfiguration>();

            _logger    = loggerFactory.CreateLogger(nameof(PaymentService));
            _db        = db;
            _rateCache = rateCache;
            _cache     = cache;
            _broker    = broker;
            _context   = context;
            _graft     = graft;
        }
Exemple #3
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              ApplicationDbContext context, WatcherService watcher, IRateCache rateCache,
                              IEmailSender emailService, IExchangeBroker broker)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Error/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "GRAFT Payment Terminal Gateway API V1");
            });

            app.UseMiddleware();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            watcher.Add(rateCache);
            watcher.Add(emailService);
            watcher.Add(broker);

            // comment this line if you want to apply the migrations as a separate process
            context.Database.Migrate();
        }