Explorar o código

格式化代码

Roc %!s(int64=6) %!d(string=hai) anos
pai
achega
22f2c9d459
Modificáronse 61 ficheiros con 121 adicións e 88 borrados
  1. 2 2
      Directory.Build.props
  2. 1 1
      samples/WebApplicationSample/Program.cs
  3. 1 1
      src/Essensoft.AspNetCore.Payment.Alipay/AlipayCertificateManager.cs
  4. 8 0
      src/Essensoft.AspNetCore.Payment.Alipay/AlipayException.cs
  5. 1 1
      src/Essensoft.AspNetCore.Payment.Alipay/AlipayNotifyClient.cs
  6. 1 1
      src/Essensoft.AspNetCore.Payment.Alipay/AlipayNotifyResult.cs
  7. 2 2
      src/Essensoft.AspNetCore.Payment.Alipay/Utility/AlipaySignature.cs
  8. 1 1
      src/Essensoft.AspNetCore.Payment.Alipay/Utility/AntCertificationUtil.cs
  9. 3 3
      src/Essensoft.AspNetCore.Payment.Alipay/Utility/FileItem.cs
  10. 8 0
      src/Essensoft.AspNetCore.Payment.JDPay/JDPayException.cs
  11. 1 1
      src/Essensoft.AspNetCore.Payment.JDPay/JDPayNotifyClient.cs
  12. 1 1
      src/Essensoft.AspNetCore.Payment.JDPay/JDPayNotifyResult.cs
  13. 3 8
      src/Essensoft.AspNetCore.Payment.JDPay/Utility/JDPaySecurity.cs
  14. 8 0
      src/Essensoft.AspNetCore.Payment.LianLianPay/LianLianPayException.cs
  15. 1 1
      src/Essensoft.AspNetCore.Payment.LianLianPay/LianLianPayNotifyResult.cs
  16. 1 1
      src/Essensoft.AspNetCore.Payment.LianLianPay/Utility/LianLianPaySecurity.cs
  17. 5 5
      src/Essensoft.AspNetCore.Payment.QPay/Parser/QPayListPropertyParser.cs
  18. 1 1
      src/Essensoft.AspNetCore.Payment.QPay/QPayCode.cs
  19. 8 0
      src/Essensoft.AspNetCore.Payment.QPay/QPayException.cs
  20. 1 1
      src/Essensoft.AspNetCore.Payment.QPay/QPayNotifyResult.cs
  21. 1 1
      src/Essensoft.AspNetCore.Payment.QPay/QPayTradeStates.cs
  22. 1 1
      src/Essensoft.AspNetCore.Payment.QPay/QPayTradeType.cs
  23. 1 2
      src/Essensoft.AspNetCore.Payment.QPay/Response/QPayRefundQueryResponse.cs
  24. 1 1
      src/Essensoft.AspNetCore.Payment.QPay/Utility/QPaySignature.cs
  25. 2 2
      src/Essensoft.AspNetCore.Payment.QPay/Utility/QPayUtility.cs
  26. 1 1
      src/Essensoft.AspNetCore.Payment.Security/AES.cs
  27. 1 1
      src/Essensoft.AspNetCore.Payment.Security/AES_CTR_NoPadding.cs
  28. 1 1
      src/Essensoft.AspNetCore.Payment.Security/HMACSHA256.cs
  29. 1 1
      src/Essensoft.AspNetCore.Payment.Security/MD5.cs
  30. 1 1
      src/Essensoft.AspNetCore.Payment.Security/MD5WithRSA.cs
  31. 1 1
      src/Essensoft.AspNetCore.Payment.Security/RSAUtilities.cs
  32. 1 1
      src/Essensoft.AspNetCore.Payment.Security/RSA_ECB_OAEPWithSHA1AndMGF1Padding.cs
  33. 1 1
      src/Essensoft.AspNetCore.Payment.Security/RSA_ECB_PKCS1Padding.cs
  34. 1 1
      src/Essensoft.AspNetCore.Payment.Security/RSA_NONE_PKCS1Padding.cs
  35. 1 1
      src/Essensoft.AspNetCore.Payment.Security/SHA1.cs
  36. 1 1
      src/Essensoft.AspNetCore.Payment.Security/SHA1WithRSA.cs
  37. 1 1
      src/Essensoft.AspNetCore.Payment.Security/SHA256.cs
  38. 1 1
      src/Essensoft.AspNetCore.Payment.Security/SHA256WithRSA.cs
  39. 1 1
      src/Essensoft.AspNetCore.Payment.Security/SM3.cs
  40. 1 1
      src/Essensoft.AspNetCore.Payment.Security/TripleDES.cs
  41. 8 0
      src/Essensoft.AspNetCore.Payment.UnionPay/UnionPayException.cs
  42. 1 1
      src/Essensoft.AspNetCore.Payment.UnionPay/UnionPayNotifyResult.cs
  43. 3 3
      src/Essensoft.AspNetCore.Payment.UnionPay/Utility/UnionPaySignature.cs
  44. 1 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Notify/WeChatPayPartnerPAPPayApplyNotify.cs
  45. 1 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Notify/WeChatPayTransitPartnerPayPayApplyNotify.cs
  46. 1 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Notify/WeChatPayUnifiedOrderNotify.cs
  47. 1 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Notify/WeChatPayVehiclePartnerPayPayApplyNotify.cs
  48. 5 5
      src/Essensoft.AspNetCore.Payment.WeChatPay/Parser/WeChatPayListPropertyParser.cs
  49. 1 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayOrderQueryResponse.cs
  50. 1 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayPartnerPAPOrderQueryResponse.cs
  51. 1 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayRefundQueryResponse.cs
  52. 1 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayRefundResponse.cs
  53. 1 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayTransitPartnerPayQueryOrderResponse.cs
  54. 1 1
      src/Essensoft.AspNetCore.Payment.WeChatPay/Utility/WeChatPaySignature.cs
  55. 2 2
      src/Essensoft.AspNetCore.Payment.WeChatPay/Utility/WeChatPayUtility.cs
  56. 1 1
      src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayCode.cs
  57. 8 0
      src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayException.cs
  58. 1 1
      src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayNotifyResult.cs
  59. 1 1
      src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayTradeScene.cs
  60. 1 1
      src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayTradeType.cs
  61. 1 1
      src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayUserState.cs

+ 2 - 2
Directory.Build.props

@@ -1,8 +1,8 @@
 <Project>
   
   <PropertyGroup>
-    <Version>3.0.0</Version>
-    <NoWarn>$(NoWarn);CS1570;CS1591</NoWarn>
+    <Version>3.1.0</Version>
+    <NoWarn>$(NoWarn);CS1570;CS1591;CA1031;IDE0063</NoWarn>
     <Description>Essensoft.AspNetCore.Payment</Description>
     <Copyright>© Essensoft 2019</Copyright>
     <PackageIconUrl>https://raw.githubusercontent.com/essensoft/media/master/images/nuget/payment.png</PackageIconUrl>

+ 1 - 1
samples/WebApplicationSample/Program.cs

@@ -3,7 +3,7 @@ using Microsoft.Extensions.Hosting;
 
 namespace WebApplicationSample
 {
-    public class Program
+    public static class Program
     {
         public static void Main(string[] args)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Alipay/AlipayCertificateManager.cs

@@ -7,7 +7,7 @@ namespace Essensoft.AspNetCore.Payment.Alipay
         /// <summary>
         /// 不同支付宝公钥证书序列号对应的公钥内容
         /// </summary>
-        private ConcurrentDictionary<string, string> _SN2PublicKey = new ConcurrentDictionary<string, string>();
+        private readonly ConcurrentDictionary<string, string> _SN2PublicKey = new ConcurrentDictionary<string, string>();
 
         public bool IsEmpty => _SN2PublicKey.IsEmpty;
 

+ 8 - 0
src/Essensoft.AspNetCore.Payment.Alipay/AlipayException.cs

@@ -7,8 +7,16 @@ namespace Essensoft.AspNetCore.Payment.Alipay
     /// </summary>
     public class AlipayException : Exception
     {
+        public AlipayException()
+        {
+        }
+
         public AlipayException(string messages) : base(messages)
         {
         }
+
+        public AlipayException(string message, Exception innerException) : base(message, innerException)
+        {
+        }
     }
 }

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Alipay/AlipayNotifyClient.cs

@@ -90,7 +90,7 @@ namespace Essensoft.AspNetCore.Payment.Alipay
             }
         }
 
-        private string GetSignContent(IDictionary<string, string> dictionary)
+        private static string GetSignContent(IDictionary<string, string> dictionary)
         {
             if (dictionary == null || dictionary.Count == 0)
             {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Alipay/AlipayNotifyResult.cs

@@ -7,7 +7,7 @@ namespace Essensoft.AspNetCore.Payment.Alipay
     /// <summary>
     /// Alipay 通知响应
     /// </summary>
-    public class AlipayNotifyResult
+    public static class AlipayNotifyResult
     {
         private static readonly ContentResult _success = new ContentResult { Content = "success", ContentType = "text/plain", StatusCode = 200 };
         private static readonly ContentResult _failure = new ContentResult { Content = "failure", ContentType = "text/plain", StatusCode = 200 };

+ 2 - 2
src/Essensoft.AspNetCore.Payment.Alipay/Utility/AlipaySignature.cs

@@ -5,7 +5,7 @@ using Essensoft.AspNetCore.Payment.Security;
 
 namespace Essensoft.AspNetCore.Payment.Alipay.Utility
 {
-    public class AlipaySignature
+    public static class AlipaySignature
     {
         public static readonly byte[] AES_IV = InitIv(16);
 
@@ -85,7 +85,7 @@ namespace Essensoft.AspNetCore.Payment.Alipay.Utility
             var endIndex = ExtractEndPosition(str, beginIndex);
             return new SignSourceData()
             {
-                SourceData = str.Substring(beginIndex, endIndex - beginIndex),
+                SourceData = str[beginIndex..endIndex],
                 BeginIndex = beginIndex,
                 EndIndex = endIndex
             };

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Alipay/Utility/AntCertificationUtil.cs

@@ -12,7 +12,7 @@ namespace Essensoft.AspNetCore.Payment.Alipay.Utility
     /// <summary>
     /// 证书相关工具类
     /// </summary>
-    public class AntCertificationUtil
+    public static class AntCertificationUtil
     {
         /// <summary>
         /// 提取根证书序列号

+ 3 - 3
src/Essensoft.AspNetCore.Payment.Alipay/Utility/FileItem.cs

@@ -48,12 +48,12 @@ namespace Essensoft.AspNetCore.Payment.Alipay.Utility
         {
             if (string.IsNullOrEmpty(fileName))
             {
-                throw new ArgumentNullException("fileName");
+                throw new ArgumentNullException(nameof(fileName));
             }
 
             if (content == null || content.Length == 0)
             {
-                throw new ArgumentNullException("content");
+                throw new ArgumentNullException(nameof(content));
             }
 
             this.fileName = fileName;
@@ -71,7 +71,7 @@ namespace Essensoft.AspNetCore.Payment.Alipay.Utility
         {
             if (string.IsNullOrEmpty(mimeType))
             {
-                throw new ArgumentNullException("mimeType");
+                throw new ArgumentNullException(nameof(mimeType));
             }
 
             this.mimeType = mimeType;

+ 8 - 0
src/Essensoft.AspNetCore.Payment.JDPay/JDPayException.cs

@@ -7,8 +7,16 @@ namespace Essensoft.AspNetCore.Payment.JDPay
     /// </summary>
     public class JDPayException : Exception
     {
+        public JDPayException()
+        {
+        }
+
         public JDPayException(string messages) : base(messages)
         {
         }
+
+        public JDPayException(string message, Exception innerException) : base(message, innerException)
+        {
+        }
     }
 }

+ 1 - 1
src/Essensoft.AspNetCore.Payment.JDPay/JDPayNotifyClient.cs

@@ -163,7 +163,7 @@ namespace Essensoft.AspNetCore.Payment.JDPay
                 throw new JDPayException("sign check fail: dictionary is Empty!");
             }
 
-            if (!dictionary.TryGetValue(JDPayContants.SIGN_DATA, out var sign_data))
+            if (!dictionary.TryGetValue(JDPayContants.SIGN_DATA, out _))
             {
                 throw new JDPayException("sign check fail: sign is Empty!");
             }

+ 1 - 1
src/Essensoft.AspNetCore.Payment.JDPay/JDPayNotifyResult.cs

@@ -7,7 +7,7 @@ namespace Essensoft.AspNetCore.Payment.JDPay
     /// <summary>
     /// JDPay 通知应答。
     /// </summary>
-    public class JDPayNotifyResult
+    public static class JDPayNotifyResult
     {
         private static readonly ContentResult _success = new ContentResult { Content = "success", ContentType = "text/plain", StatusCode = 200 };
         private static readonly ContentResult _ok = new ContentResult { Content = "ok", ContentType = "text/plain", StatusCode = 200 };

+ 3 - 8
src/Essensoft.AspNetCore.Payment.JDPay/Utility/JDPaySecurity.cs

@@ -20,7 +20,7 @@ namespace Essensoft.AspNetCore.Payment.JDPay.Utility
     /// <summary>
     /// JDPay 安全类。
     /// </summary>
-    public class JDPaySecurity
+    public static class JDPaySecurity
     {
         private const int MAX_MSG_LENGTH = 16 * 1024;
         private static readonly byte[] iv = { 1, 2, 3, 4, 5, 6, 7, 8 };
@@ -197,7 +197,6 @@ namespace Essensoft.AspNetCore.Payment.JDPay.Utility
                 b2[n / 2] = (byte)Convert.ToInt32(item, 16);
             }
 
-            b = null;
             return b2;
         }
 
@@ -218,11 +217,9 @@ namespace Essensoft.AspNetCore.Payment.JDPay.Utility
             var digital = "0123456789abcdef";
             var hex2char = hex.ToCharArray();
             var bytes = new byte[hex.Length / 2];
-            var temp = 0;
-
             for (var i = 0; i < bytes.Length; i++)
             {
-                temp = digital.IndexOf(hex2char[2 * i]) * 16;
+                var temp = digital.IndexOf(hex2char[2 * i]) * 16;
                 temp += digital.IndexOf(hex2char[2 * i + 1]);
                 bytes[i] = (byte)(temp & 0xff);
             }
@@ -254,11 +251,9 @@ namespace Essensoft.AspNetCore.Payment.JDPay.Utility
             var srcStr = stringBuilder.ToString();
             var chars = srcStr.ToCharArray();
             var bytes = new byte[srcStr.Length / 2];
-            var temp = 0;
-
             for (var i = 0; i < bytes.Length; i++)
             {
-                temp = hexstring.IndexOf(chars[2 * i]) << 4;
+                var temp = hexstring.IndexOf(chars[2 * i]) << 4;
                 temp += hexstring.IndexOf(chars[2 * i + 1]);
                 bytes[i] = (byte)(temp & 0xff);
             }

+ 8 - 0
src/Essensoft.AspNetCore.Payment.LianLianPay/LianLianPayException.cs

@@ -7,8 +7,16 @@ namespace Essensoft.AspNetCore.Payment.LianLianPay
     /// </summary>
     public class LianLianPayException : Exception
     {
+        public LianLianPayException()
+        {
+        }
+
         public LianLianPayException(string messages) : base(messages)
         {
         }
+
+        public LianLianPayException(string message, Exception innerException) : base(message, innerException)
+        {
+        }
     }
 }

+ 1 - 1
src/Essensoft.AspNetCore.Payment.LianLianPay/LianLianPayNotifyResult.cs

@@ -7,7 +7,7 @@ namespace Essensoft.AspNetCore.Payment.LianLianPay
     /// <summary>
     /// LianLianPay 通知应答。
     /// </summary>
-    public class LianLianPayNotifyResult
+    public static class LianLianPayNotifyResult
     {
         private static readonly ContentResult _success = new ContentResult { Content = "{\"ret_code\":\"0000\",\"ret_msg\":\"交易成功\"}", ContentType = "application/json", StatusCode = 200 };
         private static readonly ContentResult _failure = new ContentResult { Content = "{\"ret_code\":\"9999\",\"ret_msg\":\"交易失败\"}", ContentType = "application/json", StatusCode = 200 };

+ 1 - 1
src/Essensoft.AspNetCore.Payment.LianLianPay/Utility/LianLianPaySecurity.cs

@@ -9,7 +9,7 @@ namespace Essensoft.AspNetCore.Payment.LianLianPay.Utility
     /// <summary>
     /// LianLianPay 安全类。
     /// </summary>
-    public class LianLianPaySecurity
+    public static class LianLianPaySecurity
     {
         public static string GetSignContent(LianLianPayDictionary dictionary, List<string> exclude = null)
         {

+ 5 - 5
src/Essensoft.AspNetCore.Payment.QPay/Parser/QPayListPropertyParser.cs

@@ -7,9 +7,9 @@ using System.Xml.Serialization;
 
 namespace Essensoft.AspNetCore.Payment.QPay.Parser
 {
-    public class QPayListPropertyParser
+    public static class QPayListPropertyParser
     {
-        public List<T> Parse<T>(QPayDictionary dictionary) where T : new()
+        public static List<T> Parse<T>(QPayDictionary dictionary) where T : new()
         {
             var list = new List<T>();
             var properties = typeof(T).GetProperties();
@@ -33,7 +33,7 @@ namespace Essensoft.AspNetCore.Payment.QPay.Parser
             return list;
         }
 
-        public List<T> Parse<T, TChildren>(QPayDictionary dictionary) where T : new() where TChildren : new()
+        public static List<T> Parse<T, TChildren>(QPayDictionary dictionary) where T : new() where TChildren : new()
         {
             var list = new List<T>();
             var properties = typeof(T).GetProperties();
@@ -83,7 +83,7 @@ namespace Essensoft.AspNetCore.Payment.QPay.Parser
             return list;
         }
 
-        public List<T> Parse<T, TChildren>(QPayDictionary dictionary, int index) where T : new() where TChildren : new()
+        public static List<T> Parse<T, TChildren>(QPayDictionary dictionary, int index) where T : new() where TChildren : new()
         {
             var flag = true;
             var list = new List<T>();
@@ -138,7 +138,7 @@ namespace Essensoft.AspNetCore.Payment.QPay.Parser
             return list;
         }
 
-        private string GetKeyName(PropertyInfo item)
+        private static string GetKeyName(PropertyInfo item)
         {
             var key = item.GetCustomAttributes(typeof(XmlElementAttribute), true);
             if (key.Length > 0)

+ 1 - 1
src/Essensoft.AspNetCore.Payment.QPay/QPayCode.cs

@@ -1,6 +1,6 @@
 namespace Essensoft.AspNetCore.Payment.QPay
 {
-    public class QPayCode
+    public static class QPayCode
     {
         /// <summary>
         /// 成功

+ 8 - 0
src/Essensoft.AspNetCore.Payment.QPay/QPayException.cs

@@ -4,8 +4,16 @@ namespace Essensoft.AspNetCore.Payment.QPay
 {
     public class QPayException : Exception
     {
+        public QPayException()
+        {
+        }
+
         public QPayException(string messages) : base(messages)
         {
         }
+
+        public QPayException(string message, Exception innerException) : base(message, innerException)
+        {
+        }
     }
 }

+ 1 - 1
src/Essensoft.AspNetCore.Payment.QPay/QPayNotifyResult.cs

@@ -7,7 +7,7 @@ namespace Essensoft.AspNetCore.Payment.QPay
     /// <summary>
     /// QPay 通知应答。
     /// </summary>
-    public class QPayNotifyResult
+    public static class QPayNotifyResult
     {
         private static readonly ContentResult _success = new ContentResult { Content = "<xml><return_code>SUCCESS</return_code></xml>", ContentType = "text/xml", StatusCode = 200 };
         private static readonly ContentResult _failure = new ContentResult { Content = "<xml><return_code>FAIL</return_code></xml>", ContentType = "text/xml", StatusCode = 200 };

+ 1 - 1
src/Essensoft.AspNetCore.Payment.QPay/QPayTradeStates.cs

@@ -1,6 +1,6 @@
 namespace Essensoft.AspNetCore.Payment.QPay
 {
-    public class QPayTradeStates
+    public static class QPayTradeStates
     {
         /// <summary>
         /// 成功

+ 1 - 1
src/Essensoft.AspNetCore.Payment.QPay/QPayTradeType.cs

@@ -1,6 +1,6 @@
 namespace Essensoft.AspNetCore.Payment.QPay
 {
-    public class QPayTradeType
+    public static class QPayTradeType
     {
         /// <summary>
         /// 公众号支付

+ 1 - 2
src/Essensoft.AspNetCore.Payment.QPay/Response/QPayRefundQueryResponse.cs

@@ -124,8 +124,7 @@ namespace Essensoft.AspNetCore.Payment.QPay.Response
 
         internal override void Execute()
         {
-            var parser = new QPayListPropertyParser();
-            RefundInfos = parser.Parse<RefundInfo>(ResponseParameters);
+            RefundInfos = QPayListPropertyParser.Parse<RefundInfo>(ResponseParameters);
         }
     }
 }

+ 1 - 1
src/Essensoft.AspNetCore.Payment.QPay/Utility/QPaySignature.cs

@@ -3,7 +3,7 @@ using Essensoft.AspNetCore.Payment.Security;
 
 namespace Essensoft.AspNetCore.Payment.QPay.Utility
 {
-    public class QPaySignature
+    public static class QPaySignature
     {
         public static string SignWithKey(QPayDictionary dictionary, string key)
         {

+ 2 - 2
src/Essensoft.AspNetCore.Payment.QPay/Utility/QPayUtility.cs

@@ -36,7 +36,7 @@ namespace Essensoft.AspNetCore.Payment.QPay.Utility
                 return null;
             }
 
-            if (str == string.Empty)
+            if (string.IsNullOrEmpty(str))
             {
                 return string.Empty;
             }
@@ -66,7 +66,7 @@ namespace Essensoft.AspNetCore.Payment.QPay.Utility
         {
             if (str == null)
             {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
 
             if (str.Length < len)

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/AES.cs

@@ -4,7 +4,7 @@ using System.Text;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class AES
+    public static class AES
     {
         public static string Encrypt(string data, string key, byte[] iv, CipherMode cipherMode, PaddingMode paddingMode)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/AES_CTR_NoPadding.cs

@@ -5,7 +5,7 @@ using Org.BouncyCastle.Security;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class AES_CTR_NoPadding
+    public static class AES_CTR_NoPadding
     {
         public static byte[] Encrypt(byte[] data, byte[] key, byte[] iv)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/HMACSHA256.cs

@@ -3,7 +3,7 @@ using System.Text;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class HMACSHA256
+    public static class HMACSHA256
     {
         public static string Compute(string data, string key)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/MD5.cs

@@ -3,7 +3,7 @@ using System.Text;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class MD5
+    public static class MD5
     {
         public static string Compute(string data)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/MD5WithRSA.cs

@@ -5,7 +5,7 @@ using Org.BouncyCastle.Security;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class MD5WithRSA
+    public static class MD5WithRSA
     {
         public static string SignData(string data, ICipherParameters key)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/RSAUtilities.cs

@@ -9,7 +9,7 @@ using Org.BouncyCastle.Security;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class RSAUtilities
+    public static class RSAUtilities
     {
         public static ICipherParameters GetKeyParameterFormPrivateKey(string privateKey)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/RSA_ECB_OAEPWithSHA1AndMGF1Padding.cs

@@ -5,7 +5,7 @@ using Org.BouncyCastle.Security;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class RSA_ECB_OAEPWithSHA1AndMGF1Padding
+    public static class RSA_ECB_OAEPWithSHA1AndMGF1Padding
     {
         public const string ALGORITHM = "RSA/ECB/OAEPWithSHA1AndMGF1Padding";
 

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/RSA_ECB_PKCS1Padding.cs

@@ -5,7 +5,7 @@ using Org.BouncyCastle.Security;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class RSA_ECB_PKCS1Padding
+    public static class RSA_ECB_PKCS1Padding
     {
         public static byte[] Encrypt(byte[] data, ICipherParameters key)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/RSA_NONE_PKCS1Padding.cs

@@ -5,7 +5,7 @@ using Org.BouncyCastle.Security;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class RSA_NONE_PKCS1Padding
+    public static class RSA_NONE_PKCS1Padding
     {
         public static byte[] Encrypt(byte[] data, ICipherParameters key)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/SHA1.cs

@@ -3,7 +3,7 @@ using System.Text;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class SHA1
+    public static class SHA1
     {
         public static string Compute(string data)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/SHA1WithRSA.cs

@@ -4,7 +4,7 @@ using System.Text;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class SHA1WithRSA
+    public static class SHA1WithRSA
     {
         public static string Sign(string data, RSAParameters privateKey)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/SHA256.cs

@@ -3,7 +3,7 @@ using System.Text;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class SHA256
+    public static class SHA256
     {
         public static string Compute(string data)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/SHA256WithRSA.cs

@@ -6,7 +6,7 @@ using Org.BouncyCastle.Security;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class SHA256WithRSA
+    public static class SHA256WithRSA
     {
         public static string Sign(string data, RSAParameters privateKey)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/SM3.cs

@@ -5,7 +5,7 @@ using Org.BouncyCastle.Security;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class SM3
+    public static class SM3
     {
         public static string Compute(string data)
         {

+ 1 - 1
src/Essensoft.AspNetCore.Payment.Security/TripleDES.cs

@@ -3,7 +3,7 @@ using System.Security.Cryptography;
 
 namespace Essensoft.AspNetCore.Payment.Security
 {
-    public class TripleDES
+    public static class TripleDES
     {
         public static byte[] Encode(byte[] data, byte[] key, byte[] iv, CipherMode cipherMode, PaddingMode paddingMode)
         {

+ 8 - 0
src/Essensoft.AspNetCore.Payment.UnionPay/UnionPayException.cs

@@ -7,8 +7,16 @@ namespace Essensoft.AspNetCore.Payment.UnionPay
     /// </summary>
     public class UnionPayException : Exception
     {
+        public UnionPayException()
+        {
+        }
+
         public UnionPayException(string messages) : base(messages)
         {
         }
+
+        public UnionPayException(string message, Exception innerException) : base(message, innerException)
+        {
+        }
     }
 }

+ 1 - 1
src/Essensoft.AspNetCore.Payment.UnionPay/UnionPayNotifyResult.cs

@@ -7,7 +7,7 @@ namespace Essensoft.AspNetCore.Payment.UnionPay
     /// <summary>
     /// UnionPay 通知应答
     /// </summary>
-    public class UnionPayNotifyResult
+    public static class UnionPayNotifyResult
     {
         private static readonly ContentResult _success = new ContentResult { StatusCode = 200 };
         private static readonly ContentResult _failure = new ContentResult { StatusCode = 202 };

+ 3 - 3
src/Essensoft.AspNetCore.Payment.UnionPay/Utility/UnionPaySignature.cs

@@ -17,9 +17,9 @@ namespace Essensoft.AspNetCore.Payment.UnionPay.Utility
     /// <summary>
     /// UnionPay 签名类。
     /// </summary>
-    public class UnionPaySignature
+    public static class UnionPaySignature
     {
-        private static readonly string UNIONPAY_CNNAME = "中国银联股份有限公司";
+        private const string UNIONPAY_CNNAME = "中国银联股份有限公司";
 
         private static readonly Dictionary<string, X509Certificate> validateCerts = new Dictionary<string, X509Certificate>();
 
@@ -58,7 +58,7 @@ namespace Essensoft.AspNetCore.Payment.UnionPay.Utility
             }
 
             var signMethod = dictionary["signMethod"];
-            var result = false;
+            bool result;
 
             if ("01" == signMethod)
             {

+ 1 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Notify/WeChatPayPartnerPAPPayApplyNotify.cs

@@ -202,8 +202,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Notify
         /// </summary>
         internal override void Execute()
         {
-            var parser = new WeChatPayListPropertyParser();
-            CouponInfos = parser.Parse<CouponInfo>(ResponseParameters);
+            CouponInfos = WeChatPayListPropertyParser.Parse<CouponInfo>(ResponseParameters);
         }
     }
 }

+ 1 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Notify/WeChatPayTransitPartnerPayPayApplyNotify.cs

@@ -208,8 +208,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Notify
         /// </summary>
         internal override void Execute()
         {
-            var parser = new WeChatPayListPropertyParser();
-            CouponInfos = parser.Parse<CouponInfo>(ResponseParameters);
+            CouponInfos = WeChatPayListPropertyParser.Parse<CouponInfo>(ResponseParameters);
         }
     }
 }

+ 1 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Notify/WeChatPayUnifiedOrderNotify.cs

@@ -196,8 +196,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Notify
         /// </summary>
         internal override void Execute()
         {
-            var parser = new WeChatPayListPropertyParser();
-            CouponInfos = parser.Parse<CouponInfo>(ResponseParameters);
+            CouponInfos = WeChatPayListPropertyParser.Parse<CouponInfo>(ResponseParameters);
         }
     }
 }

+ 1 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Notify/WeChatPayVehiclePartnerPayPayApplyNotify.cs

@@ -202,8 +202,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Notify
         /// </summary>
         internal override void Execute()
         {
-            var parser = new WeChatPayListPropertyParser();
-            CouponInfos = parser.Parse<CouponInfo>(ResponseParameters);
+            CouponInfos = WeChatPayListPropertyParser.Parse<CouponInfo>(ResponseParameters);
         }
     }
 }

+ 5 - 5
src/Essensoft.AspNetCore.Payment.WeChatPay/Parser/WeChatPayListPropertyParser.cs

@@ -7,9 +7,9 @@ using System.Xml.Serialization;
 
 namespace Essensoft.AspNetCore.Payment.WeChatPay.Parser
 {
-    public class WeChatPayListPropertyParser
+    public static class WeChatPayListPropertyParser
     {
-        public List<T> Parse<T>(WeChatPayDictionary dictionary) where T : new()
+        public static List<T> Parse<T>(WeChatPayDictionary dictionary) where T : new()
         {
             var list = new List<T>();
             var properties = typeof(T).GetProperties();
@@ -33,7 +33,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Parser
             return list;
         }
 
-        public List<T> Parse<T, TChildren>(WeChatPayDictionary dictionary) where T : new() where TChildren : new()
+        public static List<T> Parse<T, TChildren>(WeChatPayDictionary dictionary) where T : new() where TChildren : new()
         {
             var list = new List<T>();
             var properties = typeof(T).GetProperties();
@@ -83,7 +83,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Parser
             return list;
         }
 
-        public List<T> Parse<T, TChildren>(WeChatPayDictionary dictionary, int index) where T : new() where TChildren : new()
+        public static List<T> Parse<T, TChildren>(WeChatPayDictionary dictionary, int index) where T : new() where TChildren : new()
         {
             var flag = true;
             var list = new List<T>();
@@ -138,7 +138,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Parser
             return list;
         }
 
-        private string GetKeyName(PropertyInfo item)
+        private static string GetKeyName(PropertyInfo item)
         {
             var key = item.GetCustomAttributes(typeof(XmlElementAttribute), true);
             if (key.Length > 0)

+ 1 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayOrderQueryResponse.cs

@@ -211,8 +211,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Response
         /// </summary>
         internal override void Execute()
         {
-            var parser = new WeChatPayListPropertyParser();
-            CouponInfos = parser.Parse<CouponInfo>(ResponseParameters);
+            CouponInfos = WeChatPayListPropertyParser.Parse<CouponInfo>(ResponseParameters);
         }
     }
 }

+ 1 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayPartnerPAPOrderQueryResponse.cs

@@ -205,8 +205,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Response
         /// </summary>
         internal override void Execute()
         {
-            var parser = new WeChatPayListPropertyParser();
-            CouponInfos = parser.Parse<CouponInfo>(ResponseParameters);
+            CouponInfos = WeChatPayListPropertyParser.Parse<CouponInfo>(ResponseParameters);
         }
     }
 }

+ 1 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayRefundQueryResponse.cs

@@ -133,8 +133,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Response
         /// </summary>
         internal override void Execute()
         {
-            var parser = new WeChatPayListPropertyParser();
-            RefundInfos = parser.Parse<RefundInfo, CouponRefundInfo>(ResponseParameters);
+            RefundInfos = WeChatPayListPropertyParser.Parse<RefundInfo, CouponRefundInfo>(ResponseParameters);
         }
     }
 }

+ 1 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayRefundResponse.cs

@@ -163,8 +163,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Response
         /// </summary>
         internal override void Execute()
         {
-            var parser = new WeChatPayListPropertyParser();
-            CouponRefundInfos = parser.Parse<CouponRefundInfo>(ResponseParameters);
+            CouponRefundInfos = WeChatPayListPropertyParser.Parse<CouponRefundInfo>(ResponseParameters);
         }
     }
 }

+ 1 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Response/WeChatPayTransitPartnerPayQueryOrderResponse.cs

@@ -199,8 +199,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Response
         /// </summary>
         internal override void Execute()
         {
-            var parser = new WeChatPayListPropertyParser();
-            CouponInfos = parser.Parse<CouponInfo>(ResponseParameters);
+            CouponInfos = WeChatPayListPropertyParser.Parse<CouponInfo>(ResponseParameters);
         }
     }
 }

+ 1 - 1
src/Essensoft.AspNetCore.Payment.WeChatPay/Utility/WeChatPaySignature.cs

@@ -4,7 +4,7 @@ using Essensoft.AspNetCore.Payment.Security;
 
 namespace Essensoft.AspNetCore.Payment.WeChatPay.Utility
 {
-    public class WeChatPaySignature
+    public static class WeChatPaySignature
     {
         public static string SignWithKey(WeChatPayDictionary dictionary, string key, WeChatPaySignType signType)
         {

+ 2 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/Utility/WeChatPayUtility.cs

@@ -64,7 +64,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Utility
                 return null;
             }
 
-            if (str == string.Empty)
+            if (string.IsNullOrEmpty(str))
             {
                 return string.Empty;
             }
@@ -94,7 +94,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Utility
         {
             if (str == null)
             {
-                throw new ArgumentNullException("str");
+                throw new ArgumentNullException(nameof(str));
             }
 
             if (str.Length < len)

+ 1 - 1
src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayCode.cs

@@ -1,6 +1,6 @@
 namespace Essensoft.AspNetCore.Payment.WeChatPay
 {
-    public class WeChatPayCode
+    public static class WeChatPayCode
     {
         /// <summary>
         /// 成功

+ 8 - 0
src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayException.cs

@@ -4,8 +4,16 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay
 {
     public class WeChatPayException : Exception
     {
+        public WeChatPayException()
+        {
+        }
+
         public WeChatPayException(string messages) : base(messages)
         {
         }
+
+        public WeChatPayException(string message, Exception innerException) : base(message, innerException)
+        {
+        }
     }
 }

+ 1 - 1
src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayNotifyResult.cs

@@ -7,7 +7,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay
     /// <summary>
     /// WeChatPay 通知应答。
     /// </summary>
-    public class WeChatPayNotifyResult
+    public static class WeChatPayNotifyResult
     {
         private static readonly ContentResult _success = new ContentResult { Content = "<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>", ContentType = "text/xml", StatusCode = 200 };
         private static readonly ContentResult _failure = new ContentResult { Content = "<xml><return_code><![CDATA[FAIL]]></return_code></xml>", ContentType = "text/xml", StatusCode = 200 };

+ 1 - 1
src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayTradeScene.cs

@@ -3,7 +3,7 @@
     /// <summary>
     /// 交易场景
     /// </summary>
-    public class WeChatPayTradeScene
+    public static class WeChatPayTradeScene
     {
         /// <summary>
         /// 车场停车场景

+ 1 - 1
src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayTradeType.cs

@@ -3,7 +3,7 @@
     /// <summary>
     /// 交易类型
     /// </summary>
-    public class WeChatPayTradeType
+    public static class WeChatPayTradeType
     {
         /// <summary>
         /// 公众号支付/小程序支付

+ 1 - 1
src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayUserState.cs

@@ -3,7 +3,7 @@
     /// <summary>
     /// 用户状态
     /// </summary>
-    public class WeChatPayUserState
+    public static class WeChatPayUserState
     {
         /// <summary>
         /// 正常用户,已开通车主服务,且已授权访问