| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using Essensoft.AspNetCore.Payment.Alipay;
- using Essensoft.AspNetCore.Payment.JDPay;
- using Essensoft.AspNetCore.Payment.LianLianPay;
- using Essensoft.AspNetCore.Payment.QPay;
- using Essensoft.AspNetCore.Payment.UnionPay;
- using Essensoft.AspNetCore.Payment.WeChatPay;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.Extensions.Configuration;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Hosting;
- namespace WebApplicationSample_V3_0
- {
- public class Startup
- {
- public Startup(IConfiguration configuration)
- {
- Configuration = configuration;
- }
- public IConfiguration Configuration { get; }
- // This method gets called by the runtime. Use this method to add services to the container.
- public void ConfigureServices(IServiceCollection services)
- {
- // 引入Payment 依赖注入
- services.AddAlipay();
- services.AddJDPay();
- services.AddQPay();
- services.AddUnionPay();
- services.AddWeChatPay();
- services.AddLianLianPay();
- // 在 appsettings.json 中 配置选项
- services.Configure<AlipayOptions>(Configuration.GetSection("Alipay"));
- services.Configure<JDPayOptions>(Configuration.GetSection("JDPay"));
- services.Configure<QPayOptions>(Configuration.GetSection("QPay"));
- services.Configure<UnionPayOptions>(Configuration.GetSection("UnionPay"));
- services.Configure<WeChatPayOptions>(Configuration.GetSection("WeChatPay"));
- services.Configure<LianLianPayOptions>(Configuration.GetSection("LianLianPay"));
- services.AddControllersWithViews();
- }
- // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
- {
- if (env.IsDevelopment())
- {
- app.UseDeveloperExceptionPage();
- }
- 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();
- }
- app.UseHttpsRedirection();
- app.UseStaticFiles();
- app.UseRouting();
- app.UseAuthorization();
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapControllerRoute(
- name: "default",
- pattern: "{controller=Home}/{action=Index}/{id?}");
- });
- }
- }
- }
|