浏览代码

[Alipay] 修正'Encrypt'拼写错误 closed #131

roc 3 年之前
父节点
当前提交
adb8c5b8e8

+ 14 - 14
src/Essensoft.Paylink.Alipay/AlipayClient.cs

@@ -237,20 +237,20 @@ namespace Essensoft.Paylink.Alipay
                     throw new AlipayException("api request Fail ! The reason: encrypt request is not supported!");
                 }
 
-                if (string.IsNullOrEmpty(options.EncyptKey) || string.IsNullOrEmpty(options.EncyptType))
+                if (string.IsNullOrEmpty(options.EncryptKey) || string.IsNullOrEmpty(options.EncryptType))
                 {
                     throw new AlipayException("encryptType or encryptKey must not null!");
                 }
 
-                if (!"AES".Equals(options.EncyptType))
+                if (!"AES".Equals(options.EncryptType))
                 {
                     throw new AlipayException("api only support Aes!");
                 }
 
-                var encryptContent = AlipaySignature.AESEncrypt(txtParams[AlipayConstants.BIZ_CONTENT], options.EncyptKey);
+                var encryptContent = AlipaySignature.AESEncrypt(txtParams[AlipayConstants.BIZ_CONTENT], options.EncryptKey);
                 txtParams.Remove(AlipayConstants.BIZ_CONTENT);
                 txtParams.Add(AlipayConstants.BIZ_CONTENT, encryptContent);
-                txtParams.Add(AlipayConstants.ENCRYPT_TYPE, options.EncyptType);
+                txtParams.Add(AlipayConstants.ENCRYPT_TYPE, options.EncryptType);
             }
 
             // 添加签名参数
@@ -273,7 +273,7 @@ namespace Essensoft.Paylink.Alipay
             }
 
             var parser = new AlipayJsonParser<T>();
-            var item = ParseRespItem(request, body, parser, options.EncyptKey, options.EncyptType);
+            var item = ParseRespItem(request, body, parser, options.EncryptKey, options.EncryptType);
             var rsp = parser.Parse(item.RealContent);
 
             CheckResponseSign(request, item.RespContent, rsp.IsError, parser, options);
@@ -422,20 +422,20 @@ namespace Essensoft.Paylink.Alipay
                     throw new AlipayException("api request Fail ! The reason: encrypt request is not supported!");
                 }
 
-                if (string.IsNullOrEmpty(options.EncyptKey) || string.IsNullOrEmpty(options.EncyptType))
+                if (string.IsNullOrEmpty(options.EncryptKey) || string.IsNullOrEmpty(options.EncryptType))
                 {
                     throw new AlipayException("encryptType or encryptKey must not null!");
                 }
 
-                if (!"AES".Equals(options.EncyptType))
+                if (!"AES".Equals(options.EncryptType))
                 {
                     throw new AlipayException("api only support Aes!");
                 }
 
-                var encryptContent = AlipaySignature.AESEncrypt(txtParams[AlipayConstants.BIZ_CONTENT], options.EncyptKey);
+                var encryptContent = AlipaySignature.AESEncrypt(txtParams[AlipayConstants.BIZ_CONTENT], options.EncryptKey);
                 txtParams.Remove(AlipayConstants.BIZ_CONTENT);
                 txtParams.Add(AlipayConstants.BIZ_CONTENT, encryptContent);
-                txtParams.Add(AlipayConstants.ENCRYPT_TYPE, options.EncyptType);
+                txtParams.Add(AlipayConstants.ENCRYPT_TYPE, options.EncryptType);
             }
 
             // 添加签名参数
@@ -458,7 +458,7 @@ namespace Essensoft.Paylink.Alipay
             }
 
             var parser = new AlipayJsonParser<T>();
-            var item = ParseRespItem(request, body, parser, options.EncyptKey, options.EncyptType);
+            var item = ParseRespItem(request, body, parser, options.EncryptKey, options.EncryptType);
             var rsp = parser.Parse(item.RealContent);
 
             await CheckResponseCertSignAsync(request, item.RespContent, rsp.IsError, parser, options);
@@ -573,20 +573,20 @@ namespace Essensoft.Paylink.Alipay
                     throw new AlipayException("api request Fail ! The reason: encrypt request is not supported!");
                 }
 
-                if (string.IsNullOrEmpty(options.EncyptKey) || string.IsNullOrEmpty(options.EncyptType))
+                if (string.IsNullOrEmpty(options.EncryptKey) || string.IsNullOrEmpty(options.EncryptType))
                 {
                     throw new AlipayException("encryptType or encryptKey must not null!");
                 }
 
-                if (!"AES".Equals(options.EncyptType))
+                if (!"AES".Equals(options.EncryptType))
                 {
                     throw new AlipayException("api only support Aes!");
                 }
 
-                var encryptContent = AlipaySignature.AESEncrypt(result[AlipayConstants.BIZ_CONTENT], options.EncyptKey);
+                var encryptContent = AlipaySignature.AESEncrypt(result[AlipayConstants.BIZ_CONTENT], options.EncryptKey);
                 result.Remove(AlipayConstants.BIZ_CONTENT);
                 result.Add(AlipayConstants.BIZ_CONTENT, encryptContent);
-                result.Add(AlipayConstants.ENCRYPT_TYPE, options.EncyptType);
+                result.Add(AlipayConstants.ENCRYPT_TYPE, options.EncryptType);
             }
 
             return result;

+ 2 - 2
src/Essensoft.Paylink.Alipay/AlipayOptions.cs

@@ -80,12 +80,12 @@ namespace Essensoft.Paylink.Alipay
         /// <remarks>
         /// 默认为:"AES"
         /// </remarks>
-        public string EncyptType { get; } = "AES";
+        public string EncryptType { get; } = "AES";
 
         /// <summary>
         /// 加密秘钥
         /// </summary>
-        public string EncyptKey { get; set; }
+        public string EncryptKey { get; set; }
 
         /// <summary>
         /// 应用公钥证书

+ 4 - 4
src/Essensoft.Paylink.Alipay/Utility/AlipaySignature.cs

@@ -49,14 +49,14 @@ namespace Essensoft.Paylink.Alipay.Utility
             };
         }
 
-        public static string AESEncrypt(string data, string encyptKey)
+        public static string AESEncrypt(string data, string encryptKey)
         {
-            return AES.Encrypt(data, encyptKey, AES_IV, CipherMode.CBC, PaddingMode.PKCS7);
+            return AES.Encrypt(data, encryptKey, AES_IV, CipherMode.CBC, PaddingMode.PKCS7);
         }
 
-        public static string AESDencrypt(string data, string encyptKey)
+        public static string AESDencrypt(string data, string encryptKey)
         {
-            return AES.Decrypt(data, encyptKey, AES_IV, CipherMode.CBC, PaddingMode.PKCS7);
+            return AES.Decrypt(data, encryptKey, AES_IV, CipherMode.CBC, PaddingMode.PKCS7);
         }
 
         private static byte[] InitIv(int blockSize)