From 78a679001ceaca030d4f05a5cd58660c72d80203 Mon Sep 17 00:00:00 2001
From: Fu Diwei <fudiwei@sina.com>
Date: Tue, 11 Apr 2023 15:42:49 +0800
Subject: [PATCH] =?UTF-8?q?docs:=20=E5=AE=8C=E5=96=84=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Basic_ModelDefinition.md                  | 92 ++++++++++++++++---
 .../Basic_RequestSensitiveDataEncryption.md   | 12 +--
 .../Basic_ResponseSensitiveDataDecryption.md  |  6 +-
 .../Basic_ResponseSignatureVerification.md    |  2 +-
 docs/WechatTenpayBusiness/README.md           | 23 +++--
 5 files changed, 101 insertions(+), 34 deletions(-)

diff --git a/docs/WechatTenpayBusiness/Basic_ModelDefinition.md b/docs/WechatTenpayBusiness/Basic_ModelDefinition.md
index a214d94d..ec9a5f9a 100644
--- a/docs/WechatTenpayBusiness/Basic_ModelDefinition.md
+++ b/docs/WechatTenpayBusiness/Basic_ModelDefinition.md
@@ -4,7 +4,7 @@
 
 本库提供的请求模型、响应模型和接口方法,三者均保持同名。
 
-例如,申请产品开通的请求是 `CreateMSEPayProductApplicationRequest`,响应是 `CreateMSEPayProductApplicationResponse`,接口是 `ExecuteCreateMSEPayProductApplicationAsync()`。知道其中一个,其余两个就可以快速地推断出了。
+例如,申请产品开通的请求是 `CreateProductApplicationRequest`,响应是 `CreateProductApplicationResponse`,接口是 `ExecuteCreateProductApplicationAsync()`。知道其中一个,其余两个就可以快速地推断出了。
 
 再有,每个对象的命名与官方文档的接口地址大体保持一致。例如刚刚提到的申请产品开通,它的接口地址是 `[POST] /mse-pay/product-applications`,将其中的反斜杠去掉、并以大驼峰命名法的方式调整它,就可以得到前文提到的几个对象了。
 
@@ -24,38 +24,102 @@
 
 ### 【附】微企付商户 API 模型命名速查表:
 
+注:树形结构与[微企付开发文档](https://businesspay.qq.com/p/doc/mse/api/server.html)目录结构保持一致。
+
 <details>
 
 <summary>[展开查看]</summary>
 
 -   商户入驻
 
-    -   申请产品开通:`CreateMSEPayProductApplication`
+    -   文件上传:`UploadFile`
 
-    -   查询产品开通:`GetMSEPayProductApplicationByOutRequestNumber` / `GetMSEPayProductApplicationByRequestNumber`
+    -   申请入驻:`CreateProductApplication`
 
-    -   创建开通跳转链接:`CreateMSEPayProductApplicationLink`
+    -   创建入驻跳转链接:`CreateProductApplicationLink`
 
-    -   图片上传接口:`UploadFile`
+    -   查询入驻结果(内单号):`GetProductApplicationByRequestNumber`
+
+    -   查询入驻结果(外单号):`GetProductApplicationByOutRequestNumber`
+
+-   二维码支付
+
+    -   二维码支付预下单:`CreatePaymentQrcodePay`
+
+    -   获取跳转对象信息:`CreatePaymentRedirectLink`
+
+    -   查询订单明细(内单号):`GetPaymentByPaymentId`
+
+    -   查询订单明细(外单号):`GetPaymentByOutPaymentId`
+
+    -   支付关单:`ClosePayment`
+
+-   小程序支付
+
+    -   小程序支付预下单:`CreatePaymentMiniProgramPay`
+
+    -   获取跳转对象信息:`CreatePaymentRedirectLink`
+
+    -   查询订单明细(内单号):`GetPaymentByPaymentId`
+
+    -   查询订单明细(外单号):`GetPaymentByOutPaymentId`
+
+    -   支付关单:`ClosePayment`
 
 -   H5 支付
 
-    -   H5 支付预下单:`CreateMSEPayPaymentH5Pay`
+    -   H5 支付预下单:`CreatePaymentH5Pay`
 
-    -   根据交易订单查询付款结果:`GetMSEPayPaymentByOutPaymentId` / `GetMSEPayPaymentByPaymentId`
+    -   获取跳转对象信息:`CreatePaymentRedirectLink`
 
-    -   主动关单:`CloseMSEPayPayment`
+    -   查询订单明细(内单号):`GetPaymentByPaymentId`
 
-    -   主动关单:`CloseMSEPayPayment`
+    -   查询订单明细(外单号):`GetPaymentByOutPaymentId`
 
--   公共资源 Redirect:
+    -   支付关单:`ClosePayment`
 
-    -   获取跳转对象:`CreateMSEPayRedirectLink`
+-   App 支付
 
--   文件获取:
+    -   App 支付预下单:`CreatePaymentAppPay`
 
-    -   获取账单文件下载地址:`GetMSEPayAccountBill`
+    -   获取跳转对象信息:`CreatePaymentRedirectLink`
 
-    -   文件获取:`DownloadMSEPayAccountBill`
+    -   查询订单明细(内单号):`GetPaymentByPaymentId`
+
+    -   查询订单明细(外单号):`GetPaymentByOutPaymentId`
+
+    -   支付关单:`ClosePayment`
+
+-   企业微信支付
+
+    -   开通并支付预下单:`CreatePaymentAppRegisteringPay`
+
+    -   支付预下单:`CreatePaymentAppPay`
+
+    -   获取跳转对象信息:`CreatePaymentRedirectLink`
+
+    -   查询订单明细(内单号):`GetPaymentByPaymentId`
+
+    -   查询订单明细(外单号):`GetPaymentByOutPaymentId`
+
+    -   支付关单:`ClosePayment`
+
+-   账单下载:
+
+    -   获取资金账单下载链接:`GetBill`
+
+    -   资金账单下载:`DownloadBillFile`
+
+    -   获取交易账单下载链接:`GetBillTransaction`
+
+    -   交易账单下载:`DownloadBillFile`
+
+-   退款:
+
+    -   退款申请:`CreateRefund`
+
+    -   退款查询(内单号):`GetRefundByRefundId`
+
+    -   退款查询(外单号):`GetRefundByOutRefundId`
 
 </details>
diff --git a/docs/WechatTenpayBusiness/Basic_RequestSensitiveDataEncryption.md b/docs/WechatTenpayBusiness/Basic_RequestSensitiveDataEncryption.md
index 63042ffe..fc832cc4 100644
--- a/docs/WechatTenpayBusiness/Basic_RequestSensitiveDataEncryption.md
+++ b/docs/WechatTenpayBusiness/Basic_RequestSensitiveDataEncryption.md
@@ -4,14 +4,14 @@
 
 ### 加密流程
 
-对于部分接口请求传递的敏感信息,腾讯微企付可能会需要使用以下方式进行加密:
+对于部分接口请求传递的敏感信息,微企付可能会需要使用以下方式进行加密:
 
--   使用腾讯微企付公钥基于 RSAES-OAEP + SM4 算法加密。
+-   使用微企付公钥基于 RSAES-OAEP + SM4 算法加密。
 
 开发者利用本库提供的 `RSAUtility`、`SM4Utility` 工具类自行加密相关字段。下面给出一个使用 `RSAUtility`、`SM4Utility` 工具类加密数据的示例代码:
 
 ```csharp
-// 先通过腾讯微企付公钥基于 RSAES-OAEP 得到加密后的 SM4 密钥
+// 先通过微企付公钥基于 RSAES-OAEP 得到加密后的 SM4 密钥
 string sm4IV = "SM4 偏移量";
 string sm4Key = "SM4 密钥";
 string sm4EncryptedKey = RSAUtility.EncryptWithECB(tbepPublicKey, sm4Key);
@@ -31,9 +31,9 @@ request.TBEPEncryption = new WechatTenpayBusinessRequestTBEPEncryption()
 此外,本库还封装了直接加密请求中敏感信息字段的扩展方法。下面给出一个手动调用的示例:
 
 ```csharp
-var request = new CreateMSEPayProductApplicationRequest()
+var request = new CreateProductApplicationRequest()
 {
-    BusinessLicense = new CreateMSEPayProductApplicationRequest.Types.BusinessLicense()
+    BusinessLicense = new CreateProductApplicationRequest.Types.BusinessLicense()
     {
         BusinessRegisterType = "TYPE",
         MerchantName = "商户",
@@ -45,7 +45,7 @@ Console.WriteLine("before: {0}", request.BusinessLicense.Name); // 此时仍是
 client.EncryptRequestSensitiveProperty(request);
 Console.WriteLine("after: {0}", request.BusinessLicense.Name); // 此时已是密文
 
-var response = await client.ExecuteCreateMSEPayProductApplicationAsync(request);
+var response = await client.ExecuteCreateProductApplicationAsync(request);
 ```
 
 如果你希望本库在请求前能自动完成这项操作,你可以在构造得到 `WechatTenpayBusinessClient` 对象时指定自动化参数:
diff --git a/docs/WechatTenpayBusiness/Basic_ResponseSensitiveDataDecryption.md b/docs/WechatTenpayBusiness/Basic_ResponseSensitiveDataDecryption.md
index ea6049c6..88f57c6c 100644
--- a/docs/WechatTenpayBusiness/Basic_ResponseSensitiveDataDecryption.md
+++ b/docs/WechatTenpayBusiness/Basic_ResponseSensitiveDataDecryption.md
@@ -4,7 +4,7 @@
 
 ### 解密流程
 
-对于部分接口响应返回的敏感信息,腾讯微企付可能会需要使用以下方式进行解密:
+对于部分接口响应返回的敏感信息,微企付可能会需要使用以下方式进行解密:
 
 -   使用平台私钥基于 RSAES-OAEP + SM4 算法解密。
 
@@ -23,8 +23,8 @@ string plainText = SM4Utility.DecryptWithCBC(sm4Key, sm4IV, cipherText);
 此外,本库还封装了直接解密响应中敏感信息字段的扩展方法,下面给出一个示例代码:
 
 ```csharp
-var request = new GetMSEPayPaymentByPaymentIdRequest();
-var response = await client.ExecuteGetMSEPayPaymentByPaymentIdAsync(request);
+var request = new GetPaymentByPaymentIdRequest();
+var response = await client.ExecuteGetPaymentByPaymentIdAsync(request);
 
 Console.WriteLine("before: {0}", response.Payee.EnterpriseName); // 此时仍是密文
 client.DecryptResponseSensitiveProperty(response);
diff --git a/docs/WechatTenpayBusiness/Basic_ResponseSignatureVerification.md b/docs/WechatTenpayBusiness/Basic_ResponseSignatureVerification.md
index 71aa9507..4c1388cf 100644
--- a/docs/WechatTenpayBusiness/Basic_ResponseSignatureVerification.md
+++ b/docs/WechatTenpayBusiness/Basic_ResponseSignatureVerification.md
@@ -11,7 +11,7 @@
 ```csharp
 string data = "拼接好的验签数据";
 string sign = "待验证的签名";
-string tbepPublicKey = "腾讯微企付公钥";
+string tbepPublicKey = "微企付公钥";
 bool ret = RSAUtility.VerifyWithSHA256(tbepPublicKey, data, sign);
 ```
 
diff --git a/docs/WechatTenpayBusiness/README.md b/docs/WechatTenpayBusiness/README.md
index 23a83839..f5c531d4 100644
--- a/docs/WechatTenpayBusiness/README.md
+++ b/docs/WechatTenpayBusiness/README.md
@@ -1,14 +1,14 @@
 # SKIT.FlurlHttpClient.Wechat.TenpayBusiness
 
-基于 `Flurl.Http` 的[腾讯微企付](https://business.tenpay.com/p/gateway-pay/) HTTP API SDK。
+基于 `Flurl.Http` 的[微企付](https://businesspay.qq.com/p/mse-pay/) HTTP API SDK。
 
 ---
 
 ## 功能
 
--   基于腾讯微企付 API 封装。
+-   基于微企付 API 封装。
 -   请求时自动生成签名,无需开发者手动干预。
--   提供了腾讯微企付所需的 RSA、SM3、SM4、SHA-256 等算法工具类。
+-   提供了微企付所需的 RSA、SM3、SM4、SHA-256 等算法工具类。
 -   提供了解析回调通知事件等扩展方法。
 
 ---
@@ -35,11 +35,14 @@ using SKIT.FlurlHttpClient.Wechat.TenpayBusiness;
 
 var options = new WechatTenpayBusinessClientOptions()
 {
-    PlatformId = "腾讯微企付平台账号",
-    PlatformCertificateSerialNumber = "腾讯微企付平台 API 证书序列号",
-    PlatformCertificatePrivateKey = "-----BEGIN PRIVATE KEY-----腾讯微企付平台 API 证书私钥-----END PRIVATE KEY-----",
-    TBEPCertificateSerialNumber = "腾讯微企付证书序列号",
-    TBEPCertificatePublicKey = "-----BEGIN PUBLIC KEY-----腾讯微企付证书公钥-----END PUBLIC KEY-----"
+    PlatformId = "微企付平台账号",
+    PlatformCertificateSerialNumber = "微企付平台 API 证书序列号",
+    PlatformCertificatePrivateKey = "-----BEGIN PRIVATE KEY-----微企付平台 API 证书私钥-----END PRIVATE KEY-----",
+    EnterpriseId = "微企付企业商户 ID(非必填)",
+    EnterpriseCertificateSerialNumber = "微企付企业商户 API 证书序列号(非必填)",
+    EnterpriseCertificatePrivateKey = "-----BEGIN PRIVATE KEY-----微企付企业商户 API 证书私钥(非必填)-----END PRIVATE KEY-----",
+    TBEPCertificateSerialNumber = "微企付证书序列号",
+    TBEPCertificatePublicKey = "-----BEGIN PUBLIC KEY-----微企付证书公钥-----END PUBLIC KEY-----"
 };
 var client = new WechatTenpayBusinessClient(options);
 ```
@@ -51,11 +54,11 @@ using SKIT.FlurlHttpClient.Wechat.TenpayBusiness;
 using SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Models;
 
 /* 以根据交易订单查询付款结果接口为例 */
-var request = new GetMSEPayPaymentByPaymentIdRequest()
+var request = new GetPaymentByPaymentIdRequest()
 {
     OutPaymentId = "平台支付单号"
 };
-var response = await client.ExecuteGetMSEPayPaymentByOutPaymentIdAsync(request);
+var response = await client.ExecuteGetPaymentByOutPaymentIdAsync(request);
 if (response.IsSuccessful())
 {
     Console.WriteLine("微企付支付单号:" + response.PaymentId);