/// <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(新版) }
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); }
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); //提供微信支付信息 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 weixinPayInfo = new TenPayInfo(weixinPay_PartnerId, weixinPay_Key, weixinPay_AppId, weixinPay_AppKey, weixinPay_TenpayNotify); TenPayInfoCollection.Register(weixinPayInfo); }
/// <summary> /// 注册微信支付 /// </summary> private void RegisterWeixinPay() { //提供微信支付信息 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); }
/* * /// <summary> * /// 接口版本号 version 是 String(32) 1.0 新增字段,接口版本号,区分原接口,默认填写1.0。入参新增version后,则支付通知接口也将返回单品优惠信息字段promotion_detail,请确保支付通知的签名验证能通过。 * /// </summary> * public static string TenpayV3ProtfitRequestDataVersion { get; set; } = "1.0"; */ /// <summary> /// 注册微信支付Tenpay(注意:新注册账号请使用RegisterTenpayV3! /// </summary> /// <param name="registerService">RegisterService</param> /// <param name="tenPayInfo">微信支付(旧版本)参数</param> /// <param name="name">公众号唯一标识名称</param> /// <returns></returns> public static IRegisterService RegisterTenpayOld(this IRegisterService registerService, Func <TenPayInfo> tenPayInfo, string name) { TenPayInfoCollection.Register(tenPayInfo(), name); return(registerService); }
/// <summary> /// 手动注册微信支付(V2) /// </summary> /// <param name="userId"></param> /// <param name="tenantId"></param> /// <param name="tenPayInfo">()=>new TenPayInfo()</param> /// <param name="name"></param> public static void RegisterTenpayOld(UserKeyType userId, TenantKeyType tenantId, Func <TenPayInfo> tenPayInfo, string name) { RegisterInfoCollection <UserKeyType, TenantKeyType> .Register(userId, tenantId, tenPayInfo().PartnerId); TenPayInfoCollection.Register(tenPayInfo(), name); }