/// <summary> /// 注册微信支付 /// </summary> private void RegisterWeixinPay() { var senparcWeixinSetting = Senparc.Weixin.Config.DefaultSenparcWeixinSetting; //提供微信支付信息 var weixinPay_PartnerId = senparcWeixinSetting.WeixinPay_PartnerId; var weixinPay_Key = senparcWeixinSetting.WeixinPay_Key; var weixinPay_AppId = senparcWeixinSetting.WeixinPay_AppId; var weixinPay_AppKey = senparcWeixinSetting.WeixinPay_AppKey; var weixinPay_TenpayNotify = senparcWeixinSetting.WeixinPay_TenpayNotify; var tenPayV3_MchId = senparcWeixinSetting.TenPayV3_MchId; var tenPayV3_Key = senparcWeixinSetting.TenPayV3_Key; var tenPayV3_AppId = senparcWeixinSetting.TenPayV3_AppId; var tenPayV3_AppSecret = senparcWeixinSetting.TenPayV3_AppSecret; var tenPayV3_TenpayNotify = senparcWeixinSetting.TenPayV3_TenpayNotify; var weixinPayInfo = new TenPayInfo(weixinPay_PartnerId, weixinPay_Key, weixinPay_AppId, weixinPay_AppKey, weixinPay_TenpayNotify); TenPayInfoCollection.Register(weixinPayInfo);//微信V2(旧版) var tenPayV3Info = new TenPayV3Info(tenPayV3_AppId, tenPayV3_AppSecret, tenPayV3_MchId, tenPayV3_Key, tenPayV3_TenpayNotify); TenPayV3InfoCollection.Register(tenPayV3Info);//微信V3(新版) }
public static void Init(IPlugin plugin) { app = plugin; PluginAttr = plugin.GetAttribute(); initCfg(PluginAttr); InitWeixin(PluginAttr.Settings); //提供微信支付信息 var weixinPay_PartnerId = PluginAttr.Settings["WeixinPay_PartnerId"]; var weixinPay_Key = PluginAttr.Settings["WeixinPay_Key"]; var weixinPay_AppId = PluginAttr.Settings["WeixinPay_AppId"]; var weixinPay_AppKey = PluginAttr.Settings["WeixinPay_AppKey"]; var weixinPay_TenpayNotify = PluginAttr.Settings["WeixinPay_TenpayNotify"]; var tenPayV3_MchId = PluginAttr.Settings["TenPayV3_MchId"]; var tenPayV3_Key = PluginAttr.Settings["TenPayV3_Key"]; var tenPayV3_AppId = PluginAttr.Settings["TenPayV3_AppId"]; var tenPayV3_AppSecret = PluginAttr.Settings["TenPayV3_AppSecret"]; var tenPayV3_TenpayNotify = PluginAttr.Settings["TenPayV3_TenpayNotify"]; var weixinPayInfo = new TenPayInfo(weixinPay_PartnerId, weixinPay_Key, weixinPay_AppId, weixinPay_AppKey, weixinPay_TenpayNotify); TenPayInfoCollection.Register(weixinPayInfo); var tenPayV3Info = new TenPayV3Info(tenPayV3_AppId, tenPayV3_AppSecret, tenPayV3_MchId, tenPayV3_Key, tenPayV3_TenpayNotify); TenPayV3InfoCollection.Register(tenPayV3Info); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); //提供微信支付信息 var weixinPay_PartnerId = System.Configuration.ConfigurationManager.AppSettings["WeixinPay_PartnerId"]; var weixinPay_Key = System.Configuration.ConfigurationManager.AppSettings["WeixinPay_Key"]; var weixinPay_AppId = System.Configuration.ConfigurationManager.AppSettings["WeixinPay_AppId"]; var weixinPay_AppKey = System.Configuration.ConfigurationManager.AppSettings["WeixinPay_AppKey"]; var weixinPay_TenpayNotify = System.Configuration.ConfigurationManager.AppSettings["WeixinPay_TenpayNotify"]; var tenPayV3_MchId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_MchId"]; var tenPayV3_Key = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_Key"]; var tenPayV3_AppId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppId"]; var tenPayV3_AppSecret = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppSecret"]; var tenPayV3_TenpayNotify = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_TenpayNotify"]; var weixinPayInfo = new TenPayInfo(weixinPay_PartnerId, weixinPay_Key, weixinPay_AppId, weixinPay_AppKey, weixinPay_TenpayNotify); TenPayInfoCollection.Register(weixinPayInfo); var tenPayV3Info = new TenPayV3Info(tenPayV3_AppId, tenPayV3_AppSecret, tenPayV3_MchId, tenPayV3_Key, tenPayV3_TenpayNotify); TenPayV3InfoCollection.Register(tenPayV3Info); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); LogHelper.SetConfig(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); // BundleConfig.RegisterBundles(BundleTable.Bundles); #region 微信公众号相关配置 var appId = ConfigurationManager.AppSettings["WeixinAppId"]; var secret = ConfigurationManager.AppSettings["WeixinAppSecret"]; AccessTokenContainer.Register(appId, secret); var tenPayV3_MchId = ConfigurationManager.AppSettings["TenPayV3_MchId"]; var tenPayV3_Key = ConfigurationManager.AppSettings["TenPayV3_Key"]; var tenPayV3_AppId = ConfigurationManager.AppSettings["TenPayV3_AppId"]; var tenPayV3_AppSecret = ConfigurationManager.AppSettings["TenPayV3_AppSecret"]; var tenPayV3_TenpayNotify = ConfigurationManager.AppSettings["TenPayV3_TenpayNotify"]; var tenPayV3Info = new TenPayV3Info(tenPayV3_AppId, tenPayV3_AppSecret, tenPayV3_MchId, tenPayV3_Key, tenPayV3_TenpayNotify); TenPayV3InfoCollection.Register(tenPayV3Info); #endregion RegisterView(); //注册视图访问规则 MyJobScheduler.Run(); }
/// <summary> /// 注册微信支付 /// </summary> private void RegisterWeixinPay() { //提供微信支付信息 var tenPayV3_MchId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_MchId"]; var tenPayV3_Key = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_Key"]; var tenPayV3_AppId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppId"]; var tenPayV3_AppSecret = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppSecret"]; var tenPayV3_TenpayNotify = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_TenpayNotify"]; var tenPayV3Info = new TenPayV3Info(tenPayV3_AppId, tenPayV3_AppSecret, tenPayV3_MchId, tenPayV3_Key, tenPayV3_TenpayNotify); TenPayV3InfoCollection.Register(tenPayV3Info); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); #region 初始化数据访问对象 Libraries.Core.ServiceLocator.Initialization(); #endregion var mchId = System.Configuration.ConfigurationManager.AppSettings["mchId"]; var appId = System.Configuration.ConfigurationManager.AppSettings["appid"]; var appSecret = System.Configuration.ConfigurationManager.AppSettings["appSecret"]; var apiKey = System.Configuration.ConfigurationManager.AppSettings["apiKey"]; var notifyUrl = System.Configuration.ConfigurationManager.AppSettings["notifyUrl"]; var tenPayV3Info = new TenPayV3Info(appId, appSecret, mchId, apiKey, notifyUrl); TenPayV3InfoCollection.Register(tenPayV3Info); }
/// <summary> /// 注册微信支付 /// </summary> private void RegisterWeixinPay() { //提供微信支付信息 var weixinPay_PartnerId = ConfigurationManager.AppSettings["WeixinPay_PartnerId"]; var weixinPay_Key = ConfigurationManager.AppSettings["WeixinPay_Key"]; var weixinPay_AppId = ConfigurationManager.AppSettings["WeixinPay_AppId"]; var weixinPay_AppKey = ConfigurationManager.AppSettings["WeixinPay_AppKey"]; var weixinPay_TenpayNotify = ConfigurationManager.AppSettings["WeixinPay_TenpayNotify"]; var tenPayV3_MchId = ConfigurationManager.AppSettings["TenPayV3_MchId"]; var tenPayV3_Key = ConfigurationManager.AppSettings["TenPayV3_Key"]; var tenPayV3_AppId = ConfigurationManager.AppSettings["TenPayV3_AppId"]; var tenPayV3_AppSecret = ConfigurationManager.AppSettings["TenPayV3_AppSecret"]; var tenPayV3_TenpayNotify = ConfigurationManager.AppSettings["TenPayV3_TenpayNotify"]; var weixinPayInfo = new TenPayInfo(weixinPay_PartnerId, weixinPay_Key, weixinPay_AppId, weixinPay_AppKey, weixinPay_TenpayNotify); TenPayInfoCollection.Register(weixinPayInfo); var tenPayV3Info = new TenPayV3Info(tenPayV3_AppId, tenPayV3_AppSecret, tenPayV3_MchId, tenPayV3_Key, tenPayV3_TenpayNotify); TenPayV3InfoCollection.Register(tenPayV3Info); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var _appId = System.Web.Configuration.WebConfigurationManager.AppSettings["WeixinAppId"]; var _appSecret = System.Web.Configuration.WebConfigurationManager.AppSettings["WeixinAppSecret"]; var tenPayV3_MchId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_MchId"]; var tenPayV3_Key = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_Key"]; var tenPayV3_AppId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppId"]; var tenPayV3_AppSecret = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppSecret"]; var tenPayV3_TenpayNotify = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_TenpayNotify"]; var tenPayV3Info = new TenPayV3Info(tenPayV3_AppId, tenPayV3_AppSecret, tenPayV3_MchId, tenPayV3_Key, tenPayV3_TenpayNotify); TenPayV3InfoCollection.Register(tenPayV3Info); Senparc.Weixin.MP.Containers.AccessTokenContainer.Register(_appId, _appSecret); }
/// <summary> /// 注册微信支付TenpayV3 /// </summary> /// <param name="registerService">RegisterService</param> /// <param name="tenPayV3Info">微信支付(新版本 V3)参数</param> /// <param name="name">公众号唯一标识名称</param> /// <returns></returns> public static IRegisterService RegisterTenpayV3(this IRegisterService registerService, Func <TenPayV3Info> tenPayV3Info, string name) { TenPayV3InfoCollection.Register(tenPayV3Info(), name); return(registerService); }
/// <summary> /// 手动注册微信支付(V3) /// </summary> /// <param name="userId"></param> /// <param name="tenantId"></param> /// <param name="tenPayV3Info">()=>new TenPayV3Info()</param> /// <param name="name"></param> public static void RegisterTenpayV3(UserKeyType userId, TenantKeyType tenantId, Func <TenPayV3Info> tenPayV3Info, string name) { RegisterV3InfoCollection <UserKeyType, TenantKeyType> .Register(userId, tenantId, tenPayV3Info().MchId); TenPayV3InfoCollection.Register(tenPayV3Info(), name); }
/// <summary> /// 注册微信支付 /// </summary> public static void RegisterWeixinPay() { var tenPayV3Info = new TenPayV3Info(Instance.AppId, Instance.AppSecret, Instance.MchId, Instance.Key, Instance.Notify); TenPayV3InfoCollection.Register(tenPayV3Info); }