static Config() { IPaySection paySection = DataContext.GetPaySection(); if (paySection != null) { //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ selleremail = paySection.Alipay.SellerEmail; //合作身份者ID,以2088开头由16位纯数字组成的字符串 partner = paySection.Alipay.Partner; //交易安全检验码,由数字和字母组成的32位字符串 //如果签名方式设置为“MD5”时,请设置该参数 key = paySection.Alipay.Key; //商户的私钥 //如果签名方式设置为“0001”时,请设置该参数 private_key = paySection.Alipay.PrivateKey; //支付宝的公钥 //如果签名方式设置为“0001”时,请设置该参数 public_key = paySection.Alipay.PublicKey; //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ //字符编码格式 目前支持 utf-8 input_charset = string.IsNullOrEmpty(paySection.Alipay.InputCharset) ? "utf-8" : paySection.Alipay.InputCharset; //签名方式,选择项:0001(RSA)、MD5 sign_type = string.IsNullOrEmpty(paySection.Alipay.SignType) ? "0001" : paySection.Alipay.SignType; //无线的产品中,签名方式为rsa时,sign_type需赋值为0001而不是RSA } }
static WxPayConfig() { Log.Info("WxConfig", "初始化参数"); string host = StringHelper.GetHost(); if (!string.IsNullOrEmpty(host)) { IPaySection paySection = DataContext.GetPaySection(); if (paySection != null) { //服务器异步通知页面路径 string notify_url = string.Concat("http://", host, paySection.WxPay2.CallbackUrl); APPID = paySection.WxPay2.AppId; MCHID = paySection.WxPay2.MchId; KEY = paySection.WxPay2.AppKey; APPSECRET = paySection.WxPay2.AppSecret; SSLCERT_PATH = ""; SSLCERT_PASSWORD = ""; NOTIFY_URL = notify_url; IP = "8.8.8.8"; PROXY_URL = ""; REPORT_LEVENL = 0; LOG_LEVENL = StringHelper.ToInt(paySection.WxPay2.LogLevel); } } }
public override object Create(object parent, object configContext, System.Xml.XmlNode section) { IPaySection model = null; if (section != null) { model = new PaySection(); XmlNode node = null; #region if (GetSingleNodeValue(section, "/PaySection/NowPay", out node)) { model.NowPay.AppId = GetSingleNodeAttributeValue(node, "item[@key=\"AppId\"]", "value"); model.NowPay.AppKey = GetSingleNodeAttributeValue(node, "item[@key=\"AppKey\"]", "value"); model.NowPay.WeChatAppId = GetSingleNodeAttributeValue(node, "item[@key=\"WeChatAppId\"]", "value"); model.NowPay.WeChatAppKey = GetSingleNodeAttributeValue(node, "item[@key=\"WeChatAppKey\"]", "value"); model.NowPay.WeChatQrCodeAppId = GetSingleNodeAttributeValue(node, "item[@key=\"WeChatQrCodeAppId\"]", "value"); model.NowPay.WeChatQrCodeAppKey = GetSingleNodeAttributeValue(node, "item[@key=\"WeChatQrCodeAppKey\"]", "value"); model.NowPay.CallbackUrl = GetSingleNodeAttributeValue(node, "item[@key=\"CallbackUrl\"]", "value"); model.NowPay.NewCallbackUrl = GetSingleNodeAttributeValue(node, "item[@key=\"NewCallbackUrl\"]", "value"); } if (GetSingleNodeValue(section, "/PaySection/WxPay", out node)) { model.WxPay.AppId = GetSingleNodeAttributeValue(node, "item[@key=\"AppId\"]", "value"); model.WxPay.MchId = GetSingleNodeAttributeValue(node, "item[@key=\"MchId\"]", "value"); model.WxPay.AppKey = GetSingleNodeAttributeValue(node, "item[@key=\"AppKey\"]", "value"); model.WxPay.AppSecret = GetSingleNodeAttributeValue(node, "item[@key=\"AppSecret\"]", "value"); model.WxPay.CallbackUrl = GetSingleNodeAttributeValue(node, "item[@key=\"CallbackUrl\"]", "value"); model.WxPay.LogLevel = GetSingleNodeAttributeValue(node, "item[@key=\"LogLevel\"]", "value"); } if (GetSingleNodeValue(section, "/PaySection/WxPay2", out node)) { model.WxPay2.AppId = GetSingleNodeAttributeValue(node, "item[@key=\"AppId\"]", "value"); model.WxPay2.MchId = GetSingleNodeAttributeValue(node, "item[@key=\"MchId\"]", "value"); model.WxPay2.AppKey = GetSingleNodeAttributeValue(node, "item[@key=\"AppKey\"]", "value"); model.WxPay2.AppSecret = GetSingleNodeAttributeValue(node, "item[@key=\"AppSecret\"]", "value"); model.WxPay2.CallbackUrl = GetSingleNodeAttributeValue(node, "item[@key=\"CallbackUrl\"]", "value"); model.WxPay2.LogLevel = GetSingleNodeAttributeValue(node, "item[@key=\"LogLevel\"]", "value"); } if (GetSingleNodeValue(section, "/PaySection/Alipay", out node)) { model.Alipay.SellerEmail = GetSingleNodeAttributeValue(node, "item[@key=\"SellerEmail\"]", "value"); model.Alipay.Partner = GetSingleNodeAttributeValue(node, "item[@key=\"Partner\"]", "value"); model.Alipay.Key = GetSingleNodeAttributeValue(node, "item[@key=\"Key\"]", "value"); model.Alipay.PrivateKey = GetSingleNodeAttributeValue(node, "item[@key=\"PrivateKey\"]", "value"); model.Alipay.PublicKey = GetSingleNodeAttributeValue(node, "item[@key=\"PublicKey\"]", "value"); model.Alipay.InputCharset = GetSingleNodeAttributeValue(node, "item[@key=\"InputCharset\"]", "value"); model.Alipay.SignType = GetSingleNodeAttributeValue(node, "item[@key=\"SignType\"]", "value"); } #endregion } return(model); }
static NowPayConfig() { IPaySection paySection = DataContext.GetPaySection(); if (paySection != null) { AppId = paySection.NowPay.AppId; AppKey = paySection.NowPay.AppKey; WeChatAppId = paySection.NowPay.WeChatAppId; WeChatAppKey = paySection.NowPay.WeChatAppKey; WeChatQrCodeAppId = paySection.NowPay.WeChatQrCodeAppId; WeChatQrCodeAppKey = paySection.NowPay.WeChatQrCodeAppKey; CallbackUrl = paySection.NowPay.CallbackUrl; NewCallbackUrl = paySection.NowPay.NewCallbackUrl; } }