浏览代码

优化配置选项提示注释

Roc 5 年之前
父节点
当前提交
5c28a24071

+ 37 - 15
samples/WebApplicationSample/appsettings.Development.json

@@ -7,56 +7,78 @@
     }
   },
 
-  // 开发环境配置
+  // 正式环境配置:appsettings.json
+  // 开发环境配置:appsettings.Development.json
 
+  // 微信支付
+  // 更多配置,请查看WeChatPayOptions类
   "WeChatPay": {
     // 应用号
-    // 微信公众平台AppId / 微信开放平台AppId / 微信小程序AppId / 企业微信CorpId
+    // 如:微信公众平台AppId、微信开放平台AppId、微信小程序AppId、企业微信CorpId等
     "AppId": "",
 
-    // 微信支付商户号
+    // 商户号
+    // 为微信支付商户平台的商户号
     "MchId": "",
 
-    // API秘钥,不是APIv3密钥
+    // API密钥
+    // 为微信支付商户平台的API密钥,请注意不是APIv3密钥
     "Key": "",
 
-    // API证书 .p12
+    // API证书(.p12扩展名)
+    // 为微信支付商户平台的API证书
+    // 可为文件路径 / 文件的base64字符串
     "Certificate": "",
 
-    // RSA公钥 (目前仅"企业付款到银行卡API"使用,调用"获取RSA加密公钥API"即可获取)
+    // RSA公钥
+    // 目前仅调用"企业付款到银行卡API"时使用,执行本示例中的"获取RSA加密公钥API"即可获取。
     "RsaPublicKey": ""
   },
+
+  // 支付宝
+  // 更多配置,请查看AlipayOptions类
   "Alipay": {
 
     // 注意: 
-    // 示例默认的加签方式为公钥证书,默认调用 CertificateExecuteAsync 方法 执行请求。
-    // 不使用公钥证书,除了遵守配置选项规则外,CertificateExecuteAsync 方法 需要改成 ExecuteAsync 方法。
+    // 若涉及资金类支出接口(如转账、红包等)接入,必须使用“公钥证书”方式。不涉及到资金类接口,也可以使用“普通公钥”方式进行加签。
+    // 本示例默认的加签方式为“公钥证书”方式,并调用 CertificateExecuteAsync 方法 执行API。
+    // 若使用“普通公钥”方式,除了遵守下方注释的规则外,调用 CertificateExecuteAsync 也需改成 ExecuteAsync。
+    // 支付宝后台密钥/证书官方配置教程:https://opendocs.alipay.com/open/291/105971
 
-    // 应用ID
+    // 支付宝应用Id
     "AppId": "",
 
-    // RSA 支付宝公钥,加签方式为公钥证书时,留空
+    // RSA 支付宝公钥
+    // “公钥证书”方式时,留空
+    // “普通公钥”方式时,必填
     "AlipayPublicKey": "",
 
-    // RSA 应用私钥,加签方式为公钥证书时,为证书私钥
+    // RSA 应用私钥
     "AppPrivateKey": "",
 
-    // 网关地址,默认正式环境
+    // 服务网关地址
+    // 默认为正式环境地址
     "ServerUrl": "https://openapi.alipay.com/gateway.do",
 
     // 签名类型
     "SignType": "RSA2",
 
     // 应用公钥证书
-    // 加签方式为公钥证书时,必填
+    // 可为文件路径 / 文件的base64字符串
+    // “公钥证书”方式时,必填
+    // “普通公钥”方式时,留空
     "AppCert": "",
 
     // 支付宝公钥证书
-    // 加签方式为公钥证书时,必填
+    // 可为文件路径 / 文件的base64字符串
+    // “公钥证书”方式时,必填
+    // “普通公钥”方式时,留空
     "AlipayPublicCert": "",
 
     // 支付宝根证书
-    // 加签方式为公钥证书时,必填
+    // 可为文件路径 / 文件的base64字符串
+    // “公钥证书”方式时,必填
+    // “普通公钥”方式时,留空
     "RootCert": ""
   }
 }

+ 37 - 14
samples/WebApplicationSample/appsettings.json

@@ -8,55 +8,78 @@
   },
   "AllowedHosts": "*",
 
-  // 正式环境配置
+  // 正式环境配置:appsettings.json
+  // 开发环境配置:appsettings.Development.json
 
+  // 微信支付
+  // 更多配置,请查看WeChatPayOptions类
   "WeChatPay": {
-    // 应用号(公众平台AppId/开放平台AppId/小程序AppId/企业微信CorpId)
+    // 应用号
+    // 如:微信公众平台AppId、微信开放平台AppId、微信小程序AppId、企业微信CorpId等
     "AppId": "",
 
     // 商户号
+    // 为微信支付商户平台的商户号
     "MchId": "",
 
-    // API秘钥,不是APIv3密钥
+    // API密钥
+    // 为微信支付商户平台的API密钥,请注意不是APIv3密钥
     "Key": "",
 
-    // API证书 .p12
+    // API证书(.p12扩展名)
+    // 为微信支付商户平台的API证书
+    // 可为文件路径 / 文件的base64字符串
     "Certificate": "",
 
-    // RSA公钥 (目前仅"企业付款到银行卡API"使用,调用"获取RSA加密公钥API"即可获取)
+    // RSA公钥
+    // 目前仅调用"企业付款到银行卡API"时使用,执行本示例中的"获取RSA加密公钥API"即可获取。
     "RsaPublicKey": ""
   },
+
+  // 支付宝
+  // 更多配置,请查看AlipayOptions类
   "Alipay": {
 
     // 注意: 
-    // 示例默认的加签方式为公钥证书,默认调用 CertificateExecuteAsync 方法 执行请求。
-    // 不使用公钥证书,除了遵守配置选项规则外,CertificateExecuteAsync 方法 需要改成 ExecuteAsync 方法。
+    // 若涉及资金类支出接口(如转账、红包等)接入,必须使用“公钥证书”方式。不涉及到资金类接口,也可以使用“普通公钥”方式进行加签。
+    // 本示例默认的加签方式为“公钥证书”方式,并调用 CertificateExecuteAsync 方法 执行API。
+    // 若使用“普通公钥”方式,除了遵守下方注释的规则外,调用 CertificateExecuteAsync 也需改成 ExecuteAsync。
+    // 支付宝后台密钥/证书官方配置教程:https://opendocs.alipay.com/open/291/105971
 
-    // 应用ID
+    // 支付宝应用Id
     "AppId": "",
 
-    // RSA 支付宝公钥,加签方式为公钥证书时,留空
+    // RSA 支付宝公钥
+    // “公钥证书”方式时,留空
+    // “普通公钥”方式时,必填
     "AlipayPublicKey": "",
 
-    // RSA 应用私钥,加签方式为公钥证书时,为证书私钥
+    // RSA 应用私钥
     "AppPrivateKey": "",
 
-    // 网关地址,默认正式环境
+    // 服务网关地址
+    // 默认为正式环境地址
     "ServerUrl": "https://openapi.alipay.com/gateway.do",
 
     // 签名类型
     "SignType": "RSA2",
 
     // 应用公钥证书
-    // 加签方式为公钥证书时,必填
+    // 可为文件路径 / 文件的base64字符串
+    // “公钥证书”方式时,必填
+    // “普通公钥”方式时,留空
     "AppCert": "",
 
     // 支付宝公钥证书
-    // 加签方式为公钥证书时,必填
+    // 可为文件路径 / 文件的base64字符串
+    // “公钥证书”方式时,必填
+    // “普通公钥”方式时,留空
     "AlipayPublicCert": "",
 
     // 支付宝根证书
-    // 加签方式为公钥证书时,必填
+    // 可为文件路径 / 文件的base64字符串
+    // “公钥证书”方式时,必填
+    // “普通公钥”方式时,留空
     "RootCert": ""
   }
 }

+ 22 - 13
src/Essensoft.AspNetCore.Payment.Alipay/AlipayOptions.cs

@@ -3,7 +3,7 @@
 namespace Essensoft.AspNetCore.Payment.Alipay
 {
     /// <summary>
-    /// Alipay 选项
+    /// Alipay 配置选项
     /// </summary>
     public class AlipayOptions
     {
@@ -16,55 +16,55 @@ namespace Essensoft.AspNetCore.Payment.Alipay
         internal string RootCertSN;
 
         /// <summary>
-        /// 蚂蚁金服开放平台 应用ID
+        /// 应用Id
         /// </summary>
         public string AppId { get; set; }
 
         /// <summary>
         /// RSA 支付宝公钥
-        /// 加签方式为公钥证书时,留空
+        /// “公钥证书”方式时,留空
+        /// “普通公钥”方式时,必填
         /// </summary>
         public string AlipayPublicKey { get; set; }
 
         /// <summary>
         /// RSA 应用私钥
-        /// 加签方式为公钥证书时,为证书对应的私钥
         /// </summary>
         public string AppPrivateKey { get; set; }
 
         /// <summary>
-        /// 服务地址
-        /// "https://openapi.alipay.com/gateway.do"
+        /// 服务网关地址
+        /// 默认为:"https://openapi.alipay.com/gateway.do"
         /// </summary>
         public string ServerUrl { get; set; } = "https://openapi.alipay.com/gateway.do";
 
         /// <summary>
         /// 数据格式
-        /// "json"
+        /// 默认为:"json"
         /// </summary>
         public string Format { get; } = "json";
 
         /// <summary>
         /// 接口版本
-        /// "1.0"
+        /// 默认为:"1.0"
         /// </summary>
         public string Version { get; set; } = "1.0";
 
         /// <summary>
         /// 签名方式
-        /// "RSA2"
+        /// 默认为:"RSA2"
         /// </summary>
         public string SignType { get; set; } = "RSA2";
 
         /// <summary>
         /// 编码格式
-        /// "utf-8"
+        /// 默认为:"utf-8"
         /// </summary>
         public string Charset { get; } = "utf-8";
 
         /// <summary>
         /// 加密方式
-        /// "AES"
+        /// 默认为:"AES"
         /// </summary>
         public string EncyptType { get; } = "AES";
 
@@ -74,7 +74,10 @@ namespace Essensoft.AspNetCore.Payment.Alipay
         public string EncyptKey { get; set; }
 
         /// <summary>
-        /// 商户证书
+        /// 应用公钥证书
+        /// 可为文件路径 / 文件的base64字符串
+        /// “公钥证书”方式时,必填
+        /// “普通公钥”方式时,留空
         /// </summary>
         public string AppCert
         {
@@ -92,6 +95,9 @@ namespace Essensoft.AspNetCore.Payment.Alipay
 
         /// <summary>
         /// 支付宝公钥证书
+        /// 可为文件路径 / 文件的base64字符串
+        /// “公钥证书”方式时,必填
+        /// “普通公钥”方式时,留空
         /// </summary>
         public string AlipayPublicCert
         {
@@ -109,7 +115,10 @@ namespace Essensoft.AspNetCore.Payment.Alipay
         }
 
         /// <summary>
-        /// 根证书
+        /// 支付宝根证书
+        /// 可为文件路径 / 文件的base64字符串
+        /// “公钥证书”方式时,必填
+        /// “普通公钥”方式时,留空
         /// </summary>
         public string RootCert
         {

+ 20 - 11
src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayOptions.cs

@@ -2,6 +2,9 @@
 
 namespace Essensoft.AspNetCore.Payment.WeChatPay
 {
+    /// <summary>
+    /// WeChatPay 配置选项
+    /// </summary>
     public class WeChatPayOptions
     {
         internal string CertificateHash;
@@ -10,37 +13,41 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay
         private string certificatePassword;
 
         /// <summary>
-        /// 微信应用密钥(企业微信Secret,目前仅"企业红包API"使用)
+        /// 应用密钥
+        /// 如:目前仅调用"企业红包API"时,使用企业微信的Secret。
         /// </summary>
         public string Secret { get; set; }
 
         /// <summary>
-        /// 微信应用号(公众平台AppId/开放平台AppId/小程序AppId/企业微信CorpId)
+        /// 应用号
+        /// 如:公众平台AppId/开放平台AppId/小程序AppId/企业微信CorpId等
         /// </summary>
         public string AppId { get; set; }
 
         /// <summary>
-        /// 微信支付 子商户应用(仅服务商时使用)
+        /// 商户号
         /// </summary>
-        public string SubAppId { get; set; }
+        public string MchId { get; set; }
 
         /// <summary>
-        /// 微信支付 商户号
+        /// 子商户应用号
+        /// 仅服务商时使用
         /// </summary>
-        public string MchId { get; set; }
+        public string SubAppId { get; set; }
 
         /// <summary>
-        /// 微信支付 子商户号(仅服务商时使用)
+        /// 子商户号
+        /// 仅服务商时使用
         /// </summary>
         public string SubMchId { get; set; }
 
         /// <summary>
-        /// 微信支付 API密钥(不是APIv3密钥)
+        /// API密钥
         /// </summary>
         public string Key { get; set; }
 
         /// <summary>
-        /// 微信支付 API证书(文件名/文件的Base64编码)
+        /// API证书(文件名/文件的Base64编码)
         /// </summary>
         public string Certificate
         {
@@ -56,7 +63,8 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay
         }
 
         /// <summary>
-        /// 微信支付 API证书密码(默认为商户号)
+        /// API证书密码
+        /// 默认为商户号
         /// </summary>
         public string CertificatePassword
         {
@@ -65,7 +73,8 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay
         }
 
         /// <summary>
-        /// 微信支付 RSA公钥(目前仅"企业付款到银行卡API"使用,调用"获取RSA加密公钥API"即可获取)
+        /// RSA公钥
+        /// 目前仅调用"企业付款到银行卡API"时使用,执行"获取RSA加密公钥API"即可获取。
         /// </summary>
         public string RsaPublicKey { get; set; }
     }