Browse Source

支付服务取配置修改

warr.qian 1 year ago
parent
commit
5992a860cb
2 changed files with 21 additions and 23 deletions
  1. 11 12
      Common/AlipayCommon.cs
  2. 10 11
      Common/WeChat/WxPayConfigData.cs

+ 11 - 12
Common/AlipayCommon.cs

@@ -19,16 +19,15 @@ namespace WingPaymentService.Common
     /// </summary>
     public class AlipayCommon
     {
-        private readonly string _protocol = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "Protocol").Value;
-        private readonly string _gatewayHost = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "GatewayHost").Value;
-        private readonly string _signType = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "SignType").Value;
-        private readonly string _appId = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "AppId").Value;
-        private readonly string _merchantPrivateKey = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "MerchantPrivateKey").Value;
-        private readonly string _alipayPublicKey = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "AlipayPublicKey").Value;
-        private readonly string _merchantCertPath = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "MerchantCertPath").Value;
-        private readonly string _certPath = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "AlipayCertPath").Value;
-        private readonly string _rootCertPath = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "AlipayRootCertPath").Value;
-        private readonly string _notifyUrl = ConfigurationManager.GetParammeter<StringParameter>("Alipay", "NotifyUrl").Value;
+        private string _gatewayHost => ConfigurationManager.GetParammeter<StringParameter>("Alipay", "GatewayHost").Value;
+        private string _signType => ConfigurationManager.GetParammeter<StringParameter>("Alipay", "SignType").Value;
+        private string _appId => ConfigurationManager.GetParammeter<StringParameter>("Alipay", "AppId").Value;
+        private string _merchantPrivateKey => ConfigurationManager.GetParammeter<StringParameter>("Alipay", "MerchantPrivateKey").Value;
+        private string _alipayPublicKey => ConfigurationManager.GetParammeter<StringParameter>("Alipay", "AlipayPublicKey").Value;
+        private string _merchantCertPath => ConfigurationManager.GetParammeter<StringParameter>("Alipay", "MerchantCertPath").Value;
+        private string _certPath => ConfigurationManager.GetParammeter<StringParameter>("Alipay", "AlipayCertPath").Value;
+        private string _rootCertPath => ConfigurationManager.GetParammeter<StringParameter>("Alipay", "AlipayRootCertPath").Value;
+        private string _notifyUrl => ConfigurationManager.GetParammeter<StringParameter>("Alipay", "NotifyUrl").Value;
 
         /// <summary>
         /// 支付宝网站支付
@@ -41,7 +40,7 @@ namespace WingPaymentService.Common
         {
             try
             {
-                var serverUrl = $"{_protocol}://{_gatewayHost}/gateway.do";
+                var serverUrl = $"{_gatewayHost}/gateway.do";
                 // 组装业务参数model
                 AlipayTradePagePayModel model = new AlipayTradePagePayModel
                 {
@@ -99,7 +98,7 @@ namespace WingPaymentService.Common
         {
             try
             {
-                var serverUrl = $"{_protocol}://{_gatewayHost}/gateway.do";
+                var serverUrl = $"{_gatewayHost}/gateway.do";
                 // 组装业务参数model
                 AlipayTradeWapPayModel model = new AlipayTradeWapPayModel
                 {

+ 10 - 11
Common/WeChat/WxPayConfigData.cs

@@ -6,16 +6,15 @@ namespace WingPaymentService.Common.WeChat
 {
     public class WxPayConfigData : IWxPayIConfig
     {
-        private readonly string _serverIP = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "ServerIP").Value;
-        private readonly string _protocol = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "Protocol").Value;
-        private readonly string _gatewayHost = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "GatewayHost").Value;
-        private readonly string _appId = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "AppId").Value;
-        private readonly string _mchId = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "MchId").Value;
-        private readonly string _key = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "Key").Value;
-        private readonly string _appSecret = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "AppSecret").Value;
-        private readonly string _sslCertData = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "SSLCertData").Value;
-        private readonly string _sslCertPassword = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "SSLCertPassword").Value;
-        private readonly string _notifyUrl = ConfigurationManager.GetParammeter<StringParameter>("WeChat", "NotifyUrl").Value;
+        private string _serverIP => ConfigurationManager.GetParammeter<StringParameter>("WeChat", "ServerIP").Value;
+        private string _gatewayHost => ConfigurationManager.GetParammeter<StringParameter>("WeChat", "GatewayHost").Value;
+        private string _appId => ConfigurationManager.GetParammeter<StringParameter>("WeChat", "AppId").Value;
+        private string _mchId => ConfigurationManager.GetParammeter<StringParameter>("WeChat", "MchId").Value;
+        private string _key => ConfigurationManager.GetParammeter<StringParameter>("WeChat", "Key").Value;
+        private string _appSecret => ConfigurationManager.GetParammeter<StringParameter>("WeChat", "AppSecret").Value;
+        private string _sslCertData => ConfigurationManager.GetParammeter<StringParameter>("WeChat", "SSLCertData").Value;
+        private string _sslCertPassword => ConfigurationManager.GetParammeter<StringParameter>("WeChat", "SSLCertPassword").Value;
+        private string _notifyUrl => ConfigurationManager.GetParammeter<StringParameter>("WeChat", "NotifyUrl").Value;
 
         //=======【基本信息设置】=====================================
         /* 微信公众号信息配置
@@ -45,7 +44,7 @@ namespace WingPaymentService.Common.WeChat
 
         public string GetServerUrl()
         {
-            var serverUrl = $"{_protocol}://{_gatewayHost}";
+            var serverUrl = $"{_gatewayHost}";
             return serverUrl;
         }